From 8ab57474a04fd22555c1cb53db1fc10759723510 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 27 Feb 2022 15:06:50 -0800 Subject: [PATCH] Down this route lies madness --- Source/Core/VideoCommon/LightingShaderGen.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Core/VideoCommon/LightingShaderGen.cpp b/Source/Core/VideoCommon/LightingShaderGen.cpp index 906907bb04..a3aa628071 100644 --- a/Source/Core/VideoCommon/LightingShaderGen.cpp +++ b/Source/Core/VideoCommon/LightingShaderGen.cpp @@ -49,7 +49,9 @@ static void GenerateLightShader(ShaderCode& object, const LightingUidData& uid_d " cosine = max(0.0, dot(_normal, " LIGHT_DIR ".xyz));\n", LIGHT_DIR_PARAMS(index)); object.Write(" }}\n" - " // Specular lights use the angle for the denominator as well\n" + " ldir = " LIGHT_DIR ".xyz;\n", + LIGHT_DIR_PARAMS(index)); + object.Write(" // Specular lights use the angle for the denominator as well\n" " dist = cosine;\n" " dist2 = dist * dist;\n"); break; @@ -99,6 +101,9 @@ static void GenerateLightShader(ShaderCode& object, const LightingUidData& uid_d break; } + if (attn_func == AttenuationFunc::Spec && diffuse_func != DiffuseFunc::None) + object.Write(" diffuse *= (2048.0 + 1024.0);\n"); + object.Write(" lacc.{} += int{}(round(attn * diffuse * float{}(" LIGHT_COL ")));\n", swizzle, swizzle_components, swizzle_components, LIGHT_COL_PARAMS(index, swizzle)); object.Write(" }}\n");