added div by zero check for Fog.End/Start (from gallium-0.1)
authorBrian Paul <brian.paul@tungstengraphics.com>
Sun, 18 May 2008 21:41:36 +0000 (15:41 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Sun, 18 May 2008 21:41:36 +0000 (15:41 -0600)
src/mesa/shader/prog_statevars.c

index 4ae74c1d42b0aa8869ef2c397d44c306a583235d..72bdad7654599e4e1a98a7e31bef0d3eacaa2287 100644 (file)
@@ -253,7 +253,8 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
       value[0] = ctx->Fog.Density;
       value[1] = ctx->Fog.Start;
       value[2] = ctx->Fog.End;
-      value[3] = 1.0F / (ctx->Fog.End - ctx->Fog.Start);
+      value[3] = (ctx->Fog.End == ctx->Fog.Start)
+         ? 1.0 : 1.0F / (ctx->Fog.End - ctx->Fog.Start);
       return;
    case STATE_CLIPPLANE:
       {