mesa: Care for differences in fog mode only if fog is consumed.
authorMathias Fröhlich <mathias.froehlich@web.de>
Sat, 27 Jan 2018 19:09:00 +0000 (12:09 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 30 Jan 2018 16:07:59 +0000 (09:07 -0700)
In creating fixed function vertex shader hash keys do only
care for producing the varying output if fog is enabled and the
varing is consumed in the fragment stage.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/main/ffvertex_prog.c

index 172ab698dbd5aded3a893cfded8fe9ed1e2cf6ad..6d852496e02de7fe0db253fbf759503a309e3205 100644 (file)
@@ -222,9 +222,11 @@ static void make_state_key( struct gl_context *ctx, struct state_key *key )
    if (ctx->Transform.RescaleNormals)
       key->rescale_normals = 1;
 
-   key->fog_distance_mode =
-      translate_fog_distance_mode(ctx->Fog.FogCoordinateSource,
-                                  ctx->Fog.FogDistanceMode);
+   /* Only distinguish fog parameters if we actually need */
+   if (key->fragprog_inputs_read & VARYING_BIT_FOGC)
+      key->fog_distance_mode =
+         translate_fog_distance_mode(ctx->Fog.FogCoordinateSource,
+                                     ctx->Fog.FogDistanceMode);
 
    if (ctx->Point._Attenuated)
       key->point_attenuated = 1;