From f49f7c6371ecd8a5b2ff1891f38d82ca6fc63f80 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 6 Jan 2023 17:25:04 -0800 Subject: [PATCH] D3D9: Force branch usage for fog compute. When using `[flatten]`/default, it picks the wrong value, seemingly always taking the else case (even if the condition is changed or reversed.) --- GPU/Common/VertexShaderGenerator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GPU/Common/VertexShaderGenerator.cpp b/GPU/Common/VertexShaderGenerator.cpp index 943108841f..a25fdfb743 100644 --- a/GPU/Common/VertexShaderGenerator.cpp +++ b/GPU/Common/VertexShaderGenerator.cpp @@ -1283,7 +1283,9 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag } } - // Compute fogdepth + // Compute fogdepth. [branch] works around an apparent d3d9 shader compiler bug. + if (compat.shaderLanguage == HLSL_D3D9) + WRITE(p, " [branch]\n"); WRITE(p, " if (u_fogcoef.x <= -65535.0 && u_fogcoef.y <= -65535.0) {\n"); WRITE(p, " %sv_fogdepth = 1.0;\n", compat.vsOutPrefix); WRITE(p, " } else {\n");