[Mesa-dev] Mesa (master): st/mesa & v_bug_mgr: two small instanced drawing fixes

Brian Paul brianp at vmware.com
Mon Feb 28 08:32:52 PST 2011


On 02/27/2011 05:20 PM, Christian König wrote:
> Module: Mesa
> Branch: master
> Commit: bce4f9ac395986ee0acae2702ed73448333d81b8
> URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bce4f9ac395986ee0acae2702ed73448333d81b8
>
> Author: Christian König<deathsimple at vodafone.de>
> Date:   Mon Feb 28 01:54:36 2011 +0100
>
> st/mesa&  v_bug_mgr: two small instanced drawing fixes
>
> ---
>
>   src/gallium/auxiliary/util/u_vbuf_mgr.c |    5 ++++-
>   src/mesa/state_tracker/st_draw.c        |    2 ++
>   2 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/src/gallium/auxiliary/util/u_vbuf_mgr.c b/src/gallium/auxiliary/util/u_vbuf_mgr.c
> index dec8dd7..3cf8ee0 100644
> --- a/src/gallium/auxiliary/util/u_vbuf_mgr.c
> +++ b/src/gallium/auxiliary/util/u_vbuf_mgr.c
> @@ -531,7 +531,10 @@ static void u_vbuf_upload_buffers(struct u_vbuf_mgr_priv *mgr,
>            unsigned first, size;
>            boolean flushed;
>
> -         if (vb->stride) {
> +         if (mgr->ve->ve[i].instance_divisor) {
> +            first = 0;
> +            size = vb->buffer->width0;
> +         } else if (vb->stride) {
>               first = vb->stride * min_index;
>               size = vb->stride * count;
>            } else {
> diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
> index 6530a06..c99eafb 100644
> --- a/src/mesa/state_tracker/st_draw.c
> +++ b/src/mesa/state_tracker/st_draw.c
> @@ -579,6 +579,7 @@ st_validate_varrays(struct gl_context *ctx,
>      if (is_interleaved_arrays(vp, vpv, arrays)) {
>         setup_interleaved_attribs(ctx, vp, vpv, arrays, vbuffer, velements,
>                                   max_index);
> +
>         num_vbuffers = 1;
>         num_velements = vpv->num_inputs;
>         if (num_velements == 0)
> @@ -645,6 +646,7 @@ st_draw_vbo(struct gl_context *ctx,
>         for (i = 0; i<  nr_prims; i++) {
>            min_index = MIN2(min_index, prims[i].start);
>            max_index = MAX2(max_index, prims[i].start + prims[i].count - 1);
> +         max_index = MAX2(max_index, prims[i].num_instances);
>         }
>      }

I don't understand that last bit.  If we're doing regular, 
non-instanced drawing, prims[i].num_instances will be 1.  So max_index 
will always be one.  That doesn't seem right.

-Brian



More information about the mesa-dev mailing list