python/tests: Speed up the tests by reusing the same pipe context.
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 31 Mar 2010 12:12:08 +0000 (13:12 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 31 Mar 2010 12:12:24 +0000 (13:12 +0100)
progs/gallium/python/tests/surface_copy.py
progs/gallium/python/tests/texture_transfer.py

index 37d210d904e6e3e9f0108af063dfbd87548acc52..9364fd1110f507bc0e8cc4bacd9c4ff6e9f425e6 100755 (executable)
@@ -56,6 +56,7 @@ class TextureTest(TestCase):
 
     def test(self):
         dev = self.dev
+        ctx = self.ctx
         
         target = self.target
         format = self.format
@@ -103,8 +104,6 @@ class TextureTest(TestCase):
         size = util_format_get_nblocksy(format, h) * stride
         src_raw = os.urandom(size)
 
-        ctx = self.dev.context_create()
-    
         ctx.surface_write_raw(src_surface, 0, 0, w, h, src_raw, stride)
 
         ctx.surface_copy(dst_surface, 0, 0, 
@@ -119,6 +118,7 @@ class TextureTest(TestCase):
 
 def main():
     dev = Device()
+    ctx = dev.context_create()
     suite = TestSuite()
     
     targets = [
@@ -178,6 +178,7 @@ def main():
                             while zslice < depth >> level:
                                 test = TextureTest(
                                     dev = dev,
+                                    ctx = ctx,
                                     target = target,
                                     format = format, 
                                     width = size,
index 3595e9c614bd482b511b5adf61a76776858d7e4d..97a28e01a45b4692e38431da6ac9dd14907ef5b7 100755 (executable)
@@ -59,6 +59,7 @@ class TextureTest(TestCase):
 
     def test(self):
         dev = self.dev
+        ctx = self.ctx
         
         target = self.target
         format = self.format
@@ -91,8 +92,6 @@ class TextureTest(TestCase):
 
         in_raw = os.urandom(size)
 
-        ctx = self.dev.context_create()
-
         ctx.surface_write_raw(surface, 0, 0, surface.width, surface.height, in_raw, stride)
 
         out_raw = ctx.surface_read_raw(surface, 0, 0, surface.width, surface.height)
@@ -103,6 +102,7 @@ class TextureTest(TestCase):
 
 def main():
     dev = Device()
+    ctx = dev.context_create()
     suite = TestSuite()
     
     targets = [
@@ -162,6 +162,7 @@ def main():
                             while zslice < depth >> level:
                                 test = TextureTest(
                                     dev = dev,
+                                    ctx = ctx,
                                     target = target,
                                     format = format, 
                                     width = size,