summaryrefslogtreecommitdiff
path: root/retrace/glretrace.py
diff options
context:
space:
mode:
Diffstat (limited to 'retrace/glretrace.py')
-rw-r--r--retrace/glretrace.py57
1 files changed, 36 insertions, 21 deletions
diff --git a/retrace/glretrace.py b/retrace/glretrace.py
index 0cb703e1..b916c1ad 100644
--- a/retrace/glretrace.py
+++ b/retrace/glretrace.py
@@ -43,9 +43,11 @@ class GlRetracer(Retracer):
# Ensure pack function have side effects
abort = False
for function in api.getAllFunctions():
- if not function.sideeffects and self.pack_function_regex.match(function.name):
- sys.stderr.write('error: function %s must have sideeffects\n' % function.name)
- abort = True
+ if not function.sideeffects:
+ if self.pack_function_regex.match(function.name) or \
+ function.name.startswith('glGetQueryObject'):
+ sys.stderr.write('error: function %s must have sideeffects\n' % function.name)
+ abort = True
if abort:
sys.exit(1)
@@ -125,6 +127,24 @@ class GlRetracer(Retracer):
is_draw_indirect = self.draw_indirect_function_regex.match(function.name) is not None
is_misc_draw = self.misc_draw_function_regex.match(function.name)
+ if function.name.startswith('gl') and not function.name.startswith('glX'):
+ # The Windows OpenGL runtime will skip calls when there's no
+ # context bound to the current context, but this might cause
+ # crashes on other systems, particularly with NVIDIA Linux drivers.
+ print r' glretrace::Context *currentContext = glretrace::getCurrentContext();'
+ print r' if (!currentContext) {'
+ print r' if (retrace::debug) {'
+ print r' retrace::warning(call) << "no current context\n";'
+ print r' }'
+ print r'#ifndef _WIN32'
+ print r' return;'
+ print r'#endif'
+ print r' }'
+
+ print r' if (retrace::markers) {'
+ print r' glretrace::insertCallMarker(call, currentContext);'
+ print r' }'
+
# For backwards compatibility with old traces where non VBO drawing was supported
if (is_array_pointer or is_draw_arrays or is_draw_elements) and not is_draw_indirect:
print ' if (retrace::parser->getVersion() < 1) {'
@@ -153,6 +173,16 @@ class GlRetracer(Retracer):
print ' return;'
print ' }'
+ # When no query buffer object is bound, glGetQueryObject is a no-op.
+ if function.name.startswith('glGetQueryObject'):
+ print r' GLint _query_buffer = 0;'
+ print r' if (currentContext->features().query_buffer_object) {'
+ print r' glGetIntegerv(GL_QUERY_BUFFER_BINDING, &_query_buffer);'
+ print r' }'
+ print r' if (!_query_buffer) {'
+ print r' return;'
+ print r' }'
+
# Pre-snapshots
if self.bind_framebuffer_function_regex.match(function.name):
print ' assert(call.flags & trace::CALL_FLAG_SWAP_RENDERTARGET);'
@@ -197,24 +227,6 @@ class GlRetracer(Retracer):
# then just blit to the drawable without ever calling glViewport.
print ' glretrace::updateDrawable(std::max(dstX0, dstX1), std::max(dstY0, dstY1));'
- if function.name.startswith('gl') and not function.name.startswith('glX'):
- # The Windows OpenGL runtime will skip calls when there's no
- # context bound to the current context, but this might cause
- # crashes on other systems, particularly with NVIDIA Linux drivers.
- print r' glretrace::Context *currentContext = glretrace::getCurrentContext();'
- print r' if (!currentContext) {'
- print r' if (retrace::debug) {'
- print r' retrace::warning(call) << "no current context\n";'
- print r' }'
- print r'#ifndef _WIN32'
- print r' return;'
- print r'#endif'
- print r' }'
-
- print r' if (retrace::markers) {'
- print r' glretrace::insertCallMarker(call, currentContext);'
- print r' }'
-
if function.name == "glEnd":
print r' if (currentContext) {'
print r' currentContext->insideBeginEnd = false;'
@@ -500,6 +512,9 @@ class GlRetracer(Retracer):
assert isinstance(arg_type, (stdapi.Pointer, stdapi.Array, stdapi.Blob, stdapi.Opaque))
print ' %s = static_cast<%s>((%s).toPointer());' % (lvalue, arg_type, rvalue)
return
+ if function.name.startswith('glGetQueryObject') and arg.output:
+ print ' %s = static_cast<%s>((%s).toPointer());' % (lvalue, arg_type, rvalue)
+ return
if (arg.type.depends(glapi.GLlocation) or \
arg.type.depends(glapi.GLsubroutine)) \