Only emit the texgens if they are used, not every single time do all of them.

This commit is contained in:
Ryan Houdek 2013-10-06 20:07:16 -05:00
parent cf1b634c33
commit d4bd5fde71
2 changed files with 6 additions and 7 deletions

View File

@ -319,7 +319,8 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
if (xfregs.numTexGen.numTexGens < 7)
{
for (int i = 0; i < 8; ++i)
out.Write("VARYIN float3 uv%d_2;\n", i);
if(i < xfregs.numTexGen.numTexGens)
out.Write("VARYIN float3 uv%d_2;\n", i);
out.Write("VARYIN float4 clipPos_2;\n");
if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
{
@ -437,7 +438,8 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
{
if(numTexgen)
for (int i = 0; i < 8; ++i)
out.Write("float3 uv%d = uv%d_2;\n", i, i);
if(i < xfregs.numTexGen.numTexGens)
out.Write("float3 uv%d = uv%d_2;\n", i, i);
out.Write("float4 clipPos = clipPos_2;\n");
if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
{

View File

@ -143,7 +143,8 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
if (xfregs.numTexGen.numTexGens < 7)
{
for (int i = 0; i < 8; ++i)
out.Write("VARYOUT float3 uv%d_2;\n", i);
if (i < xfregs.numTexGen.numTexGens)
out.Write("VARYOUT float3 uv%d_2;\n", i);
out.Write("VARYOUT float4 clipPos_2;\n");
if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
out.Write("VARYOUT float4 Normal_2;\n");
@ -483,12 +484,8 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
if (xfregs.numTexGen.numTexGens < 7)
{
for (unsigned int i = 0; i < 8; ++i)
{
if(i < xfregs.numTexGen.numTexGens)
out.Write(" uv%d_2.xyz = o.tex%d;\n", i, i);
else
out.Write(" uv%d_2.xyz = float3(0.0, 0.0, 0.0);\n", i);
}
out.Write(" clipPos_2 = o.clipPos;\n");
if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
out.Write(" Normal_2 = o.Normal;\n");