From dae1226e1b1954b3e1b7fc6b386a74b301e43890 Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 7 Feb 2013 02:21:30 +0100 Subject: [PATCH] workaround for division by zero on fog calculation --- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index b3930c991c..d7017a7e0a 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -1322,6 +1322,8 @@ static void WriteFog(char *&p) // perspective // ze = A/(B - (Zs >> B_SHF) WRITE (p, "\tfloat ze = " I_FOG"[1].x / (" I_FOG"[1].y - (zCoord / " I_FOG"[1].w));\n"); + WRITE (p, "\tif(isnan(ze))\n"); // TODO: on intel/mesa, here will be a division by zero + WRITE (p, "\t\tze = 0.0f;\n"); } else {