mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-28 19:58:53 +00:00
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.
This commit is contained in:
parent
9c6795c7b7
commit
1b771deb56
4 changed files with 24 additions and 8 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue