summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-12-19 15:54:03 +0000
committerDave Airlie <airlied@redhat.com>2011-12-22 12:25:33 +0000
commit7fd8dc3aa97271e3302667adc963f606c5b2e1e7 (patch)
treeaf7e60957672cf234f8737726094be1f12506f7e
parentd61d39922b06c234790d055761407eaf4333ccde (diff)
softpipe: try and use back color for a slot if color fails.
In the case where a front and back output are specified, the draw code will copy the back output into the front color slot and everything is happy. However if no front is specified then the draw code will do a bad copy (separate patch), but also the frag shader won't pick up the color as there there is no write to COLOR from the vertex shader just BCOLOR. This patch fixes that problem so if it can't find a vertex shader output for the front color slot, it will go and lookup and use one for the back color slot. Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--src/gallium/drivers/softpipe/sp_state_derived.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c
index f89d23c9f2..56859971d8 100644
--- a/src/gallium/drivers/softpipe/sp_state_derived.c
+++ b/src/gallium/drivers/softpipe/sp_state_derived.c
@@ -121,6 +121,11 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
src = draw_find_shader_output(softpipe->draw,
fsInfo->input_semantic_name[i],
fsInfo->input_semantic_index[i]);
+ if (fsInfo->input_semantic_name[i] == TGSI_SEMANTIC_COLOR && src == 0)
+ /* try and find a bcolor */
+ src = draw_find_shader_output(softpipe->draw,
+ TGSI_SEMANTIC_BCOLOR, fsInfo->input_semantic_index[i]);
+
draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src);
}