ShaderGen: make clipPos readonly

This commit is contained in:
degasus 2014-03-30 12:19:15 +02:00
parent c80717ac2e
commit 0e0da8c8fd
2 changed files with 4 additions and 7 deletions

View File

@ -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<T>(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");
}

View File

@ -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");