diff options
author | Marek Olšák <[email protected]> | 2020-02-19 19:41:25 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-06 01:06:14 +0000 |
commit | 358d923c8b40e71738cb3a3fb0413260361bec9b (patch) | |
tree | 2db95c93a6ee99ca24e0aa3f31fd3b318b84954a /src/mapi | |
parent | d00f36ac25b25402c4d81a0229a703a1b84fc40c (diff) |
glthread: handle complex pointer parameters and support GL functions with strings
The python changes add a local variable that computes the parameter size
only once.
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/ARB_blend_func_extended.xml | 2 | ||||
-rw-r--r-- | src/mapi/glapi/gen/ARB_gl_spirv.xml | 6 | ||||
-rw-r--r-- | src/mapi/glapi/gen/GL3x.xml | 2 | ||||
-rw-r--r-- | src/mapi/glapi/gen/gl_API.xml | 2 | ||||
-rw-r--r-- | src/mapi/glapi/gen/gl_marshal.py | 23 |
5 files changed, 17 insertions, 18 deletions
diff --git a/src/mapi/glapi/gen/ARB_blend_func_extended.xml b/src/mapi/glapi/gen/ARB_blend_func_extended.xml index 10d85a76621..9b66fa2eea7 100644 --- a/src/mapi/glapi/gen/ARB_blend_func_extended.xml +++ b/src/mapi/glapi/gen/ARB_blend_func_extended.xml @@ -12,7 +12,7 @@ <param name="program" type="GLuint"/> <param name="colorNumber" type="GLuint"/> <param name="index" type="GLuint"/> - <param name="name" type="const GLchar *"/> + <param name="name" type="const GLchar *" count="(strlen(name) + 1)"/> </function> <function name="GetFragDataIndex"> diff --git a/src/mapi/glapi/gen/ARB_gl_spirv.xml b/src/mapi/glapi/gen/ARB_gl_spirv.xml index 0dd615480f7..a963b001e61 100644 --- a/src/mapi/glapi/gen/ARB_gl_spirv.xml +++ b/src/mapi/glapi/gen/ARB_gl_spirv.xml @@ -10,10 +10,10 @@ <function name="SpecializeShaderARB"> <param name="shader" type="GLuint"/> - <param name="pEntryPoint" type="const GLchar *"/> + <param name="pEntryPoint" type="const GLchar *" count="(strlen(pEntryPoint) + 1)"/> <param name="numSpecializationConstants" type="GLuint"/> - <param name="pConstantIndex" type="const GLuint *"/> - <param name="pConstantValue" type="const GLuint *"/> + <param name="pConstantIndex" type="const GLuint *" count="numSpecializationConstants"/> + <param name="pConstantValue" type="const GLuint *" count="numSpecializationConstants"/> </function> </category> diff --git a/src/mapi/glapi/gen/GL3x.xml b/src/mapi/glapi/gen/GL3x.xml index cd3987e0ceb..3ffc1667607 100644 --- a/src/mapi/glapi/gen/GL3x.xml +++ b/src/mapi/glapi/gen/GL3x.xml @@ -203,7 +203,7 @@ <function name="BindFragDataLocation" no_error="true"> <param name="program" type="GLuint"/> <param name="colorNumber" type="GLuint"/> - <param name="name" type="const GLchar *"/> + <param name="name" type="const GLchar *" count="(strlen(name) + 1)"/> </function> <function name="BeginTransformFeedback" es2="3.0" no_error="true"> diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 2bec492f7d1..a33e82ad53d 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -5304,7 +5304,7 @@ <function name="BindAttribLocation" es2="2.0" no_error="true"> <param name="program" type="GLuint"/> <param name="index" type="GLuint"/> - <param name="name" type="const GLchar *"/> + <param name="name" type="const GLchar *" count="(strlen(name) + 1)"/> <glx ignore="true"/> </function> diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py index a6826251ca7..f21d0f65ff8 100644 --- a/src/mapi/glapi/gen/gl_marshal.py +++ b/src/mapi/glapi/gen/gl_marshal.py @@ -119,18 +119,14 @@ class PrintCode(gl_XML.gl_print_base): out('cmd->{0}_null = !{0};'.format(p.name)) out('if (!cmd->{0}_null) {{'.format(p.name)) with indent(): - out(('memcpy(variable_data, {0}, {1});').format( - p.name, p.size_string(False))) + out(('memcpy(variable_data, {0}, {0}_size);').format(p.name)) if i < len(func.variable_params): - out('variable_data += {0};'.format( - p.size_string(False))) + out('variable_data += {0}_size;'.format(p.name)) out('}') else: - out(('memcpy(variable_data, {0}, {1});').format( - p.name, p.size_string(False))) + out(('memcpy(variable_data, {0}, {0}_size);').format(p.name)) if i < len(func.variable_params): - out('variable_data += {0};'.format( - p.size_string(False))) + out('variable_data += {0}_size;'.format(p.name)) i += 1 if not func.fixed_params and not func.variable_params: @@ -221,7 +217,7 @@ class PrintCode(gl_XML.gl_print_base): # get to the validation in Mesa core. for p in func.parameters: if p.is_variable_length(): - out('if (unlikely({0} < 0)) {{'.format(p.size_string())) + out('if (unlikely({0}_size < 0)) {{'.format(p.name)) with indent(): out('goto fallback_to_sync;') out('}') @@ -237,13 +233,16 @@ class PrintCode(gl_XML.gl_print_base): out('{') with indent(): out('GET_CURRENT_CONTEXT(ctx);') + for p in func.variable_params: + out('int {0}_size = {1};'.format(p.name, p.size_string())) + struct = 'struct marshal_cmd_{0}'.format(func.name) size_terms = ['sizeof({0})'.format(struct)] for p in func.variable_params: - size = p.size_string() if p.img_null_flag: - size = '({0} ? {1} : 0)'.format(p.name, size) - size_terms.append(size) + 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)) |