summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/UberShaderCommon.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2020-11-21 02:55:50 +0100
committerGitHub <noreply@github.com>2020-11-21 02:55:50 +0100
commit608dd6a37b1f0208340063b5ffe34193eea7ebc3 (patch)
treef271cab8f4c9b0a80a58fcd7118f668898a009e1 /Source/Core/VideoCommon/UberShaderCommon.cpp
parentfa73b1a23f9b0c5104909de410f9ae533cbf8af4 (diff)
parentd6ce8eef36f5b0bfd0078c51701b052cc9a77005 (diff)
Merge pull request #9122 from Pokechu22/pr-4601-test
Fix Super Mario Sunshine debug cubes (originally PR #4601 by stenzek)
Diffstat (limited to 'Source/Core/VideoCommon/UberShaderCommon.cpp')
-rw-r--r--Source/Core/VideoCommon/UberShaderCommon.cpp35
1 files changed, 8 insertions, 27 deletions
diff --git a/Source/Core/VideoCommon/UberShaderCommon.cpp b/Source/Core/VideoCommon/UberShaderCommon.cpp
index afd86a6943..36403d3f5b 100644
--- a/Source/Core/VideoCommon/UberShaderCommon.cpp
+++ b/Source/Core/VideoCommon/UberShaderCommon.cpp
@@ -103,42 +103,23 @@ void WriteVertexLighting(ShaderCode& out, APIType api_type, std::string_view wor
" int4 lacc = int4(255, 255, 255, 255);\n"
"\n");
- out.Write(" if ({} != 0u) {{\n", BitfieldExtract("colorreg", LitChannel().matsource));
- out.Write(" if ((components & ({}u << chan)) != 0u) // VB_HAS_COL0\n", VB_HAS_COL0);
- out.Write(" mat.xyz = int3(round(((chan == 0u) ? {}.xyz : {}.xyz) * 255.0));\n",
+ out.Write(" if ({} != 0u)\n", BitfieldExtract("colorreg", LitChannel().matsource));
+ out.Write(" mat.xyz = int3(round(((chan == 0u) ? {}.xyz : {}.xyz) * 255.0));\n",
in_color_0_var, in_color_1_var);
- out.Write(" else if ((components & {}u) != 0u) // VB_HAS_COLO0\n", VB_HAS_COL0);
- out.Write(" mat.xyz = int3(round({}.xyz * 255.0));\n", in_color_0_var);
- out.Write(" else\n"
- " mat.xyz = int3(255, 255, 255);\n"
- " }}\n"
- "\n");
- out.Write(" if ({} != 0u) {{\n", BitfieldExtract("alphareg", LitChannel().matsource));
- out.Write(" if ((components & ({}u << chan)) != 0u) // VB_HAS_COL0\n", VB_HAS_COL0);
- out.Write(" mat.w = int(round(((chan == 0u) ? {}.w : {}.w) * 255.0));\n", in_color_0_var,
+ out.Write(" if ({} != 0u)\n", BitfieldExtract("alphareg", LitChannel().matsource));
+ out.Write(" mat.w = int(round(((chan == 0u) ? {}.w : {}.w) * 255.0));\n", in_color_0_var,
in_color_1_var);
- out.Write(" else if ((components & {}u) != 0u) // VB_HAS_COLO0\n", VB_HAS_COL0);
- out.Write(" mat.w = int(round({}.w * 255.0));\n", in_color_0_var);
- out.Write(" else\n"
- " mat.w = 255;\n"
- " }} else {{\n"
+ out.Write(" else\n"
" mat.w = " I_MATERIALS " [chan + 2u].w;\n"
- " }}\n"
"\n");
out.Write(" if ({} != 0u) {{\n", BitfieldExtract("colorreg", LitChannel().enablelighting));
- out.Write(" if ({} != 0u) {{\n", BitfieldExtract("colorreg", LitChannel().ambsource));
- out.Write(" if ((components & ({}u << chan)) != 0u) // VB_HAS_COL0\n", VB_HAS_COL0);
- out.Write(" lacc.xyz = int3(round(((chan == 0u) ? {}.xyz : {}.xyz) * 255.0));\n",
+ out.Write(" if ({} != 0u)\n", BitfieldExtract("colorreg", LitChannel().ambsource));
+ out.Write(" lacc.xyz = int3(round(((chan == 0u) ? {}.xyz : {}.xyz) * 255.0));\n",
in_color_0_var, in_color_1_var);
- out.Write(" else if ((components & {}u) != 0u) // VB_HAS_COLO0\n", VB_HAS_COL0);
- out.Write(" lacc.xyz = int3(round({}.xyz * 255.0));\n", in_color_0_var);
- out.Write(" else\n"
- " lacc.xyz = int3(255, 255, 255);\n"
- " }} else {{\n"
+ out.Write(" else\n"
" lacc.xyz = " I_MATERIALS " [chan].xyz;\n"
- " }}\n"
"\n");
out.Write(" uint light_mask = {} | ({} << 4u);\n",
BitfieldExtract("colorreg", LitChannel().lightMask0_3),