Mesa (master): mesa: Care for differences in fog mode only if fog is consumed.

Brian Paul brianp at kemper.freedesktop.org
Tue Jan 30 16:11:23 UTC 2018


Module: Mesa
Branch: master
Commit: 06621e8a0df9ece4211e9d612b9199c9403e2290
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=06621e8a0df9ece4211e9d612b9199c9403e2290

Author: Mathias Fröhlich <mathias.froehlich at web.de>
Date:   Sat Jan 27 12:09:00 2018 -0700

mesa: Care for differences in fog mode only if fog is consumed.

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 at web.de>
Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/main/ffvertex_prog.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index 172ab698db..6d852496e0 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -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;




More information about the mesa-commit mailing list