i965/draw: Account for BaseInstance in VBO bounds
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 18 May 2016 20:05:02 +0000 (13:05 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 24 May 2016 02:12:34 +0000 (19:12 -0700)
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_draw.c
src/mesa/drivers/dri/i965/brw_draw_upload.c

index c6fb8d277e1a948179ddbe432a56e409dba1a84e..76ed1de12a8e55fb0c1807e2ef5330aa923bca87 100644 (file)
@@ -1311,6 +1311,7 @@ struct brw_context
 
    uint32_t num_instances;
    int basevertex;
+   int baseinstance;
 
    struct {
       const struct brw_l3_config *config;
index 7901972111f5165d4f7410a3990fed2e9cc35971..fa3ff5fdfc202f78fde96d96d97c4b9efb069a88 100644 (file)
@@ -502,9 +502,11 @@ brw_try_draw_prims(struct gl_context *ctx,
       intel_batchbuffer_save_state(brw);
 
       if (brw->num_instances != prims[i].num_instances ||
-          brw->basevertex != prims[i].basevertex) {
+          brw->basevertex != prims[i].basevertex ||
+          brw->baseinstance != prims[i].base_instance) {
          brw->num_instances = prims[i].num_instances;
          brw->basevertex = prims[i].basevertex;
+         brw->baseinstance = prims[i].base_instance;
          if (i > 0) { /* For i == 0 we just did this before the loop */
             brw->ctx.NewDriverState |= BRW_NEW_VERTICES;
             brw_merge_inputs(brw, arrays);
index 725a65e10abd7814b2163e28d731eb30107e9558..6d9e65e9cfa9af8e063a9949d26463a7d9e90c7e 100644 (file)
@@ -473,7 +473,7 @@ brw_prepare_vertices(struct brw_context *brw)
          uint32_t range = intel_buffer->Base.Size;
          if (glarray->InstanceDivisor) {
             if (brw->num_instances) {
-               start = offset;
+               start = offset + glarray->StrideB * brw->baseinstance;
                range = (glarray->StrideB * ((brw->num_instances /
                                              glarray->InstanceDivisor) - 1) +
                         glarray->_ElementSize);