From efb97598629b96378edd783af82936185d8a99ce Mon Sep 17 00:00:00 2001 From: Stenzek Date: Tue, 21 Nov 2017 18:54:11 +1000 Subject: 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. --- Source/Core/VideoCommon/UberShaderVertex.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Source/Core/VideoCommon/UberShaderVertex.cpp') diff --git a/Source/Core/VideoCommon/UberShaderVertex.cpp b/Source/Core/VideoCommon/UberShaderVertex.cpp index ebc9c80f0e..bf24f6afda 100644 --- a/Source/Core/VideoCommon/UberShaderVertex.cpp +++ b/Source/Core/VideoCommon/UberShaderVertex.cpp @@ -171,6 +171,19 @@ ShaderCode GenVertexShader(APIType ApiType, const ShaderHostConfig& host_config, if (numTexgen > 0) GenVertexShaderTexGens(ApiType, numTexgen, out); + out.Write("if (xfmem_numColorChans == 0u) {\n"); + out.Write(" if ((components & %uu) != 0u)\n", VB_HAS_COL0); + out.Write(" o.colors_0 = rawcolor0;\n"); + out.Write(" else\n"); + out.Write(" o.colors_1 = float4(1.0, 1.0, 1.0, 1.0);\n"); + out.Write("}\n"); + out.Write("if (xfmem_numColorChans < 2u) {\n"); + out.Write(" if ((components & %uu) != 0u)\n", VB_HAS_COL1); + out.Write(" o.colors_0 = rawcolor1;\n"); + out.Write(" else\n"); + out.Write(" o.colors_1 = float4(1.0, 1.0, 1.0, 1.0);\n"); + out.Write("}\n"); + // clipPos/w needs to be done in pixel shader, not here out.Write("o.clipPos = o.pos;\n"); -- cgit v1.2.3