summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/UberShaderVertex.cpp
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2022-04-13 22:03:34 -0700
committerPokechu22 <Pokechu022@gmail.com>2022-04-22 16:54:38 -0700
commit2a5c77f43ff1d69e78f12f13435a38c5eb2ed854 (patch)
tree5fe9bb681e4b8d4471f7efee278c96a24556b33b /Source/Core/VideoCommon/UberShaderVertex.cpp
parent39b2854b981aadec1576254ad5e4d91dc21c9709 (diff)
VideoCommon: Handle emboss texgen with only a single normal
Fixes a large number of effects in Rogue Squadron 2 and 3.
Diffstat (limited to 'Source/Core/VideoCommon/UberShaderVertex.cpp')
-rw-r--r--Source/Core/VideoCommon/UberShaderVertex.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/UberShaderVertex.cpp b/Source/Core/VideoCommon/UberShaderVertex.cpp
index 91568a4cec..c68c996b0a 100644
--- a/Source/Core/VideoCommon/UberShaderVertex.cpp
+++ b/Source/Core/VideoCommon/UberShaderVertex.cpp
@@ -169,12 +169,18 @@ ShaderCode GenVertexShader(APIType api_type, const ShaderHostConfig& host_config
"if ((components & {}u) != 0u) // VB_HAS_TANGENT\n",
VB_HAS_TANGENT);
out.Write(" _tangent = float3(dot(N0, rawtangent), dot(N1, rawtangent), dot(N2, rawtangent));\n"
+ "else\n"
+ " _tangent = float3(dot(N0, " I_CACHED_TANGENT ".xyz), dot(N1, " I_CACHED_TANGENT
+ ".xyz), dot(N2, " I_CACHED_TANGENT ".xyz));\n"
"\n"
"float3 _binormal = float3(0.0, 0.0, 0.0);\n"
"if ((components & {}u) != 0u) // VB_HAS_BINORMAL\n",
VB_HAS_BINORMAL);
out.Write(" _binormal = float3(dot(N0, rawbinormal), dot(N1, rawbinormal), dot(N2, "
"rawbinormal));\n"
+ "else\n"
+ " _binormal = float3(dot(N0, " I_CACHED_BINORMAL ".xyz), dot(N1, " I_CACHED_BINORMAL
+ ".xyz), dot(N2, " I_CACHED_BINORMAL ".xyz));\n"
"\n");
// Hardware Lighting
@@ -449,12 +455,9 @@ static void GenVertexShaderTexGens(APIType api_type, u32 num_texgen, ShaderCode&
for (u32 i = 0; i < num_texgen; i++)
out.Write(" case {}u: output_tex.xyz = o.tex{}; break;\n", i, i);
out.Write(" default: output_tex.xyz = float3(0.0, 0.0, 0.0); break;\n"
- " }}\n");
- out.Write(" if ((components & {}u) != 0u) {{ // VB_HAS_TANGENT | VB_HAS_BINORMAL\n",
- VB_HAS_TANGENT | VB_HAS_BINORMAL);
- out.Write(" float3 ldir = normalize(" I_LIGHTS "[light].pos.xyz - pos.xyz);\n"
- " output_tex.xyz += float3(dot(ldir, _tangent), dot(ldir, _binormal), 0.0);\n"
" }}\n"
+ " float3 ldir = normalize(" I_LIGHTS "[light].pos.xyz - pos.xyz);\n"
+ " output_tex.xyz += float3(dot(ldir, _tangent), dot(ldir, _binormal), 0.0);\n"
" }}\n"
" break;\n\n");
out.Write(" case {:s}:\n", TexGenType::Color0);