[Mesa-dev] [PATCH] vbo: fix attr reset

Brian Paul brianp at vmware.com
Wed Jul 6 13:53:52 UTC 2016


On 07/05/2016 08:57 PM, Mathias Fröhlich wrote:
> On Tuesday, July 05, 2016 15:47:45 Rob Clark wrote:
>
>  > In bc4e0c4 (vbo: Use a bitmask to track the active arrays in vbo_exec*.)
>
>  > we stopped looping over all the attributes and resetting all slots.
>
>  > Which exposed an issue in vbo_exec_bind_arrays() for handling GENERIC0
>
>  > vs. POS.
>
>  >
>
>  > Split out a helper which can reset a particular slot, so that
>
>  > vbo_exec_bind_arrays() can re-use it to reset POS.

Rob, can you mention in the commit msg that this fixes 0ad (I think that 
was it)?

-Brian


>
> I had a similar problem with the pos/generic0 handling
>
> fixed, but obviously missed this!
>
> The fix looks good to me.
>
> Thanks for taking care!
>
> Reviewed-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
>
>  >
>
>  > Signed-off-by: Rob Clark <robdclark at gmail.com>
>
>  > ---
>
>  > src/mesa/vbo/vbo_exec.h | 1 +
>
>  > src/mesa/vbo/vbo_exec_api.c | 14 ++++++++------
>
>  > src/mesa/vbo/vbo_exec_draw.c | 2 +-
>
>  > 3 files changed, 10 insertions(+), 7 deletions(-)
>
>  >
>
>  > diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h
>
>  > index 5e20cf6..4f11f17 100644
>
>  > --- a/src/mesa/vbo/vbo_exec.h
>
>  > +++ b/src/mesa/vbo/vbo_exec.h
>
>  > @@ -152,6 +152,7 @@ void vbo_exec_invalidate_state( struct gl_context
> *ctx, GLbitfield new_state );
>
>  >
>
>  > /* Internal functions:
>
>  > */
>
>  > +void vbo_reset_attr(struct vbo_exec_context *exec, GLuint attr);
>
>  >
>
>  > void vbo_exec_vtx_init( struct vbo_exec_context *exec );
>
>  > void vbo_exec_vtx_destroy( struct vbo_exec_context *exec );
>
>  > diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
>
>  > index e02bb90..32f15db 100644
>
>  > --- a/src/mesa/vbo/vbo_exec_api.c
>
>  > +++ b/src/mesa/vbo/vbo_exec_api.c
>
>  > @@ -1275,16 +1275,18 @@ void vbo_exec_FlushVertices( struct
> gl_context *ctx, GLuint flags )
>
>  > #endif
>
>  > }
>
>  >
>
>  > +void vbo_reset_attr(struct vbo_exec_context *exec, GLuint attr)
>
>  > +{
>
>  > + exec->vtx.attrsz[attr] = 0;
>
>  > + exec->vtx.attrtype[attr] = GL_FLOAT;
>
>  > + exec->vtx.active_sz[attr] = 0;
>
>  > +}
>
>  >
>
>  > static void reset_attrfv( struct vbo_exec_context *exec )
>
>  > -{
>
>  > +{
>
>  > while (exec->vtx.enabled) {
>
>  > const int i = u_bit_scan64(&exec->vtx.enabled);
>
>  > - assert(exec->vtx.attrsz[i]);
>
>  > -
>
>  > - exec->vtx.attrsz[i] = 0;
>
>  > - exec->vtx.attrtype[i] = GL_FLOAT;
>
>  > - exec->vtx.active_sz[i] = 0;
>
>  > + vbo_reset_attr(exec, i);
>
>  > }
>
>  >
>
>  > exec->vtx.vertex_size = 0;
>
>  > diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
>
>  > index 8d1b2c0..0ef3081 100644
>
>  > --- a/src/mesa/vbo/vbo_exec_draw.c
>
>  > +++ b/src/mesa/vbo/vbo_exec_draw.c
>
>  > @@ -213,7 +213,7 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
>
>  > exec->vtx.inputs[VERT_ATTRIB_GENERIC0] = exec->vtx.inputs[0];
>
>  > exec->vtx.attrsz[VERT_ATTRIB_GENERIC0] = exec->vtx.attrsz[0];
>
>  > exec->vtx.attrptr[VERT_ATTRIB_GENERIC0] = exec->vtx.attrptr[0];
>
>  > - exec->vtx.attrsz[0] = 0;
>
>  > + vbo_reset_attr(exec, VERT_ATTRIB_POS);
>
>  > exec->vtx.enabled &= (~BITFIELD64_BIT(VBO_ATTRIB_POS));
>
>  > exec->vtx.enabled |= BITFIELD64_BIT(VBO_ATTRIB_GENERIC0);
>
>  > }
>
>  >
>



More information about the mesa-dev mailing list