glthread: don't sync for glIsEnabled with a few enums
viewperf benefits Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13403>
This commit is contained in:
parent
6b370cbe28
commit
f4348ef60d
|
@ -42,6 +42,7 @@
|
|||
marshal NMTOKEN #IMPLIED
|
||||
marshal_sync CDATA #IMPLIED>
|
||||
marshal_count CDATA #IMPLIED>
|
||||
marshal_call_before CDATA #IMPLIED>
|
||||
marshal_call_after CDATA #IMPLIED>
|
||||
<!ATTLIST size name NMTOKEN #REQUIRED
|
||||
count NMTOKEN #IMPLIED
|
||||
|
@ -134,6 +135,8 @@ param:
|
|||
to sync and execute the call directly.
|
||||
marshal_count - same as count, but variable_param is ignored. Used by
|
||||
glthread.
|
||||
marshal_call_before - insert the string at the beginning of the marshal
|
||||
function
|
||||
marshal_call_after - insert the string at the end of the marshal function
|
||||
|
||||
glx:
|
||||
|
|
|
@ -2881,7 +2881,8 @@
|
|||
<glx sop="139"/>
|
||||
</function>
|
||||
|
||||
<function name="IsEnabled" es1="1.1" es2="2.0">
|
||||
<function name="IsEnabled" es1="1.1" es2="2.0"
|
||||
marshal_call_before="int result = _mesa_glthread_IsEnabled(ctx, cap); if (result >= 0) return result;">
|
||||
<param name="cap" type="GLenum"/>
|
||||
<return type="GLboolean"/>
|
||||
<glx sop="140" handcode="client"/>
|
||||
|
|
|
@ -655,6 +655,7 @@ class gl_function( gl_item ):
|
|||
assert not alias or not element.get('marshal')
|
||||
assert not alias or not element.get('marshal_count')
|
||||
assert not alias or not element.get('marshal_sync')
|
||||
assert not alias or not element.get('marshal_call_before')
|
||||
assert not alias or not element.get('marshal_call_after')
|
||||
|
||||
if name in static_data.functions:
|
||||
|
|
|
@ -97,6 +97,8 @@ class PrintCode(gl_XML.gl_print_base):
|
|||
out('{')
|
||||
with indent():
|
||||
out('GET_CURRENT_CONTEXT(ctx);')
|
||||
if func.marshal_call_before:
|
||||
out(func.marshal_call_before);
|
||||
out('_mesa_glthread_finish_before(ctx, "{0}");'.format(func.name))
|
||||
self.print_sync_call(func)
|
||||
out('}')
|
||||
|
@ -317,6 +319,9 @@ class PrintCode(gl_XML.gl_print_base):
|
|||
out('{')
|
||||
with indent():
|
||||
out('GET_CURRENT_CONTEXT(ctx);')
|
||||
if func.marshal_call_before:
|
||||
out(func.marshal_call_before);
|
||||
|
||||
if not func.marshal_sync:
|
||||
for p in func.variable_params:
|
||||
out('int {0}_size = {1};'.format(p.name, p.size_string(marshal = 1)))
|
||||
|
|
|
@ -58,6 +58,7 @@ class marshal_function(gl_XML.gl_function):
|
|||
# Store the "marshal" attribute, if present.
|
||||
self.marshal = element.get('marshal')
|
||||
self.marshal_sync = element.get('marshal_sync')
|
||||
self.marshal_call_before = element.get('marshal_call_before')
|
||||
self.marshal_call_after = element.get('marshal_call_after')
|
||||
|
||||
def marshal_flavor(self):
|
||||
|
|
|
@ -227,6 +227,9 @@ struct glthread_state
|
|||
struct glthread_attrib_node AttribStack[MAX_ATTRIB_STACK_DEPTH];
|
||||
int AttribStackDepth;
|
||||
int MatrixStackDepth[M_NUM_MATRIX_STACKS];
|
||||
|
||||
/** Enable states. */
|
||||
bool CullFace;
|
||||
};
|
||||
|
||||
void _mesa_glthread_init(struct gl_context *ctx);
|
||||
|
|
|
@ -442,11 +442,18 @@ _mesa_glthread_Enable(struct gl_context *ctx, GLenum cap)
|
|||
if (ctx->GLThread.ListMode == GL_COMPILE)
|
||||
return;
|
||||
|
||||
if (cap == GL_PRIMITIVE_RESTART ||
|
||||
cap == GL_PRIMITIVE_RESTART_FIXED_INDEX)
|
||||
switch (cap) {
|
||||
case GL_PRIMITIVE_RESTART:
|
||||
case GL_PRIMITIVE_RESTART_FIXED_INDEX:
|
||||
_mesa_glthread_set_prim_restart(ctx, cap, true);
|
||||
else if (cap == GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB)
|
||||
break;
|
||||
case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB:
|
||||
_mesa_glthread_disable(ctx, "Enable(DEBUG_OUTPUT_SYNCHRONOUS)");
|
||||
break;
|
||||
case GL_CULL_FACE:
|
||||
ctx->GLThread.CullFace = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -455,9 +462,35 @@ _mesa_glthread_Disable(struct gl_context *ctx, GLenum cap)
|
|||
if (ctx->GLThread.ListMode == GL_COMPILE)
|
||||
return;
|
||||
|
||||
if (cap == GL_PRIMITIVE_RESTART ||
|
||||
cap == GL_PRIMITIVE_RESTART_FIXED_INDEX)
|
||||
switch (cap) {
|
||||
case GL_PRIMITIVE_RESTART:
|
||||
case GL_PRIMITIVE_RESTART_FIXED_INDEX:
|
||||
_mesa_glthread_set_prim_restart(ctx, cap, false);
|
||||
break;
|
||||
case GL_CULL_FACE:
|
||||
ctx->GLThread.CullFace = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline int
|
||||
_mesa_glthread_IsEnabled(struct gl_context *ctx, GLenum cap)
|
||||
{
|
||||
switch (cap) {
|
||||
case GL_CULL_FACE:
|
||||
return ctx->GLThread.CullFace;
|
||||
case GL_VERTEX_ARRAY:
|
||||
return !!(ctx->GLThread.CurrentVAO->UserEnabled & VERT_BIT_POS);
|
||||
case GL_NORMAL_ARRAY:
|
||||
return !!(ctx->GLThread.CurrentVAO->UserEnabled & VERT_BIT_NORMAL);
|
||||
case GL_COLOR_ARRAY:
|
||||
return !!(ctx->GLThread.CurrentVAO->UserEnabled & VERT_BIT_COLOR0);
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
return !!(ctx->GLThread.CurrentVAO->UserEnabled &
|
||||
(1 << VERT_ATTRIB_TEX(ctx->GLThread.ClientActiveTexture)));
|
||||
default:
|
||||
return -1; /* sync and call _mesa_IsEnabled. */
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
Loading…
Reference in New Issue