]> git.cworth.org Git - apitrace/commitdiff
Support GL_ARB_sync.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Mon, 11 Apr 2011 08:10:55 +0000 (09:10 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Mon, 11 Apr 2011 08:21:20 +0000 (09:21 +0100)
glapi.py
glsize.hpp
retrace.py

index a6c81ca17de3fd8ac6212fa979f66d6b030ee0a6..f4314c1c9964bcc356542d2385eff084bf351b20 100644 (file)
--- a/glapi.py
+++ b/glapi.py
@@ -1097,13 +1097,13 @@ glapi.add_functions([
     GlFunction(Void, "glProvokingVertex", [(GLenum, "mode")]),
 
     # GL_ARB_sync
-    #GlFunction(GLsync, "glFenceSync", [(GLenum, "condition"), (GLbitfield, "flags")]),
-    #GlFunction(GLboolean, "glIsSync", [(GLsync, "sync")]),
-    #GlFunction(Void, "glDeleteSync", [(GLsync, "sync")]),
-    #GlFunction(GLenum, "glClientWaitSync", [(GLsync, "sync"), (GLbitfield, "flags"), (GLuint64, "timeout")]),
-    #GlFunction(Void, "glWaitSync", [(GLsync, "sync"), (GLbitfield, "flags"), (GLuint64, "timeout")]),
-    #GlFunction(Void, "glGetInteger64v", [(GLenum, "pname"), Out(OpaqueArray(GLint64, "__glGetInteger64v_size(pname)"), "params")], sideeffects=False),
-    #GlFunction(Void, "glGetSynciv", [(GLsync, "sync"), (GLenum, "pname"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(Array(GLint, "length"), "values")], sideeffects=False),
+    GlFunction(GLsync, "glFenceSync", [(GLenum, "condition"), (GLbitfield, "flags")]),
+    GlFunction(GLboolean, "glIsSync", [(GLsync, "sync")]),
+    GlFunction(Void, "glDeleteSync", [(GLsync, "sync")]),
+    GlFunction(GLenum, "glClientWaitSync", [(GLsync, "sync"), (GLbitfield, "flags"), (GLuint64, "timeout")]),
+    GlFunction(Void, "glWaitSync", [(GLsync, "sync"), (GLbitfield, "flags"), (GLuint64, "timeout")]),
+    GlFunction(Void, "glGetInteger64v", [(GLenum, "pname"), Out(OpaqueArray(GLint64, "__glGetInteger64v_size(pname)"), "params")], sideeffects=False),
+    GlFunction(Void, "glGetSynciv", [(GLsync, "sync"), (GLenum, "pname"), (GLsizei, "bufSize"), Out(Pointer(GLsizei), "length"), Out(Array(GLint, "(length ? *length : bufSize)"), "values")], sideeffects=False),
 
     # GL_ARB_texture_multisample
     GlFunction(Void, "glTexImage2DMultisample", [(GLenum, "target"), (GLsizei, "samples"), (GLint, "internalformat"), (GLsizei, "width"), (GLsizei, "height"), (GLboolean, "fixedsamplelocations")]),
index 9fb02faa6ccdd49fb81566192abfc4e6267d5122..90e1c39fe439585aaab40f75bea9fefc2a41d337 100644 (file)
@@ -960,6 +960,8 @@ __glGetBooleanv_size(GLenum pname)
 
 #define __glGetIntegerv_size __glGetBooleanv_size
 
+#define __glGetInteger64v_size __glGetBooleanv_size
+
 #define __glGetLightfv_size __glLightfv_size
 
 #define __glGetLightiv_size __glLightfv_size
index 7fcae527222b3a038866a3882f45a4143ff07edd..3a6c0f9cebfe6bfc7e6705f245834183004e9553 100644 (file)
@@ -98,9 +98,11 @@ class ValueExtractor(stdapi.Visitor):
             print '    }'
 
     def visit_handle(self, handle, lvalue, rvalue):
-        self.visit(handle.type, lvalue, handle_entry(handle, rvalue));
+        OpaqueValueExtractor().visit(handle.type, lvalue, rvalue);
+        new_lvalue = handle_entry(handle, lvalue)
         print '    if (retrace::verbosity >= 2)'
-        print '        std::cout << "%s " << static_cast<%s>(%s) << " <- " << %s << "\\n";' % (handle.name, handle.type, rvalue, lvalue)
+        print '        std::cout << "%s " << size_t(%s) << " <- " << size_t(%s) << "\\n";' % (handle.name, lvalue, new_lvalue)
+        print '    %s = %s;' % (lvalue, new_lvalue)
     
     def visit_blob(self, blob, lvalue, rvalue):
         print '    %s = static_cast<%s>((%s).blob());' % (lvalue, blob, rvalue)
@@ -109,6 +111,15 @@ class ValueExtractor(stdapi.Visitor):
         print '    %s = (%s)((%s).string());' % (lvalue, string.expr, rvalue)
 
 
+class OpaqueValueExtractor(ValueExtractor):
+    '''Value extractor that also understands opaque values.
+
+    Normally opaque values can't be retraced, unless they are being extracted
+    in the context of handles.'''
+
+    def visit_opaque(self, opaque, lvalue, rvalue):
+        print '    %s = static_cast<%s>((%s).blob());' % (lvalue, opaque, rvalue)
+
 
 class ValueWrapper(stdapi.Visitor):
 
@@ -144,10 +155,11 @@ class ValueWrapper(stdapi.Visitor):
         finally:
             print '    }'
     
-
     def visit_handle(self, handle, lvalue, rvalue):
+        print '    %s __orig_result;' % handle.type
+        OpaqueValueExtractor().visit(handle.type, '__orig_result', rvalue);
         if handle.range is None:
-            rvalue = "static_cast<%s>(%s)" % (handle.type, rvalue)
+            rvalue = "__orig_result"
             entry = handle_entry(handle, rvalue) 
             print "    %s = %s;" % (entry, lvalue)
             print '    if (retrace::verbosity >= 2)'
@@ -155,7 +167,7 @@ class ValueWrapper(stdapi.Visitor):
         else:
             i = '__h' + handle.id
             lvalue = "%s + %s" % (lvalue, i)
-            rvalue = "static_cast<%s>(%s) + %s" % (handle.type, rvalue, i)
+            rvalue = "__orig_result + %s" % (i,)
             entry = handle_entry(handle, rvalue) 
             print '    for({handle.type} {i} = 0; {i} < {handle.range}; ++{i}) {{'.format(**locals())
             print '        {entry} = {lvalue};'.format(**locals())