more fixes. take in account when depth textures are used and alpha test fails :)( i really forgot that).
This commit is contained in:
parent
4fafbd0700
commit
5650b3b5f6
|
@ -24,7 +24,7 @@
|
||||||
// Increment this every time you change shader generation code.
|
// Increment this every time you change shader generation code.
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
LINEAR_DISKCACHE_VER = 6978
|
LINEAR_DISKCACHE_VER = 6979
|
||||||
};
|
};
|
||||||
|
|
||||||
// On disk format:
|
// On disk format:
|
||||||
|
|
|
@ -769,11 +769,6 @@ const char *GeneratePixelShaderCode(PSGRENDER_MODE PSGRenderMode, API_TYPE ApiTy
|
||||||
// emulation of unsigned 8 overflow when casting
|
// emulation of unsigned 8 overflow when casting
|
||||||
WRITE(p, "prev = frac(4.0f + prev * (255.0f/256.0f)) * (256.0f/255.0f);\n");
|
WRITE(p, "prev = frac(4.0f + prev * (255.0f/256.0f)) * (256.0f/255.0f);\n");
|
||||||
|
|
||||||
if(Pretest == ALPHAPT_UNDEFINED)
|
|
||||||
{
|
|
||||||
WriteAlphaTest(p, ApiType, PSGRenderMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MustWriteToDepth)
|
if (MustWriteToDepth)
|
||||||
{
|
{
|
||||||
// use the texture input of the last texture stage (textemp), hopefully this has been read and is in correct format...
|
// use the texture input of the last texture stage (textemp), hopefully this has been read and is in correct format...
|
||||||
|
@ -790,7 +785,7 @@ const char *GeneratePixelShaderCode(PSGRENDER_MODE PSGRenderMode, API_TYPE ApiTy
|
||||||
WRITE(p, "zCoord = zCoord * (16777216.0f/16777215.0f);\n");
|
WRITE(p, "zCoord = zCoord * (16777216.0f/16777215.0f);\n");
|
||||||
}
|
}
|
||||||
WRITE(p, "depth = zCoord;\n");
|
WRITE(p, "depth = zCoord;\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PSGRenderMode == PSGRENDER_DSTALPHA_ALPHA_PASS)
|
if (PSGRenderMode == PSGRENDER_DSTALPHA_ALPHA_PASS)
|
||||||
WRITE(p, " ocol0 = float4(prev.rgb, "I_ALPHA"[0].a);\n");
|
WRITE(p, " ocol0 = float4(prev.rgb, "I_ALPHA"[0].a);\n");
|
||||||
|
@ -809,6 +804,21 @@ const char *GeneratePixelShaderCode(PSGRENDER_MODE PSGRenderMode, API_TYPE ApiTy
|
||||||
// ...and the alpha from ocol0 will be written to the framebuffer.
|
// ...and the alpha from ocol0 will be written to the framebuffer.
|
||||||
WRITE(p, " ocol0.a = "I_ALPHA"[0].a;\n");
|
WRITE(p, " ocol0.a = "I_ALPHA"[0].a;\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Alpha test could fail here if depth texture is enabled
|
||||||
|
if (Pretest == ALPHAPT_ALWAYSFAIL)
|
||||||
|
{
|
||||||
|
if(!FastZcomploc)
|
||||||
|
{
|
||||||
|
WRITE(p, "discard;\n");
|
||||||
|
if(ApiType != API_D3D11)
|
||||||
|
WRITE(p, "return;\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(Pretest == ALPHAPT_UNDEFINED)
|
||||||
|
{
|
||||||
|
WriteAlphaTest(p, ApiType, PSGRenderMode);
|
||||||
|
}
|
||||||
|
|
||||||
WRITE(p, "}\n");
|
WRITE(p, "}\n");
|
||||||
if (text[sizeof(text) - 1] != 0x7C)
|
if (text[sizeof(text) - 1] != 0x7C)
|
||||||
|
@ -1205,12 +1215,6 @@ static void WriteAlphaTest(char *&p, API_TYPE ApiType,PSGRENDER_MODE PSGRenderMo
|
||||||
WRITE(p, tevAlphaFuncsTable[compindex],alphaRef[1]);//lookup the second component from the alpha function table
|
WRITE(p, tevAlphaFuncsTable[compindex],alphaRef[1]);//lookup the second component from the alpha function table
|
||||||
WRITE(p, ")) {\n");
|
WRITE(p, ")) {\n");
|
||||||
|
|
||||||
WRITE(p, "ocol0 = 0;\n");
|
|
||||||
if (PSGRenderMode == PSGRENDER_DSTALPHA_DUAL_SOURCE_BLEND)
|
|
||||||
WRITE(p, "ocol1 = 0;\n");
|
|
||||||
if (MustWriteToDepth)
|
|
||||||
WRITE(p, "depth = zCoord;\n");
|
|
||||||
|
|
||||||
// HAXX: zcomploc is a way to control whether depth test is done before
|
// HAXX: zcomploc is a way to control whether depth test is done before
|
||||||
// or after texturing and alpha test. PC GPU does depth test before texturing ONLY if depth value is
|
// or after texturing and alpha test. PC GPU does depth test before texturing ONLY if depth value is
|
||||||
// not updated during shader execution.
|
// not updated during shader execution.
|
||||||
|
|
Loading…
Reference in New Issue