[Mesa-dev] [PATCH 0/6] Mesa/Gallium vertex array state optimizations

Keith Whitwell keithw at vmware.com
Mon Feb 14 02:34:24 PST 2011


On Sun, 2011-02-13 at 22:04 +0100, Marek Olšák wrote:
> Keith,
> 
> Yes, they will. If vertex buffers are not re-set in st_draw_vbo,
> redefine_user_buffer is called for each user buffer which is set and that
> tells a driver which buffer ranges need to be re-uploaded. This can be found
> in the last hunk of the last patch, specifically:

OK, thanks for clarifying Marek.  I think the patches look great.

> @@ -646,6 +664,26 @@ st_draw_vbo(struct gl_context *ctx,
>  #endif
>    }
> 
> +   /* Notify the driver that the content of user buffers may have been
> +    * changed. */
> +   if (!new_array && st->num_user_vbs) {
> +      for (i = 0; i < st->num_user_vbs; i++) {
> +         if (st->user_vb[i]) {
> +            unsigned stride = st->user_vb_stride[i];
> +
> +            if (stride) {
> +               pipe->redefine_user_buffer(pipe, st->user_vb[i],
> +                                          min_index * stride,
> +                                          (max_index + 1 - min_index) *
> stride);
> +            } else {
> +               /* stride == 0 */
> +               pipe->redefine_user_buffer(pipe, st->user_vb[i],
> +                                          0, st->user_vb[i]->width0);
> +            }
> +         }
> +      }
> +   }
> +
>    setup_index_buffer(ctx, ib, &ibuffer);
>    pipe->set_index_buffer(pipe, &ibuffer);
> 
> What remains to implement is using this information in drivers to re-upload
> the buffer ranges marked with redefine_user_buffer. r300g, r600g, some
> nouveau drivers, and anything which uses Draw do not need this information,
> so they are safe. I think the only driver which needs special handling is
> svga, but I don't know that driver so well to be able to do it.

I know svga is getting a bit of attention at the moment, so this might
be something they may want to pick up.

Keith




More information about the mesa-dev mailing list