st/mesa: don't set vs.key.clamp_color if a shader doesn't write any colors
authorMarek Olšák <marek.olsak@amd.com>
Sun, 11 Jan 2015 17:38:03 +0000 (18:38 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 19 Jan 2015 19:15:27 +0000 (20:15 +0100)
And update some comments.

src/mesa/state_tracker/st_atom_shader.c
src/mesa/state_tracker/st_glsl_to_tgsi.cpp
src/mesa/state_tracker/st_mesa_to_tgsi.c

index 6515a98a3fbca10b6bc95855d7bf6581c36de630..73768ed12372e3c5c960a47b5f6256a99a3e8ad6 100644 (file)
@@ -149,7 +149,12 @@ update_vp( struct st_context *st )
    key.passthrough_edgeflags = st->vertdata_edgeflags;
 
    key.clamp_color = st->clamp_vert_color_in_shader &&
-                     st->ctx->Light._ClampVertexColor;
+                     st->ctx->Light._ClampVertexColor &&
+                     (stvp->Base.Base.OutputsWritten &
+                      (VARYING_SLOT_COL0 |
+                       VARYING_SLOT_COL1 |
+                       VARYING_SLOT_BFC0 |
+                       VARYING_SLOT_BFC1));
 
    st->vp_variant = st_get_vp_variant(st, stvp, &key);
 
index c3d779337064fbca6cba60b5c67b735b81267673..98ab2c149f55e9d8c6ddf029ba2a7c7fa9a17114 100644 (file)
@@ -4412,8 +4412,8 @@ translate_dst(struct st_translate *t,
       /* Clamp colors for ARB_color_buffer_float. */
       switch (t->procType) {
       case TGSI_PROCESSOR_VERTEX:
-         /* XXX if the geometry shader is present, this must be done there
-          * instead of here. */
+         /* This can only occur with a compatibility profile, which doesn't
+          * support geometry shaders. */
          if (dst_reg->index == VARYING_SLOT_COL0 ||
              dst_reg->index == VARYING_SLOT_COL1 ||
              dst_reg->index == VARYING_SLOT_BFC0 ||
index 2c9d9a523f40afd6cb4d4a316576778fec4a14f3..3dd8a14b65711752012f684381683c0bb30661e0 100644 (file)
@@ -299,8 +299,8 @@ translate_dst( struct st_translate *t,
       /* Clamp colors for ARB_color_buffer_float. */
       switch (t->procType) {
       case TGSI_PROCESSOR_VERTEX:
-         /* XXX if the geometry shader is present, this must be done there
-          * instead of here. */
+         /* This can only occur with a compatibility profile, which doesn't
+          * support geometry shaders. */
          if (DstReg->Index == VARYING_SLOT_COL0 ||
              DstReg->Index == VARYING_SLOT_COL1 ||
              DstReg->Index == VARYING_SLOT_BFC0 ||