From 5b01512df3328711968dea7240ae817721c79774 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 11 Jan 2015 18:38:03 +0100 Subject: st/mesa: don't set vs.key.clamp_color if a shader doesn't write any colors And update some comments. --- src/mesa/state_tracker/st_atom_shader.c | 7 ++++++- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 4 ++-- src/mesa/state_tracker/st_mesa_to_tgsi.c | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src/mesa/state_tracker') diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index 6515a98a3fb..73768ed1237 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -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); diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index c3d77933706..98ab2c149f5 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -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 || diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 2c9d9a523f4..3dd8a14b657 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -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 || -- cgit v1.2.3