mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 05:40:01 -06: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:
@ -92,7 +92,10 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
|
||||
}
|
||||
out.Write("centroid out float4 clipPos;\n");
|
||||
if (g_ActiveConfig.bEnablePixelLighting)
|
||||
out.Write("centroid out float4 Normal;\n");
|
||||
{
|
||||
out.Write("centroid out float3 Normal;\n");
|
||||
out.Write("centroid out float3 WorldPos;\n");
|
||||
}
|
||||
out.Write("centroid out float4 colors_0;\n");
|
||||
out.Write("centroid out float4 colors_1;\n");
|
||||
}
|
||||
@ -337,11 +340,12 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
|
||||
}
|
||||
|
||||
// clipPos/w needs to be done in pixel shader, not here
|
||||
out.Write("o.clipPos = float4(pos.x,pos.y,o.pos.z,o.pos.w);\n");
|
||||
out.Write("o.clipPos = o.pos;\n");
|
||||
|
||||
if (g_ActiveConfig.bEnablePixelLighting)
|
||||
{
|
||||
out.Write("o.Normal = float4(_norm0.x,_norm0.y,_norm0.z,pos.z);\n");
|
||||
out.Write("o.Normal = _norm0;\n");
|
||||
out.Write("o.WorldPos = pos.xyz;\n");
|
||||
|
||||
if (components & VB_HAS_COL0)
|
||||
out.Write("o.colors_0 = color0;\n");
|
||||
@ -395,7 +399,10 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
|
||||
out.Write("uv%d.xyz = o.tex%d;\n", i, i);
|
||||
out.Write("clipPos = o.clipPos;\n");
|
||||
if (g_ActiveConfig.bEnablePixelLighting)
|
||||
{
|
||||
out.Write("Normal = o.Normal;\n");
|
||||
out.Write("WorldPos = o.WorldPos;\n");
|
||||
}
|
||||
out.Write("colors_0 = o.colors_0;\n");
|
||||
out.Write("colors_1 = o.colors_1;\n");
|
||||
}
|
||||
|
Reference in New Issue
Block a user