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:
@@ -130,6 +130,7 @@ struct glthread_attrib_node {
|
|||||||
int ActiveTexture;
|
int ActiveTexture;
|
||||||
GLenum MatrixMode;
|
GLenum MatrixMode;
|
||||||
bool CullFace;
|
bool CullFace;
|
||||||
|
bool DepthTest;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -231,6 +232,7 @@ struct glthread_state
|
|||||||
int MatrixStackDepth[M_NUM_MATRIX_STACKS];
|
int MatrixStackDepth[M_NUM_MATRIX_STACKS];
|
||||||
|
|
||||||
/** Enable states. */
|
/** Enable states. */
|
||||||
|
bool DepthTest;
|
||||||
bool CullFace;
|
bool CullFace;
|
||||||
|
|
||||||
GLuint CurrentDrawFramebuffer;
|
GLuint CurrentDrawFramebuffer;
|
||||||
|
@@ -452,6 +452,9 @@ _mesa_glthread_Enable(struct gl_context *ctx, GLenum cap)
|
|||||||
case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB:
|
case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB:
|
||||||
_mesa_glthread_destroy(ctx, "Enable(DEBUG_OUTPUT_SYNCHRONOUS)");
|
_mesa_glthread_destroy(ctx, "Enable(DEBUG_OUTPUT_SYNCHRONOUS)");
|
||||||
break;
|
break;
|
||||||
|
case GL_DEPTH_TEST:
|
||||||
|
ctx->GLThread.DepthTest = true;
|
||||||
|
break;
|
||||||
case GL_CULL_FACE:
|
case GL_CULL_FACE:
|
||||||
ctx->GLThread.CullFace = true;
|
ctx->GLThread.CullFace = true;
|
||||||
break;
|
break;
|
||||||
@@ -472,6 +475,9 @@ _mesa_glthread_Disable(struct gl_context *ctx, GLenum cap)
|
|||||||
case GL_CULL_FACE:
|
case GL_CULL_FACE:
|
||||||
ctx->GLThread.CullFace = false;
|
ctx->GLThread.CullFace = false;
|
||||||
break;
|
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) {
|
switch (cap) {
|
||||||
case GL_CULL_FACE:
|
case GL_CULL_FACE:
|
||||||
return ctx->GLThread.CullFace;
|
return ctx->GLThread.CullFace;
|
||||||
|
case GL_DEPTH_TEST:
|
||||||
|
return ctx->GLThread.DepthTest;
|
||||||
case GL_VERTEX_ARRAY:
|
case GL_VERTEX_ARRAY:
|
||||||
return !!(ctx->GLThread.CurrentVAO->UserEnabled & VERT_BIT_POS);
|
return !!(ctx->GLThread.CurrentVAO->UserEnabled & VERT_BIT_POS);
|
||||||
case GL_NORMAL_ARRAY:
|
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))
|
if (mask & (GL_POLYGON_BIT | GL_ENABLE_BIT))
|
||||||
attr->CullFace = ctx->GLThread.CullFace;
|
attr->CullFace = ctx->GLThread.CullFace;
|
||||||
|
|
||||||
|
if (mask & (GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT))
|
||||||
|
attr->DepthTest = ctx->GLThread.DepthTest;
|
||||||
|
|
||||||
if (mask & GL_TEXTURE_BIT)
|
if (mask & GL_TEXTURE_BIT)
|
||||||
attr->ActiveTexture = ctx->GLThread.ActiveTexture;
|
attr->ActiveTexture = ctx->GLThread.ActiveTexture;
|
||||||
|
|
||||||
@@ -529,6 +540,9 @@ _mesa_glthread_PopAttrib(struct gl_context *ctx)
|
|||||||
if (mask & (GL_POLYGON_BIT | GL_ENABLE_BIT))
|
if (mask & (GL_POLYGON_BIT | GL_ENABLE_BIT))
|
||||||
ctx->GLThread.CullFace = attr->CullFace;
|
ctx->GLThread.CullFace = attr->CullFace;
|
||||||
|
|
||||||
|
if (mask & (GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT))
|
||||||
|
ctx->GLThread.DepthTest = attr->DepthTest;
|
||||||
|
|
||||||
if (mask & GL_TEXTURE_BIT)
|
if (mask & GL_TEXTURE_BIT)
|
||||||
ctx->GLThread.ActiveTexture = attr->ActiveTexture;
|
ctx->GLThread.ActiveTexture = attr->ActiveTexture;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user