From: Marek Olšák Date: Wed, 4 Mar 2020 19:49:09 +0000 (-0500) Subject: glthread: track which vertex array attribs are enabled X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0b1dd1859134e71b25ad1124535df96d435e9766;p=mesa.git glthread: track which vertex array attribs are enabled Reviewed-by: Timothy Arceri Part-of: --- diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml index ec7b13609a1..cd0f51c4327 100644 --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml @@ -585,12 +585,14 @@ - + - + diff --git a/src/mapi/glapi/gen/EXT_direct_state_access.xml b/src/mapi/glapi/gen/EXT_direct_state_access.xml index 397c75a37d0..81310e343f4 100644 --- a/src/mapi/glapi/gen/EXT_direct_state_access.xml +++ b/src/mapi/glapi/gen/EXT_direct_state_access.xml @@ -986,12 +986,14 @@ - + - + @@ -1151,22 +1153,26 @@ - + - + - + - + diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index e1ef6262281..bd5e0f11110 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -3174,7 +3174,8 @@ - + @@ -3204,7 +3205,8 @@ - + @@ -4285,7 +4287,8 @@ - + @@ -5357,13 +5360,15 @@ - + - + diff --git a/src/mesa/main/glthread.h b/src/mesa/main/glthread.h index 5491e1994c1..2dff33d9deb 100644 --- a/src/mesa/main/glthread.h +++ b/src/mesa/main/glthread.h @@ -47,6 +47,7 @@ #include #include "util/u_queue.h" #include "GL/gl.h" +#include "compiler/shader_enums.h" struct gl_context; struct _mesa_HashTable; @@ -55,6 +56,7 @@ struct glthread_vao { GLuint Name; bool HasUserPointer; GLuint CurrentElementBufferName; + GLbitfield Enabled; }; /** A single batch of commands queued up for execution. */ @@ -103,6 +105,7 @@ struct glthread_state struct glthread_vao *CurrentVAO; struct glthread_vao *LastLookedUpVAO; struct glthread_vao DefaultVAO; + int ClientActiveTexture; /** Currently-bound buffer object IDs. */ GLuint CurrentArrayBufferName; @@ -128,6 +131,8 @@ void _mesa_glthread_DeleteVertexArrays(struct gl_context *ctx, GLsizei n, const GLuint *ids); 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); #endif /* _GLTHREAD_H*/ diff --git a/src/mesa/main/glthread_marshal.h b/src/mesa/main/glthread_marshal.h index 2e5001b1af7..116d79f4366 100644 --- a/src/mesa/main/glthread_marshal.h +++ b/src/mesa/main/glthread_marshal.h @@ -372,4 +372,33 @@ _mesa_semaphore_enum_to_count(GLenum pname) } } +static inline gl_vert_attrib +_mesa_array_to_attrib(struct gl_context *ctx, GLenum array) +{ + switch (array) { + case GL_VERTEX_ARRAY: + return VERT_ATTRIB_POS; + case GL_NORMAL_ARRAY: + return VERT_ATTRIB_NORMAL; + case GL_COLOR_ARRAY: + return VERT_ATTRIB_COLOR0; + case GL_INDEX_ARRAY: + return VERT_ATTRIB_COLOR_INDEX; + case GL_TEXTURE_COORD_ARRAY: + return VERT_ATTRIB_TEX(ctx->GLThread.ClientActiveTexture); + case GL_EDGE_FLAG_ARRAY: + return VERT_ATTRIB_EDGEFLAG; + case GL_FOG_COORDINATE_ARRAY: + return VERT_ATTRIB_FOG; + case GL_SECONDARY_COLOR_ARRAY: + return VERT_ATTRIB_COLOR1; + case GL_POINT_SIZE_ARRAY_OES: + return VERT_ATTRIB_POINT_SIZE; + default: + if (array >= GL_TEXTURE0 && array <= GL_TEXTURE7) + return VERT_ATTRIB_TEX(array - GL_TEXTURE0); + return VERT_ATTRIB_MAX; + } +} + #endif /* MARSHAL_H */ diff --git a/src/mesa/main/glthread_varray.c b/src/mesa/main/glthread_varray.c index 8049a9d2ff1..9e45aa28755 100644 --- a/src/mesa/main/glthread_varray.c +++ b/src/mesa/main/glthread_varray.c @@ -133,6 +133,30 @@ _mesa_glthread_GenVertexArrays(struct gl_context *ctx, } } +void +_mesa_glthread_ClientState(struct gl_context *ctx, GLuint *vaobj, + gl_vert_attrib attrib, bool enable) +{ + struct glthread_state *glthread = &ctx->GLThread; + struct glthread_vao *vao; + + if (attrib >= VERT_ATTRIB_MAX) + return; + + if (vaobj) { + vao = lookup_vao(ctx, *vaobj); + if (!vao) + return; + } else { + vao = glthread->CurrentVAO; + } + + if (enable) + vao->Enabled |= 1u << attrib; + else + vao->Enabled &= ~(1u << attrib); +} + void _mesa_glthread_AttribPointer(struct gl_context *ctx) {