diff options
| author | Scott Mansell <phiren@gmail.com> | 2015-01-03 01:44:04 +1300 |
|---|---|---|
| committer | Scott Mansell <phiren@gmail.com> | 2015-01-03 09:23:09 +1300 |
| commit | 1b771deb56ff0c7add39c7c93eeb322f3e384435 (patch) | |
| tree | e376c7d4af40ae3714c60add923af143bd187838 /Source/Core/VideoCommon/PixelShaderGen.cpp | |
| parent | 9c6795c7b74c8aa6c852a2855ab54315d34f8613 (diff) | |
Move worldpos into it's own varying.
Previously it was packed into spare slots in clippos.xy and normal.w,
but it's ugly and more importantly it's causing bugs.
This was discovered during the debugging of a zfreeze branch, which
expected clippos.xy to be xy position coordinates in clipspace (as
the name suggested).
Turns out the stereoscopy shader had also run into this trap, modifying
clippos.x (introducing errors with per-pixel lighting).
This commit has been moved outside of the zfreeze PR for fast merging.
Diffstat (limited to 'Source/Core/VideoCommon/PixelShaderGen.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/PixelShaderGen.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index 77ccd0b683..1d57a1edf6 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -342,7 +342,8 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T out.Write("centroid in float4 clipPos;\n"); if (g_ActiveConfig.bEnablePixelLighting) { - out.Write("centroid in float4 Normal;\n"); + out.Write("centroid in float3 Normal;\n"); + out.Write("centroid in float3 WorldPos;\n"); } } @@ -371,7 +372,10 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T out.Write(",\n in centroid float3 uv%d : TEXCOORD%d", i, i); out.Write(",\n in centroid float4 clipPos : TEXCOORD%d", numTexgen); if (g_ActiveConfig.bEnablePixelLighting) - out.Write(",\n in centroid float4 Normal : TEXCOORD%d", numTexgen + 1); + { + out.Write(",\n in centroid float3 Normal : TEXCOORD%d", numTexgen + 1); + out.Write(",\n in centroid float3 WorldPos : TEXCOORD%d", numTexgen + 2); + } uid_data->stereo = g_ActiveConfig.iStereoMode > 0; if (g_ActiveConfig.iStereoMode > 0) out.Write(",\n in uint layer : SV_RenderTargetArrayIndex\n"); @@ -389,7 +393,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T if (g_ActiveConfig.bEnablePixelLighting) { out.Write("\tfloat3 _norm0 = normalize(Normal.xyz);\n\n"); - out.Write("\tfloat3 pos = float3(clipPos.x,clipPos.y,Normal.w);\n"); + out.Write("\tfloat3 pos = WorldPos;\n"); out.Write("\tint4 lacc;\n" "\tfloat3 ldir, h;\n" |
