]> git.cworth.org Git - apitrace/blobdiff - gltrace.py
Bring some of the virtual-memory-regions
[apitrace] / gltrace.py
index f935e29913b6b1b8a64ea516dfec267011cff96c..e5be57d3644f4aaacafabc72b4525f872b734ed1 100644 (file)
 """GL tracing generator."""
 
 
-import stdapi
-import glapi
-import glparams
-from glxapi import glxapi
+import specs.stdapi as stdapi
+import specs.glapi as glapi
+import specs.glparams as glparams
+from specs.glxapi import glxapi
 from trace import Tracer, dump_instance
 
 
@@ -244,9 +244,6 @@ class GlTracer(Tracer):
         print '}'
         print
 
-        # Generate memcpy's signature
-        self.trace_function_decl(glapi.memcpy)
-
         # Generate a helper function to determine whether a parameter name
         # refers to a symbolic value or not
         print 'static bool'
@@ -330,12 +327,15 @@ class GlTracer(Tracer):
         'glMultiDrawArrays',
         'glMultiDrawElements',
         'glDrawArraysInstanced',
+        "glDrawArraysInstancedBaseInstance",
         'glDrawElementsInstanced',
         'glDrawArraysInstancedARB',
         'glDrawElementsInstancedARB',
         'glDrawElementsBaseVertex',
         'glDrawRangeElementsBaseVertex',
         'glDrawElementsInstancedBaseVertex',
+        "glDrawElementsInstancedBaseInstance",
+        "glDrawElementsInstancedBaseVertexBaseInstance",
         'glMultiDrawElementsBaseVertex',
         'glDrawArraysIndirect',
         'glDrawElementsIndirect',
@@ -439,14 +439,13 @@ class GlTracer(Tracer):
             self.emit_memcpy('mapping->map', 'mapping->map', 'mapping->length')
             print '    }'
         if function.name in ('glFlushMappedBufferRange', 'glFlushMappedBufferRangeAPPLE'):
-            # TODO: avoid copying [0, offset] bytes
             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('mapping->map', 'mapping->map', 'offset + length')
+            self.emit_memcpy('(char *)mapping->map + offset', '(const char *)mapping->map + offset', 'length')
             print '    }'
         # FIXME: glFlushMappedNamedBufferRangeEXT
 
@@ -459,7 +458,7 @@ class GlTracer(Tracer):
             Tracer.dispatch_function(self, function)
             print '    GLint active_attributes = 0;'
             print '    __glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &active_attributes);'
-            print '    for (GLuint attrib = 0; attrib < active_attributes; ++attrib) {'
+            print '    for (GLint attrib = 0; attrib < active_attributes; ++attrib) {'
             print '        GLint size = 0;'
             print '        GLenum type = 0;'
             print '        GLchar name[256];'
@@ -477,7 +476,7 @@ class GlTracer(Tracer):
             Tracer.dispatch_function(self, function)
             print '    GLint active_attributes = 0;'
             print '    __glGetObjectParameterivARB(programObj, GL_OBJECT_ACTIVE_ATTRIBUTES_ARB, &active_attributes);'
-            print '    for (GLuint attrib = 0; attrib < active_attributes; ++attrib) {'
+            print '    for (GLint attrib = 0; attrib < active_attributes; ++attrib) {'
             print '        GLint size = 0;'
             print '        GLenum type = 0;'
             print '        GLcharARB name[256];'
@@ -528,7 +527,7 @@ class GlTracer(Tracer):
         Tracer.dispatch_function(self, function)
 
     def emit_memcpy(self, dest, src, length):
-        print '        unsigned __call = Trace::localWriter.beginEnter(&__memcpy_sig);'
+        print '        unsigned __call = Trace::localWriter.beginEnter(&Trace::memcpy_sig);'
         print '        Trace::localWriter.beginArg(0);'
         print '        Trace::localWriter.writeOpaque(%s);' % dest
         print '        Trace::localWriter.endArg();'
@@ -665,7 +664,7 @@ class GlTracer(Tracer):
         # Several GL state functions take GLenum symbolic names as
         # integer/floats; so dump the symbolic name whenever possible
         if function.name.startswith('gl') \
-           and arg.type in (glapi.GLint, glapi.GLfloat) \
+           and arg.type in (glapi.GLint, glapi.GLfloat, glapi.GLdouble) \
            and arg.name == 'param':
             assert arg.index > 0
             assert function.args[arg.index - 1].name == 'pname'
@@ -820,7 +819,7 @@ class GlTracer(Tracer):
             print '    GLint max_texture_coords = 0;'
             print '    __glGetIntegerv(GL_MAX_TEXTURE_COORDS, &max_texture_coords);'
             print '    for (GLint unit = 0; unit < max_texture_coords; ++unit) {'
-            print '        GLenum texture = GL_TEXTURE0 + unit;'
+            print '        GLint texture = GL_TEXTURE0 + unit;'
             print '        __glClientActiveTexture(texture);'
 
     def array_trace_prolog(self, api, uppercase_name):