[Mesa-dev] [PATCH 1/2] st/mesa: fix max_offset computation for base vertex

Jose Fonseca jfonseca at vmware.com
Tue Apr 3 08:44:46 PDT 2012


Looks good to me.

Jose

----- Original Message -----
> Fixes a failed assertion in the u_upload_mgr.c code with the VMware
> svga driver.  Note that we have to remove the !new_array test because
> the VBO module always sets _NEW_ARRAY when setting up the draw call.
> 
> Fixes https://bugs.freedesktop.org/show_bug.cgi?id=48141
> ---
>  src/mesa/state_tracker/st_draw.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/state_tracker/st_draw.c
> b/src/mesa/state_tracker/st_draw.c
> index eb18751..487be84 100644
> --- a/src/mesa/state_tracker/st_draw.c
> +++ b/src/mesa/state_tracker/st_draw.c
> @@ -979,6 +979,7 @@ st_draw_vbo(struct gl_context *ctx,
>     struct pipe_index_buffer ibuffer;
>     struct pipe_draw_info info;
>     unsigned i, num_instances = 1;
> +   int max_base_vertex = 0;
>     GLboolean new_array =
>        st->dirty.st &&
>        (st->dirty.mesa & (_NEW_ARRAY | _NEW_PROGRAM |
>        _NEW_BUFFER_OBJECT)) != 0;
> @@ -995,6 +996,7 @@ st_draw_vbo(struct gl_context *ctx,
>  
>        for (i = 0; i < nr_prims; i++) {
>           num_instances = MAX2(num_instances,
>           prims[i].num_instances);
> +         max_base_vertex = MAX2(max_base_vertex,
> prims[i].basevertex);
>        }
>     }
>     else {
> @@ -1041,13 +1043,13 @@ st_draw_vbo(struct gl_context *ctx,
>     /* Notify the driver that the content of user buffers may have
>     been
>      * changed. */
>     assert(max_index >= min_index);
> -   if (!new_array && st->num_user_attribs) {
> +   if (st->num_user_attribs) {
>        for (i = 0; i < st->num_user_attribs; i++) {
>           if (st->user_attrib[i].buffer) {
>              unsigned element_size = st->user_attrib[i].element_size;
>              unsigned stride = st->user_attrib[i].stride;
>              unsigned min_offset = min_index * stride;
> -            unsigned max_offset = max_index * stride + element_size;
> +            unsigned max_offset = (max_index + max_base_vertex) *
> stride + element_size;
>  
>              assert(max_offset > min_offset);
>  
> --
> 1.7.3.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


More information about the mesa-dev mailing list