Fix for my last commit thanks to Lolaker for pointing the error

This commit is contained in:
rodolfoosvaldobogado 2012-04-03 09:56:11 -03:00
parent 6a446efd5f
commit 4fafbd0700
2 changed files with 9 additions and 6 deletions

View File

@ -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 = 6976 LINEAR_DISKCACHE_VER = 6978
}; };
// On disk format: // On disk format:

View File

@ -609,7 +609,7 @@ const char *GeneratePixelShaderCode(PSGRENDER_MODE PSGRenderMode, API_TYPE ApiTy
for (int i = 0; i < numTexgen; ++i) for (int i = 0; i < numTexgen; ++i)
WRITE(p, ",\n in float3 uv%d : TEXCOORD%d", i, i); WRITE(p, ",\n in float3 uv%d : TEXCOORD%d", i, i);
WRITE(p, ",\n in float4 clipPos : TEXCOORD%d", numTexgen); WRITE(p, ",\n in float4 clipPos : TEXCOORD%d", numTexgen);
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) if(PixelLigthingEnabled)
WRITE(p, ",\n in float4 Normal : TEXCOORD%d", numTexgen + 1); WRITE(p, ",\n in float4 Normal : TEXCOORD%d", numTexgen + 1);
} }
else else
@ -617,12 +617,12 @@ const char *GeneratePixelShaderCode(PSGRENDER_MODE PSGRenderMode, API_TYPE ApiTy
// wpos is in w of first 4 texcoords // wpos is in w of first 4 texcoords
if(PixelLigthingEnabled) if(PixelLigthingEnabled)
{ {
for (int i = 0; i < 8; ++i) for (int i = 0; i < numTexgen; ++i)
WRITE(p, ",\n in float4 uv%d : TEXCOORD%d", i, i); WRITE(p, ",\n in float4 uv%d : TEXCOORD%d", i, i);
} }
else else
{ {
for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i) for (unsigned int i = 0; i < numTexgen; ++i)
WRITE(p, ",\n in float%d uv%d : TEXCOORD%d", i < 4 ? 4 : 3 , i, i); WRITE(p, ",\n in float%d uv%d : TEXCOORD%d", i < 4 ? 4 : 3 , i, i);
} }
} }
@ -630,7 +630,10 @@ const char *GeneratePixelShaderCode(PSGRENDER_MODE PSGRenderMode, API_TYPE ApiTy
if((bpmem.fog.c_proj_fsel.fsel != 0) || MustWriteToDepth) if((bpmem.fog.c_proj_fsel.fsel != 0) || MustWriteToDepth)
{ {
// the screen space depth value = far z + (clip z / clip w) * z range // the screen space depth value = far z + (clip z / clip w) * z range
if (numTexgen < 7)
WRITE(p, "float zCoord = "I_ZBIAS"[1].x + (clipPos.z / clipPos.w) * "I_ZBIAS"[1].y;\n"); WRITE(p, "float zCoord = "I_ZBIAS"[1].x + (clipPos.z / clipPos.w) * "I_ZBIAS"[1].y;\n");
else
WRITE(p, "float zCoord = "I_ZBIAS"[1].x + (uv2.w / uv3.w) * "I_ZBIAS"[1].y;\n");
} }
char* pmainstart = p; char* pmainstart = p;
if(PSGRenderMode == PSGRENDER_ZCOMPLOCK && !DepthTextureEnable) if(PSGRenderMode == PSGRENDER_ZCOMPLOCK && !DepthTextureEnable)
@ -691,7 +694,7 @@ const char *GeneratePixelShaderCode(PSGRENDER_MODE PSGRenderMode, API_TYPE ApiTy
if(PixelLigthingEnabled) if(PixelLigthingEnabled)
{ {
if (xfregs.numTexGen.numTexGens < 7) if (numTexgen < 7)
{ {
WRITE(p,"float3 _norm0 = normalize(Normal.xyz);\n\n"); WRITE(p,"float3 _norm0 = normalize(Normal.xyz);\n\n");
WRITE(p,"float3 pos = float3(clipPos.x,clipPos.y,Normal.w);\n"); WRITE(p,"float3 pos = float3(clipPos.x,clipPos.y,Normal.w);\n");