summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2015-12-19 02:33:25 +0100
committerRoland Scheidegger <[email protected]>2016-01-07 01:56:43 +0100
commitb64d008052a0111e3170169c4bed08693d94b220 (patch)
tree5f35baef01510a8f804629169bdd1addcaaa66ae /src/gallium/drivers
parent01761a38e8f49b528facf9853c27bbc8891a4424 (diff)
softpipe: fix mapping of "special" vs outputs
Unlike llvmpipe, softpipe always tells draw to emit the vertices as-is. The two vertex layouts it calculates are a bit confusing, one which is just used to tell draw to emit vertices as-is, and the other which has draw written all over it but draw is completely unaware of and is used only to look up the correct interpolation info later in setup. Thus, the slots used are different to what llvmpipe does (I'm going to clean up the confusing two layout stuff). Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/softpipe/sp_state_derived.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c
index 7e998af1325..56ecc3b6140 100644
--- a/src/gallium/drivers/softpipe/sp_state_derived.c
+++ b/src/gallium/drivers/softpipe/sp_state_derived.c
@@ -79,10 +79,14 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
*/
vinfo_vbuf->num_attribs = 0;
for (i = 0; i < num; i++) {
- draw_emit_vertex_attr(vinfo_vbuf, EMIT_4F, INTERP_PERSPECTIVE, i);
+ draw_emit_vertex_attr(vinfo_vbuf, EMIT_4F, INTERP_PERSPECTIVE, i);
}
draw_compute_vertex_size(vinfo_vbuf);
+ softpipe->viewport_index_slot = 0;
+ softpipe->layer_slot = 0;
+ softpipe->psize_slot = 0;
+
/*
* Loop over fragment shader inputs, searching for the matching output
* from the vertex shader.
@@ -128,10 +132,15 @@ 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 == -1)
- /* try and find a bcolor */
- src = draw_find_shader_output(softpipe->draw,
- TGSI_SEMANTIC_BCOLOR, fsInfo->input_semantic_index[i]);
+ if (fsInfo->input_semantic_name[i] == TGSI_SEMANTIC_COLOR && src == -1)
+ /*
+ * try and find a bcolor.
+ * Note that if there's both front and back color, draw will
+ * have copied back to front color already.
+ */
+ src = draw_find_shader_output(softpipe->draw,
+ TGSI_SEMANTIC_BCOLOR,
+ fsInfo->input_semantic_index[i]);
draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src);
}
@@ -141,7 +150,7 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
TGSI_SEMANTIC_PSIZE, 0);
if (vs_index >= 0) {
- softpipe->psize_slot = vinfo->num_attribs;
+ softpipe->psize_slot = vs_index;
draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, vs_index);
}
@@ -150,10 +159,8 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
TGSI_SEMANTIC_VIEWPORT_INDEX,
0);
if (vs_index >= 0) {
- softpipe->viewport_index_slot = vinfo->num_attribs;
+ softpipe->viewport_index_slot = vs_index;
draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, vs_index);
- } else {
- softpipe->viewport_index_slot = 0;
}
/* Figure out if we need layer */
@@ -161,10 +168,8 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
TGSI_SEMANTIC_LAYER,
0);
if (vs_index >= 0) {
- softpipe->layer_slot = vinfo->num_attribs;
+ softpipe->layer_slot = vs_index;
draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, vs_index);
- } else {
- softpipe->layer_slot = 0;
}
draw_compute_vertex_size(vinfo);