<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 20, 2016 at 4:41 PM, Ilia Mirkin <span dir="ltr"><<a href="mailto:imirkin@alum.mit.edu" target="_blank">imirkin@alum.mit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Fri, May 20, 2016 at 7:53 PM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> Cc: "11.1 11.2" <<a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.org</a>><br>
> ---<br>
>  src/mesa/drivers/dri/i965/brw_context.h     | 1 +<br>
>  src/mesa/drivers/dri/i965/brw_draw.c        | 4 +++-<br>
>  src/mesa/drivers/dri/i965/brw_draw_upload.c | 2 +-<br>
>  3 files changed, 5 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h<br>
> index c6fb8d2..76ed1de 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_context.h<br>
> +++ b/src/mesa/drivers/dri/i965/brw_context.h<br>
> @@ -1311,6 +1311,7 @@ struct brw_context<br>
><br>
>     uint32_t num_instances;<br>
>     int basevertex;<br>
> +   int baseinstance;<br>
><br>
>     struct {<br>
>        const struct brw_l3_config *config;<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c<br>
> index 7901972..fa3ff5f 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_draw.c<br>
> +++ b/src/mesa/drivers/dri/i965/brw_draw.c<br>
> @@ -502,9 +502,11 @@ brw_try_draw_prims(struct gl_context *ctx,<br>
>        intel_batchbuffer_save_state(brw);<br>
><br>
>        if (brw->num_instances != prims[i].num_instances ||<br>
> -          brw->basevertex != prims[i].basevertex) {<br>
> +          brw->basevertex != prims[i].basevertex ||<br>
> +          brw->baseinstance != prims[i].base_instance) {<br>
>           brw->num_instances = prims[i].num_instances;<br>
>           brw->basevertex = prims[i].basevertex;<br>
> +         brw->baseinstance = prims[i].base_instance;<br>
>           if (i > 0) { /* For i == 0 we just did this before the loop */<br>
>              brw->ctx.NewDriverState |= BRW_NEW_VERTICES;<br>
>              brw_merge_inputs(brw, arrays);<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c<br>
> index 725a65e..6d9e65e 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c<br>
> +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c<br>
> @@ -473,7 +473,7 @@ brw_prepare_vertices(struct brw_context *brw)<br>
>           uint32_t range = intel_buffer->Base.Size;<br>
>           if (glarray->InstanceDivisor) {<br>
>              if (brw->num_instances) {<br>
> -               start = offset;<br>
> +               start = offset + glarray->StrideB * brw->baseinstance;<br>
<br>
</div></div>/ instance divisor, no?<span class=""><br></span></blockquote><div><br></div><div>No.  baseinstance is not divided by the divisor.  Yes, that's kinda funky but it's what the spec says.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
>                 range = (glarray->StrideB * ((brw->num_instances /<br>
>                                               glarray->InstanceDivisor) - 1) +<br>
<br>
</span>And then it has to be carefully incorporated into this calculation,<br>
since the instance divisor might be, say, 8, and the base instance is<br>
7, and you draw 2 instances.<br>
<br>
>                          glarray->_ElementSize);<br>
<span class="HOEnZb"><font color="#888888">> --<br>
> 2.5.0.400.gff86faf<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>