summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/UberShaderVertex.cpp
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2021-07-20 19:00:29 -0700
committerPokechu22 <Pokechu022@gmail.com>2021-07-24 22:20:35 -0700
commit3a4d8379bf16e61348dafc1750a8e4b65394f7a9 (patch)
tree02fe5ac7022b78e202c205a1b77f39de52275cc1 /Source/Core/VideoCommon/UberShaderVertex.cpp
parent55a465c6e6152656e3ca54be3c53e8072ccf5653 (diff)
Convert NaN to 1 when generating texture coordinates
This fixes eyelids in Shadow the Hedgehog during cutscenes (https://bugs.dolphin-emu.org/issues/11458)
Diffstat (limited to 'Source/Core/VideoCommon/UberShaderVertex.cpp')
-rw-r--r--Source/Core/VideoCommon/UberShaderVertex.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/UberShaderVertex.cpp b/Source/Core/VideoCommon/UberShaderVertex.cpp
index c5a20f033c..5b02b1f989 100644
--- a/Source/Core/VideoCommon/UberShaderVertex.cpp
+++ b/Source/Core/VideoCommon/UberShaderVertex.cpp
@@ -435,6 +435,13 @@ static void GenVertexShaderTexGens(APIType api_type, u32 num_texgen, ShaderCode&
out.Write(" coord.z = 1.0f;\n"
"\n");
+ // Convert NaNs to 1 - needed to fix eyelids in Shadow the Hedgehog during cutscenes
+ // See https://bugs.dolphin-emu.org/issues/11458
+ out.Write(" // Convert NaN to 1\n");
+ out.Write(" if (isnan(coord.x)) coord.x = 1.0;\n");
+ out.Write(" if (isnan(coord.y)) coord.y = 1.0;\n");
+ out.Write(" if (isnan(coord.z)) coord.z = 1.0;\n");
+
out.Write(" // first transformation\n");
out.Write(" uint texgentype = {};\n", BitfieldExtract<&TexMtxInfo::texgentype>("texMtxInfo"));
out.Write(" float3 output_tex;\n"