glthread: don't sync on IsEnabled(GL_DEPTH_TEST) by tracking it in glthread

Discovered with viewperf.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17781>
This commit is contained in:
Marek Olšák
2022-07-24 16:09:00 -04:00
committed by Marge Bot
parent a4ee818b18
commit 91a3a38d5c
2 changed files with 16 additions and 0 deletions

View File

@@ -130,6 +130,7 @@ struct glthread_attrib_node {
int ActiveTexture;
GLenum MatrixMode;
bool CullFace;
bool DepthTest;
};
typedef enum {
@@ -231,6 +232,7 @@ struct glthread_state
int MatrixStackDepth[M_NUM_MATRIX_STACKS];
/** Enable states. */
bool DepthTest;
bool CullFace;
GLuint CurrentDrawFramebuffer;

View File

@@ -452,6 +452,9 @@ _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_DEPTH_TEST:
ctx->GLThread.DepthTest = true;
break;
case GL_CULL_FACE:
ctx->GLThread.CullFace = true;
break;
@@ -472,6 +475,9 @@ _mesa_glthread_Disable(struct gl_context *ctx, GLenum cap)
case GL_CULL_FACE:
ctx->GLThread.CullFace = false;
break;
case GL_DEPTH_TEST:
ctx->GLThread.DepthTest = false;
break;
}
}
@@ -481,6 +487,8 @@ _mesa_glthread_IsEnabled(struct gl_context *ctx, GLenum cap)
switch (cap) {
case GL_CULL_FACE:
return ctx->GLThread.CullFace;
case GL_DEPTH_TEST:
return ctx->GLThread.DepthTest;
case GL_VERTEX_ARRAY:
return !!(ctx->GLThread.CurrentVAO->UserEnabled & VERT_BIT_POS);
case GL_NORMAL_ARRAY:
@@ -509,6 +517,9 @@ _mesa_glthread_PushAttrib(struct gl_context *ctx, GLbitfield mask)
if (mask & (GL_POLYGON_BIT | GL_ENABLE_BIT))
attr->CullFace = ctx->GLThread.CullFace;
if (mask & (GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT))
attr->DepthTest = ctx->GLThread.DepthTest;
if (mask & GL_TEXTURE_BIT)
attr->ActiveTexture = ctx->GLThread.ActiveTexture;
@@ -529,6 +540,9 @@ _mesa_glthread_PopAttrib(struct gl_context *ctx)
if (mask & (GL_POLYGON_BIT | GL_ENABLE_BIT))
ctx->GLThread.CullFace = attr->CullFace;
if (mask & (GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT))
ctx->GLThread.DepthTest = attr->DepthTest;
if (mask & GL_TEXTURE_BIT)
ctx->GLThread.ActiveTexture = attr->ActiveTexture;