summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexShaderGen.cpp
diff options
context:
space:
mode:
authorAnthony <Helios747@users.noreply.github.com>2017-11-21 20:17:18 -0800
committerGitHub <noreply@github.com>2017-11-21 20:17:18 -0800
commit066471be076994ea8538d13e8d6979609193a2de (patch)
tree6be0e38fd495292ee5f5d63471732164254cccac /Source/Core/VideoCommon/VertexShaderGen.cpp
parentf2f50d4fe5e0f97d36d6d132f40516ad6174601f (diff)
parentefb97598629b96378edd783af82936185d8a99ce (diff)
Merge pull request #4601 from stenzek/celdamage-lighting
ShaderGen: Always calculate lighting for both color channels
Diffstat (limited to 'Source/Core/VideoCommon/VertexShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexShaderGen.cpp35
1 files changed, 17 insertions, 18 deletions
diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp
index a02f801896..d6f65b12b4 100644
--- a/Source/Core/VideoCommon/VertexShaderGen.cpp
+++ b/Source/Core/VideoCommon/VertexShaderGen.cpp
@@ -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");