i965: Fix gl_DrawID in the vec4 backend.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 13 Feb 2016 05:24:58 +0000 (21:24 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Sun, 14 Feb 2016 21:24:07 +0000 (13:24 -0800)
brw_draw_upload.c uploads VertexID/InstanceID first, then DrawID.
So we need to assign the attribute mapping in that order as well.

Fixes the following Pigit tests with the vec4 backend:
- arb_shader_draw_parameters-drawid vertexid
- arb_shader_draw_parameters-drawid-indirect basevertex

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
src/mesa/drivers/dri/i965/brw_vec4.cpp

index 807ff60b92d6e0257b823c18159ff816dfb8081d..e6c580eb89948bdda81c81ec7d78b65982cd83d4 100644 (file)
@@ -1561,11 +1561,6 @@ vec4_vs_visitor::setup_attributes(int payload_reg)
       }
    }
 
-   if (vs_prog_data->uses_drawid) {
-      attribute_map[VERT_ATTRIB_MAX + 1] = payload_reg + nr_attributes;
-      nr_attributes++;
-   }
-
    /* VertexID is stored by the VF as the last vertex element, but we
     * don't represent it with a flag in inputs_read, so we call it
     * VERT_ATTRIB_MAX.
@@ -1576,6 +1571,11 @@ vec4_vs_visitor::setup_attributes(int payload_reg)
       nr_attributes++;
    }
 
+   if (vs_prog_data->uses_drawid) {
+      attribute_map[VERT_ATTRIB_MAX + 1] = payload_reg + nr_attributes;
+      nr_attributes++;
+   }
+
    lower_attributes_to_hw_regs(attribute_map, false /* interleaved */);
 
    return payload_reg + vs_prog_data->nr_attributes;