diff options
| author | Stenzek <stenzek@gmail.com> | 2017-11-21 18:54:11 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2017-11-22 01:52:18 +1000 |
| commit | efb97598629b96378edd783af82936185d8a99ce (patch) | |
| tree | 6be0e38fd495292ee5f5d63471732164254cccac /Source/Core/VideoCommon/UberShaderCommon.cpp | |
| parent | 18c1bf19cac3b4299c55db35117f1383a5c80318 (diff) | |
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.
Diffstat (limited to 'Source/Core/VideoCommon/UberShaderCommon.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/UberShaderCommon.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/UberShaderCommon.cpp b/Source/Core/VideoCommon/UberShaderCommon.cpp index 58e33e5942..645712fd4f 100644 --- a/Source/Core/VideoCommon/UberShaderCommon.cpp +++ b/Source/Core/VideoCommon/UberShaderCommon.cpp @@ -94,8 +94,8 @@ void WriteVertexLighting(ShaderCode& out, APIType api_type, const char* world_po const char* out_color_1_var) { out.Write("// Lighting\n"); - out.Write("%sfor (uint chan = 0u; chan < xfmem_numColorChans; chan++) {\n", - api_type == APIType::D3D ? "[loop] " : ""); + out.Write("%sfor (uint chan = 0u; chan < %zu; chan++) {\n", + api_type == APIType::D3D ? "[loop] " : "", NUM_XF_COLOR_CHANNELS); out.Write(" uint colorreg = xfmem_color(chan);\n" " uint alphareg = xfmem_alpha(chan);\n" " int4 mat = " I_MATERIALS "[chan + 2u]; \n" @@ -196,8 +196,5 @@ void WriteVertexLighting(ShaderCode& out, APIType api_type, const char* world_po out.Write(" }\n" "}\n" "\n"); - - out.Write("if (xfmem_numColorChans < 2u && (components & %uu) == 0u)\n", VB_HAS_COL1); - out.Write(" %s = %s;\n\n", out_color_1_var, out_color_0_var); } } |
