mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 13:20:27 -06:00
Implemented secondary path for hardware with no multiples render target support, so please a lot of testing from people with problems in the last release.
corrected a little depth textures still broken but now at least i discover the reason, the ultra bad news for d3d lover is, the only correct way to implement depth textures will be do a firs depth only pass disabling blending. This is because blending is affecting the values stored in the depth texture, so to store the true values, blending mus be deactivated. this will degrade performance but is the only "Correct" way in d3d 9. the other possibility is dx10 but that's a complete different story ;) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4526 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -143,10 +143,10 @@ void GetPixelShaderId(PIXELSHADERUID &uid, u32 texturemask, u32 dstAlphaEnable)
|
||||
// output is given by .outreg
|
||||
// tevtemp is set according to swapmodetables and
|
||||
|
||||
static void WriteStage(char *&p, int n, u32 texture_mask, bool HLSL);
|
||||
static void SampleTexture(char *&p, const char *destination, const char *texcoords, const char *texswap, int texmap, u32 texture_mask, bool HLSL);
|
||||
static void WriteStage(char *&p, int n, u32 texture_mask, u32 HLSL);
|
||||
static void SampleTexture(char *&p, const char *destination, const char *texcoords, const char *texswap, int texmap, u32 texture_mask, u32 HLSL);
|
||||
static void WriteAlphaCompare(char *&p, int num, int comp);
|
||||
static bool WriteAlphaTest(char *&p, bool HLSL);
|
||||
static bool WriteAlphaTest(char *&p, u32 HLSL);
|
||||
static void WriteFog(char *&p);
|
||||
|
||||
const float epsilon8bit = 1.0f / 255.0f;
|
||||
@ -382,7 +382,7 @@ static void BuildSwapModeTable()
|
||||
}
|
||||
}
|
||||
|
||||
const char *GeneratePixelShader(u32 texture_mask, bool dstAlphaEnable, bool HLSL)
|
||||
const char *GeneratePixelShader(u32 texture_mask, bool dstAlphaEnable, u32 HLSL)
|
||||
{
|
||||
setlocale(LC_NUMERIC, "C"); // Reset locale for compilation
|
||||
text[sizeof(text) - 1] = 0x7C; // canary
|
||||
@ -452,7 +452,7 @@ const char *GeneratePixelShader(u32 texture_mask, bool dstAlphaEnable, bool HLSL
|
||||
WRITE(p, "void main(\n");
|
||||
|
||||
WRITE(p, " out float4 ocol0 : COLOR0,\n");
|
||||
if (HLSL)
|
||||
if (HLSL == 1)
|
||||
WRITE(p, " out float4 ocol1 : COLOR1,\n");
|
||||
WRITE(p, " out float depth : DEPTH,\n");
|
||||
|
||||
@ -530,14 +530,13 @@ const char *GeneratePixelShader(u32 texture_mask, bool dstAlphaEnable, bool HLSL
|
||||
|
||||
WRITE(p, "depth = zCoord;\n");
|
||||
|
||||
if(HLSL)
|
||||
if(HLSL == 1)
|
||||
{
|
||||
//WRITE(p, "ocol1 = float4(1.0f/255.0f,2.0f/255.0f,3.0f/255.0f,0.0f);\n");
|
||||
WRITE(p, "float4 EncodedDepth = frac(zCoord * float4(254.0f*255.0f,255.0f,254.0f/255.0f,254.0f*255.0f*255.0f));\n");
|
||||
//WRITE(p, "EncodedDepth -= EncodedDepth.aarg * float4(1.0f/255.0f,1.0f/255.0f,1.0f/255.0f,0.0f);\n");
|
||||
WRITE(p, "ocol1 = EncodedDepth;\n");
|
||||
WRITE(p, "float4 EncodedDepth = frac(zCoord * float4(254.0f/255.0,254.0f,254.0f*255.0f,0.0f));\n");
|
||||
WRITE(p, "EncodedDepth -= EncodedDepth.raag * float4(0.0f,1.0f/255.0f,1.0f/255.0f,0.0f);\n");
|
||||
WRITE(p, "ocol1 = float4(EncodedDepth.rgb,1.0f);\n");
|
||||
|
||||
}
|
||||
}
|
||||
//if (bpmem.genMode.numindstages ) WRITE(p, "prev.rg = indtex0.xy;\nprev.b = 0;\n");
|
||||
|
||||
if (!WriteAlphaTest(p, HLSL))
|
||||
@ -613,7 +612,7 @@ static const char *TEVCMPAlphaOPTable[16] =
|
||||
};
|
||||
|
||||
|
||||
static void WriteStage(char *&p, int n, u32 texture_mask, bool HLSL)
|
||||
static void WriteStage(char *&p, int n, u32 texture_mask, u32 HLSL)
|
||||
{
|
||||
char *rasswap = swapModeTable[bpmem.combiners[n].alphaC.rswap];
|
||||
char *texswap = swapModeTable[bpmem.combiners[n].alphaC.tswap];
|
||||
@ -811,7 +810,7 @@ static void WriteStage(char *&p, int n, u32 texture_mask, bool HLSL)
|
||||
WRITE(p, ");\n\n");
|
||||
}
|
||||
|
||||
void SampleTexture(char *&p, const char *destination, const char *texcoords, const char *texswap, int texmap, u32 texture_mask, bool HLSL)
|
||||
void SampleTexture(char *&p, const char *destination, const char *texcoords, const char *texswap, int texmap, u32 texture_mask, u32 HLSL)
|
||||
{
|
||||
if (texture_mask & (1<<texmap)) {
|
||||
// non pow 2
|
||||
@ -870,7 +869,7 @@ static const char *tevAlphaFunclogicTable[] =
|
||||
" == " // xnor
|
||||
};
|
||||
|
||||
static bool WriteAlphaTest(char *&p, bool HLSL)
|
||||
static bool WriteAlphaTest(char *&p, u32 HLSL)
|
||||
{
|
||||
u32 op = bpmem.alphaFunc.logic;
|
||||
u32 comp[2] = {bpmem.alphaFunc.comp0,bpmem.alphaFunc.comp1};
|
||||
|
Reference in New Issue
Block a user