summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/PixelShaderGen.cpp
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2021-10-13 20:43:32 -0700
committerPokechu22 <Pokechu022@gmail.com>2021-10-13 20:43:32 -0700
commita372a5947b65166ca7bf9f41507191ba12bec253 (patch)
tree71c5e6c0941912a5c395f5ccd5eb03eec45ec06a /Source/Core/VideoCommon/PixelShaderGen.cpp
parent023eb0b7029eb3633ce9eeb039c11d835ea7fd74 (diff)
VideoCommon: Fix color channel logic when per-pixel lighting is in use
This was broken in #10012 (specifically by 06579e4d53844e5a45ae18f8eda6c4ee69ebad2c and c3dec343918ff44e90886daf71a6bf0c49033de1).
Diffstat (limited to 'Source/Core/VideoCommon/PixelShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/PixelShaderGen.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp
index 5f5b41e081..a380937ae2 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -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)