[Mesa-dev] [PATCH 1/2] mesa: don't flag _NEW_ARRAY for GL_PRIMITIVE_RESTART_NV

Brian Paul brianp at vmware.com
Thu Jun 22 14:42:57 UTC 2017


On 06/22/2017 06:34 AM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
>   src/mesa/main/enable.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
> index f1a9c7b..e1293f9 100644
> --- a/src/mesa/main/enable.c
> +++ b/src/mesa/main/enable.c
> @@ -59,20 +59,21 @@ update_derived_primitive_restart_state(struct gl_context *ctx)
>
>   /**
>    * Helper to enable/disable client-side state.
>    */
>   static void
>   client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
>   {
>      struct gl_vertex_array_object *vao = ctx->Array.VAO;
>      GLbitfield64 flag;
>      GLboolean *var;
> +   uint64_t new_state = _NEW_ARRAY;
>
>      switch (cap) {
>         case GL_VERTEX_ARRAY:
>            var = &vao->VertexAttrib[VERT_ATTRIB_POS].Enabled;
>            flag = VERT_BIT_POS;
>            break;
>         case GL_NORMAL_ARRAY:
>            var = &vao->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled;
>            flag = VERT_BIT_NORMAL;
>            break;
> @@ -108,30 +109,31 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
>            ctx->VertexProgram.PointSizeEnabled = state;
>            break;
>
>         /* GL_NV_primitive_restart */
>         case GL_PRIMITIVE_RESTART_NV:
>            if (!ctx->Extensions.NV_primitive_restart) {
>               goto invalid_enum_error;
>            }
>            var = &ctx->Array.PrimitiveRestart;
>            flag = 0;
> +         new_state = 0; /* primitive restart is not a vertex array state */
>            break;
>
>         default:
>            goto invalid_enum_error;
>      }
>
>      if (*var == state)
>         return;
>
> -   FLUSH_VERTICES(ctx, _NEW_ARRAY);
> +   FLUSH_VERTICES(ctx, new_state);
>
>      *var = state;
>
>      update_derived_primitive_restart_state(ctx);
>
>      if (state)
>         vao->_Enabled |= flag;
>      else
>         vao->_Enabled &= ~flag;
>

Reviewed-by: Brian Paul <brianp at vmware.com>

BTW, I think the call to update_derived_primitive_restart_state(ctx) 
could be moved to the switch case for GL_PRIMITIVE_RESTART_NV.





More information about the mesa-dev mailing list