def retrace_function(self, function):
Retracer.retrace_function(self, function)
+ array_pointer_function_names = set((
+ "glVertexPointer",
+ "glNormalPointer",
+ "glColorPointer",
+ "glIndexPointer",
+ "glTexCoordPointer",
+ "glEdgeFlagPointer",
+ "glFogCoordPointer",
+ "glSecondaryColorPointer",
+
+ "glInterleavedArrays",
+
+ #"glVertexPointerEXT",
+ #"glNormalPointerEXT",
+ #"glColorPointerEXT",
+ #"glIndexPointerEXT",
+ #"glTexCoordPointerEXT",
+ #"glEdgeFlagPointerEXT",
+ #"glFogCoordPointerEXT",
+ #"glSecondaryColorPointerEXT",
+
+ #"glVertexAttribPointer",
+ #"glVertexAttribPointerARB",
+ #"glVertexAttribPointerNV",
+ #"glVertexAttribLPointer",
+
+ #"glMatrixIndexPointerARB",
+ ))
+
draw_array_function_names = set([
"glDrawArrays",
"glDrawArraysEXT",
#"glMultiModeDrawElementsIBM",
])
- def call_function(self, function):
- print ' if (Trace::Parser::version < 1) {'
-
- if function.name in self.draw_array_function_names or \
- function.name in self.draw_elements_function_names:
- print ' GLint __array_buffer = 0;'
- print ' glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &__array_buffer);'
- print ' if (!__array_buffer) {'
- self.fail_function(function)
+ def retrace_function_body(self, function):
+ is_array_pointer = function.name in self.array_pointer_function_names
+ is_draw_array = function.name in self.draw_array_function_names
+ is_draw_elements = function.name in self.draw_elements_function_names
+
+ if is_array_pointer or is_draw_array or is_draw_elements:
+ print ' if (Trace::Parser::version < 1) {'
+
+ if is_array_pointer or is_draw_array:
+ print ' GLint __array_buffer = 0;'
+ print ' glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &__array_buffer);'
+ print ' if (!__array_buffer) {'
+ self.fail_function(function)
+ print ' }'
+
+ if is_draw_elements:
+ print ' GLint __element_array_buffer = 0;'
+ print ' glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &__element_array_buffer);'
+ print ' if (!__element_array_buffer) {'
+ self.fail_function(function)
+ print ' }'
+
print ' }'
- if function.name in self.draw_elements_function_names:
- print ' GLint __element_array_buffer = 0;'
- print ' glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &__element_array_buffer);'
- print ' if (!__element_array_buffer) {'
- self.fail_function(function)
- print ' }'
-
- print ' }'
+ Retracer.retrace_function_body(self, function)
+ def call_function(self, function):
if function.name == "glViewport":
print ' if (x + width > __window_width) {'
print ' __window_width = x + width;'
def retrace_function(self, function):
print 'static void retrace_%s(Trace::Call &call) {' % function.name
+ self.retrace_function_body(function)
+ print '}'
+ print
+
+ def retrace_function_body(self, function):
success = True
for arg in function.args:
arg_type = ConstRemover().visit(arg.type)
ValueWrapper().visit(function.type, lvalue, rvalue)
except NotImplementedError:
print ' // FIXME: result'
- print '}'
- print
def fail_function(self, function):
print ' if (verbosity >= 0)'