mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
LightingShaderGen: Always calculate lighting for both color channels
Cel-damage uses the color from the lighting stage of the vertex pipeline as texture coordinates, but sets numColorChans to zero. We now calculate the colors in all cases, but override the color before writing it from the vertex shader if numColorChans is set to a lower value.
This commit is contained in:
@ -239,24 +239,8 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const ShaderHostConfig& ho
|
||||
"float3 ldir, h, cosAttn, distAttn;\n"
|
||||
"float dist, dist2, attn;\n");
|
||||
|
||||
if (uid_data->numColorChans == 0)
|
||||
{
|
||||
if (uid_data->components & VB_HAS_COL0)
|
||||
out.Write("o.colors_0 = rawcolor0;\n");
|
||||
else
|
||||
out.Write("o.colors_0 = float4(1.0, 1.0, 1.0, 1.0);\n");
|
||||
}
|
||||
|
||||
GenerateLightingShaderCode(out, uid_data->lighting, uid_data->components, uid_data->numColorChans,
|
||||
"rawcolor", "o.colors_");
|
||||
|
||||
if (uid_data->numColorChans < 2)
|
||||
{
|
||||
if (uid_data->components & VB_HAS_COL1)
|
||||
out.Write("o.colors_1 = rawcolor1;\n");
|
||||
else
|
||||
out.Write("o.colors_1 = o.colors_0;\n");
|
||||
}
|
||||
GenerateLightingShaderCode(out, uid_data->lighting, uid_data->components, "rawcolor",
|
||||
"o.colors_");
|
||||
|
||||
// transform texcoords
|
||||
out.Write("float4 coord = float4(0.0, 0.0, 1.0, 1.0);\n");
|
||||
@ -398,6 +382,21 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const ShaderHostConfig& ho
|
||||
out.Write("}\n");
|
||||
}
|
||||
|
||||
if (uid_data->numColorChans == 0)
|
||||
{
|
||||
if (uid_data->components & VB_HAS_COL0)
|
||||
out.Write("o.colors_0 = rawcolor0;\n");
|
||||
else
|
||||
out.Write("o.colors_0 = float4(1.0, 1.0, 1.0, 1.0);\n");
|
||||
}
|
||||
if (uid_data->numColorChans < 2)
|
||||
{
|
||||
if (uid_data->components & VB_HAS_COL1)
|
||||
out.Write("o.colors_1 = rawcolor1;\n");
|
||||
else
|
||||
out.Write("o.colors_1 = o.colors_0;\n");
|
||||
}
|
||||
|
||||
// clipPos/w needs to be done in pixel shader, not here
|
||||
out.Write("o.clipPos = o.pos;\n");
|
||||
|
||||
|
Reference in New Issue
Block a user