]> git.cworth.org Git - apitrace/blobdiff - gltrace.py
Remove trace_copier.
[apitrace] / gltrace.py
index 29df475d8cc37f5f137796ed88b3d6917760b45a..d2babe490acd7ad99e122f0f7f9f90859ebdb54c 100644 (file)
@@ -473,11 +473,21 @@ class GlTracer(Tracer):
             print '    }'
         
         # Emit a fake memcpy on buffer uploads
-        if function.name in ('glUnmapBuffer', 'glUnmapBufferARB', ):
+        if function.name in ('glUnmapBuffer', 'glUnmapBufferARB', 'glUnmapBufferOES'):
             print '    struct buffer_mapping *mapping = get_buffer_mapping(target);'
             print '    if (mapping && mapping->write && !mapping->explicit_flush) {'
             self.emit_memcpy('mapping->map', 'mapping->map', 'mapping->length')
             print '    }'
+        if function.name == 'glUnmapNamedBufferEXT':
+            print '    GLint access = 0;'
+            print '    glGetNamedBufferParameterivEXT(buffer, GL_BUFFER_ACCESS, &access);'
+            print '    if ((access & GL_MAP_WRITE_BIT) & !(access & GL_MAP_FLUSH_EXPLICIT_BIT)) {'
+            print '        GLvoid *map = NULL;'
+            print '        glGetNamedBufferPointervEXT(buffer, GL_BUFFER_MAP_POINTER, &map);'
+            print '        GLint length = 0;'
+            print '        glGetNamedBufferParameterivEXT(buffer, GL_BUFFER_MAP_LENGTH, &length);'
+            self.emit_memcpy('map', 'map', 'length')
+            print '    }'
         if function.name in ('glFlushMappedBufferRange', 'glFlushMappedBufferRangeAPPLE'):
             print '    struct buffer_mapping *mapping = get_buffer_mapping(target);'
             print '    if (mapping) {'
@@ -487,7 +497,12 @@ class GlTracer(Tracer):
             print '        //assert(offset + length <= mapping->length);'
             self.emit_memcpy('(char *)mapping->map + offset', '(const char *)mapping->map + offset', 'length')
             print '    }'
-        # FIXME: glFlushMappedNamedBufferRangeEXT
+        if function.name == 'glFlushMappedNamedBufferRangeEXT':
+            print '    GLvoid *map = NULL;'
+            print '    glGetNamedBufferPointervEXT(buffer, GL_BUFFER_MAP_POINTER, &map);'
+            print '    if (map) {'
+            self.emit_memcpy('(char *)map + offset', '(const char *)map + offset', 'length')
+            print '    }'
 
         # Don't leave vertex attrib locations to chance.  Instead emit fake
         # glBindAttribLocation calls to ensure that the same locations will be
@@ -566,21 +581,6 @@ class GlTracer(Tracer):
 
         Tracer.invokeFunction(self, function)
 
-    def emit_memcpy(self, dest, src, length):
-        print '        unsigned __call = trace::localWriter.beginEnter(&trace::memcpy_sig);'
-        print '        trace::localWriter.beginArg(0);'
-        print '        trace::localWriter.writeOpaque(%s);' % dest
-        print '        trace::localWriter.endArg();'
-        print '        trace::localWriter.beginArg(1);'
-        print '        trace::localWriter.writeBlob(%s, %s);' % (src, length)
-        print '        trace::localWriter.endArg();'
-        print '        trace::localWriter.beginArg(2);'
-        print '        trace::localWriter.writeUInt(%s);' % length
-        print '        trace::localWriter.endArg();'
-        print '        trace::localWriter.endEnter();'
-        print '        trace::localWriter.beginLeave(__call);'
-        print '        trace::localWriter.endLeave();'
-       
     buffer_targets = [
         'ARRAY_BUFFER',
         'ELEMENT_ARRAY_BUFFER',
@@ -599,7 +599,7 @@ class GlTracer(Tracer):
         Tracer.wrapRet(self, function, instance)
 
             
-        if function.name in ('glMapBuffer', 'glMapBufferARB'):
+        if function.name in ('glMapBuffer', 'glMapBufferARB', 'glMapBufferOES'):
             print '    struct buffer_mapping *mapping = get_buffer_mapping(target);'
             print '    if (mapping) {'
             print '        mapping->map = %s;' % (instance)