Module: Mesa Branch: main Commit: 8e024e2870328a9b064d607f2583029ac2784bf3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e024e2870328a9b064d607f2583029ac2784bf3
Author: Marek Olšák <[email protected]> Date: Sat Aug 27 18:01:53 2022 -0400 glthread: don't sync for glIsEnabled(GL_BLEND, GL_LIGHTING, GL_POLYGON_STIPPLE) Acked-By: Mike Blumenkrantz <[email protected]> Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18199> --- src/mesa/main/glthread.h | 6 ++++++ src/mesa/main/glthread_marshal.h | 44 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/glthread.h b/src/mesa/main/glthread.h index d8b7f4b35a1..001be6a7544 100644 --- a/src/mesa/main/glthread.h +++ b/src/mesa/main/glthread.h @@ -131,8 +131,11 @@ struct glthread_attrib_node { GLbitfield Mask; int ActiveTexture; GLenum16 MatrixMode; + bool Blend; bool CullFace; bool DepthTest; + bool Lighting; + bool PolygonStipple; }; typedef enum { @@ -234,8 +237,11 @@ struct glthread_state int MatrixStackDepth[M_NUM_MATRIX_STACKS]; /** Enable states. */ + bool Blend; bool DepthTest; bool CullFace; + bool Lighting; + bool PolygonStipple; GLuint CurrentDrawFramebuffer; GLuint CurrentReadFramebuffer; diff --git a/src/mesa/main/glthread_marshal.h b/src/mesa/main/glthread_marshal.h index b033dfa3a2b..49eba0850d9 100644 --- a/src/mesa/main/glthread_marshal.h +++ b/src/mesa/main/glthread_marshal.h @@ -473,12 +473,21 @@ _mesa_glthread_Enable(struct gl_context *ctx, GLenum cap) case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB: _mesa_glthread_destroy(ctx, "Enable(DEBUG_OUTPUT_SYNCHRONOUS)"); break; + case GL_BLEND: + ctx->GLThread.Blend = true; + break; case GL_DEPTH_TEST: ctx->GLThread.DepthTest = true; break; case GL_CULL_FACE: ctx->GLThread.CullFace = true; break; + case GL_LIGHTING: + ctx->GLThread.Lighting = true; + break; + case GL_POLYGON_STIPPLE: + ctx->GLThread.PolygonStipple = true; + break; } } @@ -493,12 +502,21 @@ _mesa_glthread_Disable(struct gl_context *ctx, GLenum cap) case GL_PRIMITIVE_RESTART_FIXED_INDEX: _mesa_glthread_set_prim_restart(ctx, cap, false); break; + case GL_BLEND: + ctx->GLThread.Blend = false; + break; case GL_CULL_FACE: ctx->GLThread.CullFace = false; break; case GL_DEPTH_TEST: ctx->GLThread.DepthTest = false; break; + case GL_LIGHTING: + ctx->GLThread.Lighting = false; + break; + case GL_POLYGON_STIPPLE: + ctx->GLThread.PolygonStipple = false; + break; } } @@ -510,10 +528,16 @@ _mesa_glthread_IsEnabled(struct gl_context *ctx, GLenum cap) return -1; switch (cap) { + case GL_BLEND: + return ctx->GLThread.Blend; case GL_CULL_FACE: return ctx->GLThread.CullFace; case GL_DEPTH_TEST: return ctx->GLThread.DepthTest; + case GL_LIGHTING: + return ctx->GLThread.Lighting; + case GL_POLYGON_STIPPLE: + return ctx->GLThread.PolygonStipple; case GL_VERTEX_ARRAY: return !!(ctx->GLThread.CurrentVAO->UserEnabled & VERT_BIT_POS); case GL_NORMAL_ARRAY: @@ -542,12 +566,20 @@ _mesa_glthread_PushAttrib(struct gl_context *ctx, GLbitfield mask) attr->Mask = mask; - if (mask & (GL_POLYGON_BIT | GL_ENABLE_BIT)) + if (mask & GL_ENABLE_BIT) + attr->Blend = ctx->GLThread.Blend; + + if (mask & (GL_POLYGON_BIT | GL_ENABLE_BIT)) { attr->CullFace = ctx->GLThread.CullFace; + attr->PolygonStipple = ctx->GLThread.PolygonStipple; + } if (mask & (GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT)) attr->DepthTest = ctx->GLThread.DepthTest; + if (mask & (GL_LIGHTING_BIT | GL_ENABLE_BIT)) + attr->Lighting = ctx->GLThread.Lighting; + if (mask & GL_TEXTURE_BIT) attr->ActiveTexture = ctx->GLThread.ActiveTexture; @@ -568,12 +600,20 @@ _mesa_glthread_PopAttrib(struct gl_context *ctx) &ctx->GLThread.AttribStack[--ctx->GLThread.AttribStackDepth]; unsigned mask = attr->Mask; - if (mask & (GL_POLYGON_BIT | GL_ENABLE_BIT)) + if (mask & GL_ENABLE_BIT) + ctx->GLThread.Blend = attr->Blend; + + if (mask & (GL_POLYGON_BIT | GL_ENABLE_BIT)) { ctx->GLThread.CullFace = attr->CullFace; + ctx->GLThread.PolygonStipple = attr->PolygonStipple; + } if (mask & (GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT)) ctx->GLThread.DepthTest = attr->DepthTest; + if (mask & (GL_LIGHTING_BIT | GL_ENABLE_BIT)) + ctx->GLThread.Lighting = attr->Lighting; + if (mask & GL_TEXTURE_BIT) ctx->GLThread.ActiveTexture = attr->ActiveTexture;
