summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2013-10-15 14:38:26 +0200
committerdegasus <wickmarkus@web.de>2013-10-15 14:38:26 +0200
commitbd80de14f4ca991e2fecdaae53465fae4ea653c8 (patch)
tree51fa2e30779c082a677701b9e2f5c6534f59df67 /Source/Core/VideoCommon/Src/PixelShaderGen.cpp
parentf62579761cadc44e72c296e537224d937ba67d82 (diff)
ShaderGen: drop PerPixelLighting + 8Texcoord hack
D3D9 only supports 8 texcoords. But we need a new one for ppl, so we just store it in the first 4 texcoords in the free 4th component. This isn't needed for both d3d11 and ogl3, so just remove it.
Diffstat (limited to 'Source/Core/VideoCommon/Src/PixelShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/PixelShaderGen.cpp84
1 files changed, 15 insertions, 69 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
index 9dfa6cf064..373135f4c4 100644
--- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
@@ -316,34 +316,12 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
// compute window position if needed because binding semantic WPOS is not widely supported
// Let's set up attributes
- if (xfregs.numTexGen.numTexGens < 7)
+ for (int i = 0; i < xfregs.numTexGen.numTexGens; ++i)
+ 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)
{
- for (int i = 0; i < xfregs.numTexGen.numTexGens; ++i)
- 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)
- {
- out.Write("VARYIN float4 Normal_2;\n");
- }
- }
- else
- {
- // wpos is in w of first 4 texcoords
- if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
- {
- for (int i = 0; i < 8; ++i)
- {
- out.Write("VARYIN float4 uv%d_2;\n", i);
- }
- }
- else
- {
- for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i)
- {
- out.Write("VARYIN float%d uv%d_2;\n", i < 4 ? 4 : 3 , i);
- }
- }
- out.Write("float4 clipPos;\n");
+ out.Write("VARYIN float4 Normal_2;\n");
}
if (forced_early_z)
@@ -433,50 +411,21 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
out.Write("float4 colors_1 = colors_12;\n");
// compute window position if needed because binding semantic WPOS is not widely supported
// Let's set up attributes
- if (xfregs.numTexGen.numTexGens < 7)
+ if(numTexgen)
+ for (int i = 0; i < 8; ++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)
{
- if(numTexgen)
- for (int i = 0; i < 8; ++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)
- {
- out.Write("float4 Normal = Normal_2;\n");
- }
- }
- else
- {
- // wpos is in w of first 4 texcoords
- if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
- {
- for (int i = 0; i < 8; ++i)
- {
- out.Write("float4 uv%d = uv%d_2;\n", i, i);
- }
- }
- else
- {
- for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i)
- {
- out.Write("float%d uv%d = uv%d_2;\n", i < 4 ? 4 : 3 , i, i);
- }
- }
+ out.Write("float4 Normal = Normal_2;\n");
}
}
if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting)
{
- if (xfregs.numTexGen.numTexGens < 7)
- {
- out.Write("\tfloat3 _norm0 = normalize(Normal.xyz);\n\n");
- out.Write("\tfloat3 pos = float3(clipPos.x,clipPos.y,Normal.w);\n");
- }
- else
- {
- out.Write("\tfloat3 _norm0 = normalize(float3(uv4.w,uv5.w,uv6.w));\n\n");
- out.Write("\tfloat3 pos = float3(uv0.w,uv1.w,uv7.w);\n");
- }
+ out.Write("\tfloat3 _norm0 = normalize(Normal.xyz);\n\n");
+ out.Write("\tfloat3 pos = float3(clipPos.x,clipPos.y,Normal.w);\n");
out.Write("\tfloat4 mat, lacc;\n"
"\tfloat3 ldir, h;\n"
@@ -488,10 +437,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
GenerateLightingShader<T>(out, uid_data.lighting, components, I_PMATERIALS, I_PLIGHTS, "colors_", "colors_");
}
- if (numTexgen < 7)
- out.Write("\tclipPos = float4(rawpos.x, rawpos.y, clipPos.z, clipPos.w);\n");
- else
- out.Write("\tclipPos = float4(rawpos.x, rawpos.y, uv2.w, uv3.w);\n");
+ out.Write("\tclipPos = float4(rawpos.x, rawpos.y, clipPos.z, clipPos.w);\n");
// HACK to handle cases where the tex gen is not enabled
if (numTexgen == 0)