From ad42ab473cb327e9f0498bda9d92cccc4279a0e8 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 18 May 2016 13:05:02 -0700 Subject: [PATCH] i965/draw: Account for BaseInstance in VBO bounds Cc: "11.1 11.2" Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_context.h | 1 + src/mesa/drivers/dri/i965/brw_draw.c | 4 +++- src/mesa/drivers/dri/i965/brw_draw_upload.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index c6fb8d277e1..76ed1de12a8 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1311,6 +1311,7 @@ struct brw_context uint32_t num_instances; int basevertex; + int baseinstance; struct { const struct brw_l3_config *config; diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 7901972111f..fa3ff5fdfc2 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -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); diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 725a65e10ab..6d9e65e9cfa 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -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); -- 2.30.2