"glMultiModeDrawElementsIBM",
])
+ draw_indirect_function_names = set([
+ "glDrawArraysIndirect",
+ "glDrawElementsIndirect",
+ ])
+
misc_draw_function_names = set([
"glClear",
"glEnd",
def call_function(self, function):
+ # Infer the drawable size from GL calls
if function.name == "glViewport":
- print ' GLint draw_framebuffer = 0;'
- print ' glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &draw_framebuffer);'
- print ' if (draw_framebuffer == 0) {'
- print ' if (glretrace::drawable) {'
- print ' int drawable_width = x + width;'
- print ' int drawable_height = y + height;'
- print ' if (drawable_width > (int)glretrace::drawable->width ||'
- print ' drawable_height > (int)glretrace::drawable->height) {'
- print ' glretrace::drawable->resize(drawable_width, drawable_height);'
- print ' if (!glretrace::drawable->visible) {'
- print ' glretrace::drawable->show();'
- print ' }'
- print ' glScissor(0, 0, drawable_width, drawable_height);'
- print ' }'
- print ' }'
- print ' }'
+ print ' glretrace::updateDrawable(x + width, y + height);'
+ if function.name in ('glBlitFramebuffer', 'glBlitFramebufferEXT'):
+ # Some applications do all their rendering in a framebuffer, and
+ # then just blit to the drawable without ever calling glViewport.
+ print ' glretrace::updateDrawable(std::max(dstX0, dstX1), std::max(dstY0, dstY1));'
if function.name == "glEnd":
print ' glretrace::insideGlBeginEnd = false;'
if function.name in ('glGetAttribLocation', 'glGetAttribLocationARB'):
print r' GLint __orig_result = call.ret->toSInt();'
print r' if (__result != __orig_result) {'
- print r' std::cerr << call.no << ": warning vertex attrib location mismatch " << __orig_result << " -> " << __result << "\n";'
+ print r' std::cerr << call.no << ": warning: vertex attrib location mismatch " << __orig_result << " -> " << __result << "\n";'
print r' }'
if function.name in ('glCheckFramebufferStatus', 'glCheckFramebufferStatusEXT', 'glCheckNamedFramebufferStatusEXT'):
print r' GLint __orig_result = call.ret->toSInt();'
print r' if (__orig_result == GL_FRAMEBUFFER_COMPLETE &&'
print r' __result != GL_FRAMEBUFFER_COMPLETE) {'
- print r' std::cerr << call.no << ": incomplete framebuffer (" << __result << ")\n";'
+ print r' std::cerr << call.no << ": warning: incomplete framebuffer (" << glstate::enumToString(__result) << ")\n";'
print r' }'
print ' }'
print ' %s = static_cast<%s>(%s.toPointer(true));' % (lvalue, arg_type, rvalue)
return
- if function.name in self.draw_elements_function_names and arg.name == 'indices':
+ if function.name in self.draw_elements_function_names and arg.name == 'indices' or\
+ function.name in self.draw_indirect_function_names and arg.name == 'indirect':
self.extract_opaque_arg(function, arg, arg_type, lvalue, rvalue)
return
#include "glproc.hpp"
#include "glretrace.hpp"
+#include "glstate.hpp"
'''