[Mesa-stable] [Mesa-dev] [PATCH v3 06/16] i965/draw: Account for BaseInstance in VBO bounds
Ilia Mirkin
imirkin at alum.mit.edu
Sat May 21 00:14:31 UTC 2016
On Fri, May 20, 2016 at 7:57 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
>
>
> On Fri, May 20, 2016 at 4:41 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>>
>> On Fri, May 20, 2016 at 7:53 PM, Jason Ekstrand <jason at jlekstrand.net>
>> wrote:
>> > Cc: "11.1 11.2" <mesa-stable at lists.freedesktop.org>
>> > ---
>> > 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 c6fb8d2..76ed1de 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 7901972..fa3ff5f 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 725a65e..6d9e65e 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;
>>
>> / instance divisor, no?
>
>
> No. baseinstance is not divided by the divisor. Yes, that's kinda funky
> but it's what the spec says.
Thus, the element transferred from instanced
vertex attributes is given by:
(<instanceID> / <divisor>) + <baseinstance>
Indeed. My bad!
>
>>
>> > range = (glarray->StrideB * ((brw->num_instances /
>> > glarray->InstanceDivisor)
>> > - 1) +
>>
>> And then it has to be carefully incorporated into this calculation,
>> since the instance divisor might be, say, 8, and the base instance is
>> 7, and you draw 2 instances.
>>
>> > glarray->_ElementSize);
>> > --
>> > 2.5.0.400.gff86faf
>> >
>> > _______________________________________________
>> > mesa-dev mailing list
>> > mesa-dev at lists.freedesktop.org
>> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
More information about the mesa-stable
mailing list