summaryrefslogtreecommitdiffstats
path: root/src/mapi
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-03-29 16:30:59 +1100
committerTimothy Arceri <[email protected]>2017-03-30 08:23:00 +1100
commit16debc652a4f054a9c74e9229b98dec1746d292b (patch)
tree6dd25b9366f3eb502a3c2db339641fa3582a97c7 /src/mapi
parent18f4c93b02cbebd45e51c700368a3833ab0f5e95 (diff)
mesa/glthread: fallback to sync if count validation fails
The old code would sync and then throw a cryptic error message. There is no need for a custom error, we can just fallback to the real function and have it do proper validation. Fixes piglit test: glsl-uniform-out-of-bounds Which was returning the wrong error code. Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mapi')
-rw-r--r--src/mapi/glapi/gen/gl_marshal.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py
index 9639f9cdb9e..51475e17adf 100644
--- a/src/mapi/glapi/gen/gl_marshal.py
+++ b/src/mapi/glapi/gen/gl_marshal.py
@@ -204,7 +204,7 @@ class PrintCode(gl_XML.gl_print_base):
self.print_sync_call(func)
out('}')
- def validate_count_or_return(self, func):
+ def validate_count_or_fallback(self, func):
# Check that any counts for variable-length arguments might be < 0, in
# which case the command alloc or the memcpy would blow up before we
# get to the validation in Mesa core.
@@ -212,12 +212,14 @@ class PrintCode(gl_XML.gl_print_base):
if p.is_variable_length():
out('if (unlikely({0} < 0)) {{'.format(p.size_string()))
with indent():
- out('_mesa_glthread_finish(ctx);')
- out('_mesa_error(ctx, GL_INVALID_VALUE, "{0}({1} < 0)");'.format(func.name, p.size_string()))
- out('return;')
+ out('goto fallback_to_sync;')
out('}')
+ return True
+ return False
+
def print_async_marshal(self, func):
+ need_fallback_sync = False
out('static void GLAPIENTRY')
out('_mesa_marshal_{0}({1})'.format(
func.name, func.get_parameter_string()))
@@ -236,7 +238,7 @@ class PrintCode(gl_XML.gl_print_base):
out('debug_print_marshal("{0}");'.format(func.name))
- self.validate_count_or_return(func)
+ need_fallback_sync = self.validate_count_or_fallback(func)
if func.marshal_fail:
out('if ({0}) {{'.format(func.marshal_fail))
@@ -250,11 +252,15 @@ class PrintCode(gl_XML.gl_print_base):
out('if (cmd_size <= MARSHAL_MAX_CMD_SIZE) {')
with indent():
self.print_async_dispatch(func)
- out('} else {')
- with indent():
- self.print_sync_dispatch(func)
+ out('return;')
out('}')
+ out('')
+ if need_fallback_sync:
+ out('fallback_to_sync:')
+ with indent():
+ self.print_sync_dispatch(func)
+
out('}')
def print_async_body(self, func):