]> git.cworth.org Git - apitrace-tests/blobdiff - driver.py
Search images in more framebuffer attachments.
[apitrace-tests] / driver.py
index 27eef97074db66b0358ba78045b063abeb352baa..871ef097ec63cc7a1f115d40f23800aa69f72760 100755 (executable)
--- a/driver.py
+++ b/driver.py
@@ -131,7 +131,8 @@ class TraceChecker:
             if mo:
                 self.call_no = int(mo.group(1))
                 function_name = mo.group(2)
-                if function_name.find('SwapBuffers') != -1:
+                if function_name.find('SwapBuffers') != -1 or \
+                   line.find('kCGLPFADoubleBuffer') != -1:
                     swapbuffers += 1
                 if function_name in ('glFlush', 'glFinish'):
                     flushes += 1
@@ -342,17 +343,28 @@ class TestCase:
 
     def getImage(self, callNo):
         state = self.getState(callNo)
-        framebuffer = state['framebuffer']
         if self.doubleBuffer:
-            imageObj = framebuffer['GL_BACK']
+            attachments = ['GL_BACK', 'GL_BACK_LEFT', 'GL_BACK_RIGHT', 'GL_COLOR_ATTACHMENT0']
         else:
-            imageObj = framebuffer['GL_FRONT']
+            attachments = ['GL_FRONT', 'GL_FRONT_LEFT', 'GL_FRONT_RIGHT', 'GL_COLOR_ATTACHMENT0']
+        imageObj = self.getFramebufferAttachment(state, attachments)
         data = imageObj['__data__']
         stream = StringIO(base64.b64decode(data))
         im = Image.open(stream)
         im.save('test.png')
         return im
 
+    def getFramebufferAttachment(self, state, attachments):
+        framebufferObj = state['framebuffer']
+        for attachment in attachments:
+            try:
+                attachmentObj = framebufferObj[attachment]
+            except KeyError:
+                pass
+            else:
+                return attachmentObj
+        raise Exception("no attachment found")
+
     def getState(self, callNo):
         try:
             state = self.stateCache[callNo]