diff options
author | Marek Olšák <[email protected]> | 2020-02-19 18:45:56 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-06 01:06:14 +0000 |
commit | 30b6e8236400deac08aec6b0334f78b7eacb62d9 (patch) | |
tree | 3bd847b83a5f5adc61581ddc7dfe730ac4be5944 /src/mapi | |
parent | 19dc528bbf74cb823c87420ee3e5b8cb6495a199 (diff) |
glthread: don't increment variable_data if it's the last variable-size param
Reviewed-by: Timothy Arceri <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3948>
Diffstat (limited to 'src/mapi')
-rw-r--r-- | src/mapi/glapi/gen/gl_marshal.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py index 261213b7442..a6826251ca7 100644 --- a/src/mapi/glapi/gen/gl_marshal.py +++ b/src/mapi/glapi/gen/gl_marshal.py @@ -113,6 +113,7 @@ class PrintCode(gl_XML.gl_print_base): out('cmd->{0} = {0};'.format(p.name)) if func.variable_params: out('char *variable_data = (char *) (cmd + 1);') + i = 1 for p in func.variable_params: if p.img_null_flag: out('cmd->{0}_null = !{0};'.format(p.name)) @@ -120,14 +121,17 @@ class PrintCode(gl_XML.gl_print_base): with indent(): out(('memcpy(variable_data, {0}, {1});').format( p.name, p.size_string(False))) - out('variable_data += {0};'.format( - p.size_string(False))) + if i < len(func.variable_params): + out('variable_data += {0};'.format( + p.size_string(False))) out('}') else: out(('memcpy(variable_data, {0}, {1});').format( p.name, p.size_string(False))) - out('variable_data += {0};'.format( - p.size_string(False))) + if i < len(func.variable_params): + out('variable_data += {0};'.format( + p.size_string(False))) + i += 1 if not func.fixed_params and not func.variable_params: out('(void) cmd;\n') @@ -191,6 +195,7 @@ class PrintCode(gl_XML.gl_print_base): out('{0} * {1};'.format( p.get_base_type_string(), p.name)) out('const char *variable_data = (const char *) (cmd + 1);') + i = 1 for p in func.variable_params: out('{0} = ({1} *) variable_data;'.format( p.name, p.get_base_type_string())) @@ -199,11 +204,13 @@ class PrintCode(gl_XML.gl_print_base): out('if (cmd->{0}_null)'.format(p.name)) with indent(): out('{0} = NULL;'.format(p.name)) - out('else') - with indent(): - out('variable_data += {0};'.format(p.size_string(False))) - else: + if i < len(func.variable_params): + out('else') + with indent(): + out('variable_data += {0};'.format(p.size_string(False))) + elif i < len(func.variable_params): out('variable_data += {0};'.format(p.size_string(False))) + i += 1 self.print_sync_call(func) out('}') |