Skip to content
Snippets Groups Projects
Commit 3a1ab234 authored by Neil Roberts's avatar Neil Roberts Committed by Ben Widawsky
Browse files

i965/bdw: Fix 3DSTATE_VF_INSTANCING when the edge flag is used

When the edge flag element is enabled then the elements are slightly
reordered so that the edge flag is always the last one. This was
confusing the code to upload the 3DSTATE_VF_INSTANCING state because
that is uploaded with a separate loop which has an instruction for
each element. The indices used in these instructions weren't taking
into account the reordering so the state would be incorrect.

v2: Use nr_elements instead of brw->vb.nr_enabled so that it will cope
    when gl_VertexID is used.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91292


Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ben Widawsky's avatarBen Widawsky <ben@bwidawsk.net>
Signed-off-by: Ben Widawsky's avatarBen Widawsky <ben@bwidawsk.net>
Tested-by: default avatarMark Janes <mark.a.janes@intel.com>
parent fb02b4ec
No related merge requests found
......@@ -246,13 +246,24 @@ gen8_emit_vertices(struct brw_context *brw)
}
ADVANCE_BATCH();
for (unsigned i = 0; i < brw->vb.nr_enabled; i++) {
for (unsigned i = 0, j = 0; i < brw->vb.nr_enabled; i++) {
const struct brw_vertex_element *input = brw->vb.enabled[i];
const struct brw_vertex_buffer *buffer = &brw->vb.buffers[input->buffer];
unsigned element_index;
/* The edge flag element is reordered to be the last one in the code
* above so we need to compensate for that in the element indices used
* below.
*/
if (input == gen6_edgeflag_input)
element_index = nr_elements - 1;
else
element_index = j++;
BEGIN_BATCH(3);
OUT_BATCH(_3DSTATE_VF_INSTANCING << 16 | (3 - 2));
OUT_BATCH(i | (buffer->step_rate ? GEN8_VF_INSTANCING_ENABLE : 0));
OUT_BATCH(element_index |
(buffer->step_rate ? GEN8_VF_INSTANCING_ENABLE : 0));
OUT_BATCH(buffer->step_rate);
ADVANCE_BATCH();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment