]> git.cworth.org Git - apitrace/blobdiff - glstate.py
Implement context sharing.
[apitrace] / glstate.py
index 2ab7f288c863e2be61fc3ff0dda052602ffb7f01..db0152feea92fc42a8826551f2ab58cc54528274 100644 (file)
@@ -410,11 +410,6 @@ writeTextureImage(JSONWriter &json, GLenum target, GLint level)
         
         GLubyte *pixels = new GLubyte[depth*width*height*4];
 
-        if (target == GL_TEXTURE_CUBE_MAP) {
-            // TODO: dump other faces too
-            target = GL_TEXTURE_CUBE_MAP_POSITIVE_X;
-        }
-        
         glGetTexImage(target, level, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
 
         json.beginMember("__data__");
@@ -433,14 +428,14 @@ writeTextureImage(JSONWriter &json, GLenum target, GLint level)
 static inline void
 writeDrawBufferImage(JSONWriter &json, GLenum format)
 {
-    GLint width  = glretrace::window_width;
-    GLint height = glretrace::window_height;
-
     GLint channels = __gl_format_channels(format);
 
-    if (!width || !height) {
+    if (!glretrace::drawable) {
         json.writeNull();
     } else {
+        GLint width  = glretrace::drawable->width;
+        GLint height = glretrace::drawable->height;
+
         json.beginObject();
 
         // Tell the GUI this is no ordinary object, but an image
@@ -638,7 +633,13 @@ writeDrawBuffers(JSONWriter &json, GLboolean writeDepth, GLboolean writeStencil)
         print '            break;'
         print '        }'
         print
-        print '        writeTextureImage(json, target, level);'
+        print '        if (target == GL_TEXTURE_CUBE_MAP) {'
+        print '            for (int face = 0; face < 6; ++face) {'
+        print '                writeTextureImage(json, GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level);'
+        print '            }'
+        print '        } else {'
+        print '            writeTextureImage(json, target, level);'
+        print '        }'
         print
         print '        ++level;'
         print '    } while(true);'