From: Jason Ekstrand Date: Wed, 18 May 2016 20:05:02 +0000 (-0700) Subject: i965/draw: Account for BaseInstance in VBO bounds X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ad42ab473cb327e9f0498bda9d92cccc4279a0e8;p=mesa.git i965/draw: Account for BaseInstance in VBO bounds Cc: "11.1 11.2" Reviewed-by: Kenneth Graunke --- 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);