From 0e0da8c8fd165b9fbd704ad7846ad4a000e3ae55 Mon Sep 17 00:00:00 2001 From: degasus Date: Sun, 30 Mar 2014 12:19:15 +0200 Subject: [PATCH] ShaderGen: make clipPos readonly --- Source/Core/VideoCommon/PixelShaderGen.cpp | 7 ++----- Source/Core/VideoCommon/VertexShaderGen.cpp | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index 7f62056aeb..f92054d0cf 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -298,7 +298,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T { out.Write("centroid in float3 uv%d_2;\n", i); } - out.Write("centroid in float4 clipPos_2;\n"); + out.Write("centroid in float4 clipPos;\n"); if (g_ActiveConfig.bEnablePixelLighting) { out.Write("centroid in float4 Normal_2;\n"); @@ -349,7 +349,6 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T out.Write("\tfloat3 uv%d = uv%d_2;\n", i, i); } } - out.Write("\tfloat4 clipPos = clipPos_2;\n"); if (g_ActiveConfig.bEnablePixelLighting) { out.Write("\tfloat4 Normal = Normal_2;\n"); @@ -372,8 +371,6 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T GenerateLightingShader(out, uid_data.lighting, components, I_PMATERIALS, I_PLIGHT_COLORS, I_PLIGHTS, "colors_", "colors_"); } - 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) { @@ -1018,7 +1015,7 @@ static inline void WriteFog(T& out, pixel_shader_uid_data& uid_data) if (bpmem.fogRange.Base.Enabled) { out.SetConstantsUsed(C_FOGF, C_FOGF); - out.Write("\tfloat x_adjust = (2.0 * (clipPos.x / " I_FOGF"[0].y)) - 1.0 - " I_FOGF"[0].x;\n"); + out.Write("\tfloat x_adjust = (2.0 * (rawpos.x / " I_FOGF"[0].y)) - 1.0 - " I_FOGF"[0].x;\n"); out.Write("\tx_adjust = sqrt(x_adjust * x_adjust + " I_FOGF"[0].z * " I_FOGF"[0].z) / " I_FOGF"[0].z;\n"); out.Write("\tze *= x_adjust;\n"); } diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp index 32bd8ae9fb..2a98502091 100644 --- a/Source/Core/VideoCommon/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/VertexShaderGen.cpp @@ -137,7 +137,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ out.Write("centroid out float3 uv%d_2;\n", i); } } - out.Write("centroid out float4 clipPos_2;\n"); + out.Write("centroid out float4 clipPos;\n"); if (g_ActiveConfig.bEnablePixelLighting) out.Write("centroid out float4 Normal_2;\n"); @@ -434,7 +434,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i) out.Write(" uv%d_2.xyz = o.tex%d;\n", i, i); - out.Write(" clipPos_2 = o.clipPos;\n"); + out.Write(" clipPos = o.clipPos;\n"); if (g_ActiveConfig.bEnablePixelLighting) out.Write(" Normal_2 = o.Normal;\n");