]> git.cworth.org Git - apitrace/commitdiff
Cleanup glFlushMappedBufferRange/glFlushMappedBufferRangeAPPLE
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Wed, 29 Feb 2012 18:08:48 +0000 (18:08 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Thu, 8 Mar 2012 09:20:02 +0000 (10:20 +0100)
Rely on GL_BUFFER_MAP_POINTER instead, as it is more reliable in face of recursive mappings.

gltrace.py

index c17c01af4037f4a72925958b8a9f651f40269957..86fbf085f8ec7e7333bc4ed121ff54504ce48a25 100644 (file)
@@ -478,14 +478,17 @@ class GlTracer(Tracer):
             self.emit_memcpy('map', 'map', 'length')
             print '        }'
             print '    }'
-        if function.name in ('glFlushMappedBufferRange', 'glFlushMappedBufferRangeAPPLE'):
-            print '    struct buffer_mapping *mapping = get_buffer_mapping(target);'
-            print '    if (mapping) {'
-            if function.name.endswith('APPLE'):
-                 print '        GLsizeiptr length = size;'
-                 print '        mapping->explicit_flush = true;'
-            print '        //assert(offset + length <= mapping->length);'
-            self.emit_memcpy('(char *)mapping->map + offset', '(const char *)mapping->map + offset', 'length')
+        if function.name == 'glFlushMappedBufferRange':
+            print '    GLvoid *map = NULL;'
+            print '    __glGetBufferPointerv(target, GL_BUFFER_MAP_POINTER, &map);'
+            print '    if (map && length > 0) {'
+            self.emit_memcpy('(char *)map + offset', '(const char *)map + offset', 'length')
+            print '    }'
+        if function.name == 'glFlushMappedBufferRangeAPPLE':
+            print '    GLvoid *map = NULL;'
+            print '    __glGetBufferPointerv(target, GL_BUFFER_MAP_POINTER, &map);'
+            print '    if (map && size > 0) {'
+            self.emit_memcpy('(char *)map + offset', '(const char *)map + offset', 'size')
             print '    }'
         if function.name == 'glFlushMappedNamedBufferRangeEXT':
             print '    GLvoid *map = NULL;'