VideoCommon: Fix color channel logic when per-pixel lighting is in use

This was broken in #10012 (specifically by 06579e4d53 and c3dec34391).
This commit is contained in:
Pokechu22
2021-10-13 20:43:32 -07:00
parent 023eb0b702
commit a372a5947b
4 changed files with 44 additions and 52 deletions

View File

@ -787,6 +787,10 @@ ShaderCode GeneratePixelShaderCode(APIType api_type, const ShaderHostConfig& hos
// out.SetConstantsUsed(C_PLIGHTS, C_PLIGHTS+31); // TODO: Can be optimized further
// out.SetConstantsUsed(C_PMATERIALS, C_PMATERIALS+3);
GenerateLightingShaderCode(out, uid_data->lighting, "colors_", "col");
// The number of colors available to TEV is determined by numColorChans.
// Normally this is performed in the vertex shader after lighting, but with per-pixel lighting,
// we need to perform it here. (It needs to be done after lighting, as what was originally
// black might become a different color after lighting).
if (uid_data->numColorChans == 0)
out.Write("col0 = float4(0.0, 0.0, 0.0, 0.0);\n");
if (uid_data->numColorChans <= 1)