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 <tarceri@itsqueeze.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3948>
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user