mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 02:28:10 +02:00
glthread: simplify repeated function sequences in marshal_generated.c
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3948>
This commit is contained in:
parent
9dbf5ec9f7
commit
c920572f60
4 changed files with 20 additions and 8 deletions
|
|
@ -87,7 +87,6 @@ class PrintCode(gl_XML.gl_print_base):
|
|||
out('return {0};'.format(call))
|
||||
|
||||
def print_sync_dispatch(self, func):
|
||||
out('debug_print_sync_fallback("{0}");'.format(func.name))
|
||||
self.print_sync_call(func)
|
||||
|
||||
def print_sync_body(self, func):
|
||||
|
|
@ -97,8 +96,7 @@ class PrintCode(gl_XML.gl_print_base):
|
|||
out('{')
|
||||
with indent():
|
||||
out('GET_CURRENT_CONTEXT(ctx);')
|
||||
out('_mesa_glthread_finish(ctx);')
|
||||
out('debug_print_sync("{0}");'.format(func.name))
|
||||
out('_mesa_glthread_finish_before(ctx, "{0}");'.format(func.name))
|
||||
self.print_sync_call(func)
|
||||
out('}')
|
||||
out('')
|
||||
|
|
@ -247,8 +245,7 @@ class PrintCode(gl_XML.gl_print_base):
|
|||
if func.marshal_fail:
|
||||
out('if ({0}) {{'.format(func.marshal_fail))
|
||||
with indent():
|
||||
out('_mesa_glthread_finish(ctx);')
|
||||
out('_mesa_glthread_restore_dispatch(ctx, __func__);')
|
||||
out('_mesa_glthread_disable(ctx, "{0}");'.format(func.name))
|
||||
self.print_sync_dispatch(func)
|
||||
out('return;')
|
||||
out('}')
|
||||
|
|
@ -264,7 +261,7 @@ class PrintCode(gl_XML.gl_print_base):
|
|||
if need_fallback_sync:
|
||||
out('fallback_to_sync:')
|
||||
with indent():
|
||||
out('_mesa_glthread_finish(ctx);')
|
||||
out('_mesa_glthread_finish_before(ctx, "{0}");'.format(func.name))
|
||||
self.print_sync_dispatch(func)
|
||||
else:
|
||||
with indent():
|
||||
|
|
|
|||
|
|
@ -148,6 +148,13 @@ _mesa_glthread_restore_dispatch(struct gl_context *ctx, const char *func)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
_mesa_glthread_disable(struct gl_context *ctx, const char *func)
|
||||
{
|
||||
_mesa_glthread_finish_before(ctx, func);
|
||||
_mesa_glthread_restore_dispatch(ctx, func);
|
||||
}
|
||||
|
||||
void
|
||||
_mesa_glthread_flush_batch(struct gl_context *ctx)
|
||||
{
|
||||
|
|
@ -227,3 +234,10 @@ _mesa_glthread_finish(struct gl_context *ctx)
|
|||
if (synced)
|
||||
p_atomic_inc(&glthread->stats.num_syncs);
|
||||
}
|
||||
|
||||
void
|
||||
_mesa_glthread_finish_before(struct gl_context *ctx, const char *func)
|
||||
{
|
||||
_mesa_glthread_finish(ctx);
|
||||
debug_print_sync_fallback(func);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,9 @@ void _mesa_glthread_init(struct gl_context *ctx);
|
|||
void _mesa_glthread_destroy(struct gl_context *ctx);
|
||||
|
||||
void _mesa_glthread_restore_dispatch(struct gl_context *ctx, const char *func);
|
||||
void _mesa_glthread_disable(struct gl_context *ctx, const char *func);
|
||||
void _mesa_glthread_flush_batch(struct gl_context *ctx);
|
||||
void _mesa_glthread_finish(struct gl_context *ctx);
|
||||
void _mesa_glthread_finish_before(struct gl_context *ctx, const char *func);
|
||||
|
||||
#endif /* _GLTHREAD_H*/
|
||||
|
|
|
|||
|
|
@ -87,8 +87,7 @@ _mesa_marshal_Enable(GLenum cap)
|
|||
debug_print_marshal("Enable");
|
||||
|
||||
if (cap == GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB) {
|
||||
_mesa_glthread_finish(ctx);
|
||||
_mesa_glthread_restore_dispatch(ctx, "Enable(DEBUG_OUTPUT_SYNCHRONOUS)");
|
||||
_mesa_glthread_disable(ctx, "Enable(DEBUG_OUTPUT_SYNCHRONOUS)");
|
||||
} else {
|
||||
cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_Enable,
|
||||
sizeof(*cmd));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue