glthread: ignore vertex arrays with user pointers if they're disabled
authorMarek Olšák <marek.olsak@amd.com>
Mon, 9 Mar 2020 02:50:16 +0000 (22:50 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Sat, 21 Mar 2020 03:01:13 +0000 (23:01 -0400)
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4124>

src/mapi/glapi/gen/ARB_vertex_attrib_64bit.xml
src/mapi/glapi/gen/EXT_direct_state_access.xml
src/mapi/glapi/gen/GL3x.xml
src/mapi/glapi/gen/es_EXT.xml
src/mapi/glapi/gen/gl_API.xml
src/mesa/main/glthread.h
src/mesa/main/glthread_marshal.h
src/mesa/main/glthread_varray.c

index 45c30f4837862e61a194b1d9ebcfe8cb4e6d2e25..fcbb167397110f9cd81e61bf39dd3f16c32748bd 100644 (file)
@@ -52,7 +52,7 @@
     </function>
 
     <function name="VertexAttribLPointer" no_error="true" marshal="async"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_GENERIC(index));">
         <param name="index" type="GLuint"/>
         <param name="size" type="GLint"/>
         <param name="type" type="GLenum"/>
index 81310e343f41b80de0b207616592111942e4fcaf..5c52573a17276e7ffbc40c4ec9a2ac18b44a3ead 100644 (file)
    </function>
 
    <function name="MultiTexCoordPointerEXT" marshal="async"
-             marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+             marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_TEX(texunit - GL_TEXTURE0));">
       <param name="texunit" type="GLenum" />
       <param name="size" type="GLint" />
       <param name="type" type="GLenum" />
index 943e5289a9343c17ddf8247ea6abb37e3c48adea..19875bc9505ae0d2370336d4942866efc8c6ea3d 100644 (file)
 
   <function name="VertexAttribIPointer" es2="3.0" marshal="async"
             no_error="true"
-            marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+            marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_GENERIC(index));">
     <param name="index" type="GLuint"/>
     <param name="size" type="GLint"/>
     <param name="type" type="GLenum"/>
index 107ca9a2cb0cae6779cde245a93c49bdcd46cbcc..a5653313605fda495870983ba327edfb7b89f602 100644 (file)
 
     <function name="PointSizePointerOES" es1="1.0" desktop="false"
               no_error="true" marshal="async"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_POINT_SIZE);">
         <param name="type" type="GLenum"/>
         <param name="stride" type="GLsizei"/>
         <param name="pointer" type="const GLvoid *"/>
index bd5e0f111108068142e2a2bdb0ed8649d137bc7e..8c64eed6dae439cbd77f9809e57aeb46c1fbb4d0 100644 (file)
 
     <function name="ColorPointer" es1="1.0" deprecated="3.1" marshal="async"
               no_error="true"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_COLOR0);">
         <param name="size" type="GLint"/>
         <param name="type" type="GLenum"/>
         <param name="stride" type="GLsizei"/>
 
     <function name="EdgeFlagPointer" deprecated="3.1" marshal="async"
               no_error="true"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_EDGEFLAG);">
         <param name="stride" type="GLsizei"/>
         <param name="pointer" type="const GLvoid *"/>
         <glx handcode="true"/>
 
     <function name="IndexPointer" deprecated="3.1" marshal="async"
               no_error="true"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_COLOR_INDEX);">
         <param name="type" type="GLenum"/>
         <param name="stride" type="GLsizei"/>
         <param name="pointer" type="const GLvoid *"/>
 
     <function name="NormalPointer" es1="1.0" deprecated="3.1" marshal="async"
               no_error="true"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_NORMAL);">
         <param name="type" type="GLenum"/>
         <param name="stride" type="GLsizei"/>
         <param name="pointer" type="const GLvoid *"/>
 
     <function name="TexCoordPointer" es1="1.0" deprecated="3.1" marshal="async"
               no_error="true"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_TEX(ctx->GLThread.ClientActiveTexture));">
         <param name="size" type="GLint"/>
         <param name="type" type="GLenum"/>
         <param name="stride" type="GLsizei"/>
 
     <function name="VertexPointer" es1="1.0" deprecated="3.1" marshal="async"
               no_error="true"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_POS);">
         <param name="size" type="GLint"/>
         <param name="type" type="GLenum"/>
         <param name="stride" type="GLsizei"/>
 
     <function name="FogCoordPointer" deprecated="3.1" marshal="async"
               no_error="true"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_FOG);">
         <param name="type" type="GLenum"/>
         <param name="stride" type="GLsizei"/>
         <param name="pointer" type="const GLvoid *"/>
 
     <function name="SecondaryColorPointer" deprecated="3.1" marshal="async"
               no_error="true"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_COLOR1);">
         <param name="size" type="GLint"/>
         <param name="type" type="GLenum"/>
         <param name="stride" type="GLsizei"/>
 
     <function name="VertexAttribPointer" es2="2.0" marshal="async"
               no_error="true"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_GENERIC(index));">
         <param name="index" type="GLuint"/>
         <param name="size" type="GLint"/>
         <param name="type" type="GLenum"/>
     </function>
 
     <function name="ColorPointerEXT" deprecated="3.1" marshal="async"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_COLOR0);">
         <param name="size" type="GLint"/>
         <param name="type" type="GLenum"/>
         <param name="stride" type="GLsizei"/>
     </function>
 
     <function name="EdgeFlagPointerEXT" deprecated="3.1" marshal="async"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_EDGEFLAG);">
         <param name="stride" type="GLsizei"/>
         <param name="count" type="GLsizei"/>
         <param name="pointer" type="const GLboolean *"/>
     </function>
 
     <function name="IndexPointerEXT" deprecated="3.1" marshal="async"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_COLOR_INDEX);">
         <param name="type" type="GLenum"/>
         <param name="stride" type="GLsizei"/>
         <param name="count" type="GLsizei"/>
     </function>
 
     <function name="NormalPointerEXT" deprecated="3.1" marshal="async"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_NORMAL);">
         <param name="type" type="GLenum"/>
         <param name="stride" type="GLsizei"/>
         <param name="count" type="GLsizei"/>
     </function>
 
     <function name="TexCoordPointerEXT" deprecated="3.1" marshal="async"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_TEX(ctx->GLThread.ClientActiveTexture));">
         <param name="size" type="GLint"/>
         <param name="type" type="GLenum"/>
         <param name="stride" type="GLsizei"/>
     </function>
 
     <function name="VertexPointerEXT" deprecated="3.1" marshal="async"
-              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx);">
+              marshal_call_after="if (COMPAT) _mesa_glthread_AttribPointer(ctx, VERT_ATTRIB_POS);">
         <param name="size" type="GLint"/>
         <param name="type" type="GLenum"/>
         <param name="stride" type="GLsizei"/>
index 2dff33d9deb95f3523feb7837019abb4ccae3fdf..9c1742eb2b4134a5e8215f806b0f0c2841e34ae2 100644 (file)
@@ -54,9 +54,9 @@ struct _mesa_HashTable;
 
 struct glthread_vao {
    GLuint Name;
-   bool HasUserPointer;
    GLuint CurrentElementBufferName;
    GLbitfield Enabled;
+   GLbitfield UserPointerMask;
 };
 
 /** A single batch of commands queued up for execution. */
@@ -133,6 +133,7 @@ void _mesa_glthread_GenVertexArrays(struct gl_context *ctx,
                                     GLsizei n, GLuint *arrays);
 void _mesa_glthread_ClientState(struct gl_context *ctx, GLuint *vaobj,
                                 gl_vert_attrib attrib, bool enable);
-void _mesa_glthread_AttribPointer(struct gl_context *ctx);
+void _mesa_glthread_AttribPointer(struct gl_context *ctx,
+                                  gl_vert_attrib attrib);
 
 #endif /* _GLTHREAD_H*/
index 116d79f436673fb1aa6528a29fb9422102bd685f..8fc65d298625e6af714e78e49af6b4f65a22cca6 100644 (file)
@@ -84,25 +84,29 @@ _mesa_glthread_has_non_vbo_vertices_or_indices(const struct gl_context *ctx)
    struct glthread_vao *vao = glthread->CurrentVAO;
 
    return ctx->API != API_OPENGL_CORE &&
-          (vao->CurrentElementBufferName == 0 || vao->HasUserPointer);
+          (vao->CurrentElementBufferName == 0 ||
+           (vao->UserPointerMask & vao->Enabled));
 }
 
 static inline bool
 _mesa_glthread_has_non_vbo_vertices(const struct gl_context *ctx)
 {
    const struct glthread_state *glthread = &ctx->GLThread;
+   const struct glthread_vao *vao = glthread->CurrentVAO;
 
-   return ctx->API != API_OPENGL_CORE && glthread->CurrentVAO->HasUserPointer;
+   return ctx->API != API_OPENGL_CORE &&
+          (vao->UserPointerMask & vao->Enabled);
 }
 
 static inline bool
 _mesa_glthread_has_non_vbo_vertices_or_indirect(const struct gl_context *ctx)
 {
    const struct glthread_state *glthread = &ctx->GLThread;
+   const struct glthread_vao *vao = glthread->CurrentVAO;
 
    return ctx->API != API_OPENGL_CORE &&
           (glthread->CurrentDrawIndirectBufferName == 0 ||
-           glthread->CurrentVAO->HasUserPointer);
+           (vao->UserPointerMask & vao->Enabled));
 }
 
 static inline bool
@@ -113,7 +117,8 @@ _mesa_glthread_has_non_vbo_vertices_or_indices_or_indirect(const struct gl_conte
 
    return ctx->API != API_OPENGL_CORE &&
           (glthread->CurrentDrawIndirectBufferName == 0 ||
-           vao->CurrentElementBufferName == 0 || vao->HasUserPointer);
+           vao->CurrentElementBufferName == 0 ||
+           (vao->UserPointerMask & vao->Enabled));
 }
 
 
index 9e45aa287554be2201be067b3052747df92e4311..fbd08f41e5a94f9626a3f8557a48053f0f86cffd 100644 (file)
@@ -158,10 +158,13 @@ _mesa_glthread_ClientState(struct gl_context *ctx, GLuint *vaobj,
 }
 
 void
-_mesa_glthread_AttribPointer(struct gl_context *ctx)
+_mesa_glthread_AttribPointer(struct gl_context *ctx, gl_vert_attrib attrib)
 {
    struct glthread_state *glthread = &ctx->GLThread;
+   struct glthread_vao *vao = glthread->CurrentVAO;
 
-   if (glthread->CurrentArrayBufferName == 0)
-      glthread->CurrentVAO->HasUserPointer = true;
+   if (glthread->CurrentArrayBufferName != 0)
+      vao->UserPointerMask &= ~(1u << attrib);
+   else
+      vao->UserPointerMask |= 1u << attrib;
 }