From fa15d3316662095ca4b14a29a16bed71b6a60b2a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 25 Nov 2010 20:22:39 +0000 Subject: [PATCH] Bail on pointer arrays. --- glretrace.py | 10 ++++++++++ retrace.py | 22 ++++++++++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/glretrace.py b/glretrace.py index 792bdd8..549a14e 100644 --- a/glretrace.py +++ b/glretrace.py @@ -40,6 +40,16 @@ class GlRetracer(Retracer): "glBufferRegionEnabled", ] + def call_function(self, function): + if function.name in ("glDrawArrays", "glDrawElements", "glDrawRangeElements", "glMultiDrawElements"): + print ' GLint __array_buffer = 0;' + print ' glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &__array_buffer);' + print ' if (!__array_buffer) {' + self.fail_function(function) + print ' }' + + Retracer.call_function(self, function) + def extract_arg(self, function, arg, arg_type, lvalue, rvalue): if function.name in [ "glColorPointer", diff --git a/retrace.py b/retrace.py index 6dfd0a2..0c14855 100644 --- a/retrace.py +++ b/retrace.py @@ -173,14 +173,8 @@ class Retracer: success = False print ' %s = 0; // FIXME' % arg.name if not success: - print ' std::cerr << "warning: unsupported call %s\\n";' % function.name - print ' return;' - arg_names = ", ".join([arg.name for arg in function.args]) - if function.type is not stdapi.Void: - print ' %s __result;' % (function.type) - print ' __result = %s(%s);' % (function.name, arg_names) - else: - print ' %s(%s);' % (function.name, arg_names) + self.fail_function(function) + self.call_function(function) for arg in function.args: if arg.output: arg_type = ConstRemover().visit(arg.type) @@ -200,9 +194,21 @@ class Retracer: print '}' print + def fail_function(self, function): + print ' std::cerr << "warning: unsupported call %s\\n";' % function.name + print ' return;' + def extract_arg(self, function, arg, arg_type, lvalue, rvalue): ValueExtractor().visit(arg_type, lvalue, rvalue) + def call_function(self, function): + arg_names = ", ".join([arg.name for arg in function.args]) + if function.type is not stdapi.Void: + print ' %s __result;' % (function.type) + print ' __result = %s(%s);' % (function.name, arg_names) + else: + print ' %s(%s);' % (function.name, arg_names) + def filter_function(self, function): return True -- 2.45.2