glthread: ignore vertex arrays with user pointers if they're disabled

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4124>
This commit is contained in:
Marek Olšák
2020-03-08 22:50:16 -04:00
parent 0b1dd18591
commit c02a1347e5
8 changed files with 37 additions and 28 deletions

View 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"/>

View File

@@ -658,7 +658,7 @@
</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" />

View File

@@ -258,7 +258,7 @@
<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"/>

View File

@@ -320,7 +320,7 @@
<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 *"/>

View File

@@ -3166,7 +3166,7 @@
<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"/>
@@ -3199,7 +3199,7 @@
<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"/>
@@ -3219,7 +3219,7 @@
<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 *"/>
@@ -3235,7 +3235,7 @@
<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 *"/>
@@ -3244,7 +3244,7 @@
<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"/>
@@ -3254,7 +3254,7 @@
<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"/>
@@ -4751,7 +4751,7 @@
<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 *"/>
@@ -4892,7 +4892,7 @@
<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"/>
@@ -5853,7 +5853,7 @@
<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"/>
@@ -9251,7 +9251,7 @@
</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"/>
@@ -9267,7 +9267,7 @@
</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 *"/>
@@ -9280,7 +9280,7 @@
</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"/>
@@ -9289,7 +9289,7 @@
</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"/>
@@ -9298,7 +9298,7 @@
</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"/>
@@ -9308,7 +9308,7 @@
</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"/>

View 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*/

View 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));
}

View 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;
}