mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-25 07:21:14 +01:00
The result of the last texenv stage is used regardless of destination register
The real hardware probably always sends the result of its computations to the alpha test/fog units, in parallel to its registers, but those only take the result of the last texenv stage. This makes grass show up in ZTP, where the last texenv stage oddly writes to reg #3 instead of #0. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5462 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
ab89decac5
commit
e07a91930d
@ -146,7 +146,7 @@ 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, u32 HLSL);
|
||||
static void WriteStage(char *&p, int n, u32 texture_mask, u32 HLSL, bool final);
|
||||
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, u32 HLSL);
|
||||
@ -520,7 +520,7 @@ const char *GeneratePixelShaderCode(u32 texture_mask, bool dstAlphaEnable, u32 H
|
||||
|
||||
|
||||
for (int i = 0; i < numStages; i++)
|
||||
WriteStage(p, i, texture_mask,HLSL); //build the equation for this stage
|
||||
WriteStage(p, i, texture_mask,HLSL,i+1 == numStages); //build the equation for this stage
|
||||
// emulation of unisgned 8 overflow when casting
|
||||
if(HLSL)
|
||||
{
|
||||
@ -626,7 +626,7 @@ static const char *TEVCMPAlphaOPTable[16] =
|
||||
};
|
||||
|
||||
|
||||
static void WriteStage(char *&p, int n, u32 texture_mask, u32 HLSL)
|
||||
static void WriteStage(char *&p, int n, u32 texture_mask, u32 HLSL, bool final)
|
||||
{
|
||||
char *rasswap = swapModeTable[bpmem.combiners[n].alphaC.rswap];
|
||||
char *texswap = swapModeTable[bpmem.combiners[n].alphaC.tswap];
|
||||
@ -739,9 +739,9 @@ static void WriteStage(char *&p, int n, u32 texture_mask, u32 HLSL)
|
||||
WRITE(p, "konsttemp=float4(%s,%s);\n",tevKSelTableC[kc],tevKSelTableA[ka]);
|
||||
|
||||
if (cc.clamp)
|
||||
WRITE(p, "%s=saturate(", tevCOutputTable[cc.dest]);
|
||||
WRITE(p, "%s=saturate(", tevCOutputTable[final?0:cc.dest]);
|
||||
else
|
||||
WRITE(p, "%s=", tevCOutputTable[cc.dest]);
|
||||
WRITE(p, "%s=", tevCOutputTable[final?0:cc.dest]);
|
||||
|
||||
// combine the color channel
|
||||
if (cc.bias != 3) // if not compare
|
||||
@ -788,9 +788,9 @@ static void WriteStage(char *&p, int n, u32 texture_mask, u32 HLSL)
|
||||
|
||||
// combine the alpha channel
|
||||
if (ac.clamp)
|
||||
WRITE(p, "%s=saturate(", tevAOutputTable[ac.dest]);
|
||||
WRITE(p, "%s=saturate(", tevAOutputTable[final?0:ac.dest]);
|
||||
else
|
||||
WRITE(p, "%s=", tevAOutputTable[ac.dest]);
|
||||
WRITE(p, "%s=", tevAOutputTable[final?0:ac.dest]);
|
||||
|
||||
if (ac.bias != 3) // if not compare
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user