mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 15:20:10 +01:00
gltrhead: merge 3 blocks conditional on marshal_sync in print_async_body
There are 3 blocks next to each other that check marshal_sync. Merge them. No functional change. Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27350>
This commit is contained in:
parent
e9819744b3
commit
dd6b0ea015
1 changed files with 14 additions and 15 deletions
|
|
@ -166,22 +166,11 @@ class PrintCode(gl_XML.gl_print_base):
|
|||
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)))
|
||||
|
||||
struct = 'struct marshal_cmd_{0}'.format(func.name)
|
||||
size_terms = ['sizeof({0})'.format(struct)]
|
||||
if not func.marshal_sync:
|
||||
for p in func.variable_params:
|
||||
if p.img_null_flag:
|
||||
size_terms.append('({0} ? {0}_size : 0)'.format(p.name))
|
||||
else:
|
||||
size_terms.append('{0}_size'.format(p.name))
|
||||
out('int cmd_size = {0};'.format(' + '.join(size_terms)))
|
||||
out('{0} *cmd;'.format(struct))
|
||||
|
||||
if func.marshal_sync:
|
||||
out('int cmd_size = sizeof({0});'.format(struct))
|
||||
|
||||
out('if ({0}) {{'.format(func.marshal_sync))
|
||||
with indent():
|
||||
out('_mesa_glthread_finish_before(ctx, "{0}");'.format(func.name))
|
||||
|
|
@ -189,6 +178,16 @@ class PrintCode(gl_XML.gl_print_base):
|
|||
out('return;')
|
||||
out('}')
|
||||
else:
|
||||
size_terms = ['sizeof({0})'.format(struct)]
|
||||
for p in func.variable_params:
|
||||
out('int {0}_size = {1};'.format(p.name, p.size_string(marshal=1)))
|
||||
if p.img_null_flag:
|
||||
size_terms.append('({0} ? {0}_size : 0)'.format(p.name))
|
||||
else:
|
||||
size_terms.append('{0}_size'.format(p.name))
|
||||
|
||||
out('int cmd_size = {0};'.format(' + '.join(size_terms)))
|
||||
|
||||
# Fall back to syncing if variable-length sizes can't be handled.
|
||||
#
|
||||
# Check that any counts for variable-length arguments might be < 0, in
|
||||
|
|
@ -211,8 +210,8 @@ class PrintCode(gl_XML.gl_print_base):
|
|||
out('}')
|
||||
|
||||
# Add the call into the batch.
|
||||
out('cmd = _mesa_glthread_allocate_command(ctx, '
|
||||
'DISPATCH_CMD_{0}, cmd_size);'.format(func.name))
|
||||
out('{0} *cmd = _mesa_glthread_allocate_command(ctx, '
|
||||
'DISPATCH_CMD_{1}, cmd_size);'.format(struct, func.name))
|
||||
if func.variable_params:
|
||||
out('cmd->num_slots = align(cmd_size, 8) / 8;')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue