python/tests: Cleanup texture_sample.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 15 Jun 2009 18:21:58 +0000 (19:21 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 15 Jun 2009 18:21:58 +0000 (19:21 +0100)
src/gallium/state_trackers/python/tests/texture_sample.py

index 06130ea1c9cec8bbc8eda93fee923b4120635029..c7b78abbbec4de163a24a25931260359d2832058 100755 (executable)
@@ -497,17 +497,13 @@ def main():
         PIPE_TEXTURE_3D,
     ]
     
-    formats = [
+    color_formats = [
         PIPE_FORMAT_A8R8G8B8_UNORM,
         PIPE_FORMAT_X8R8G8B8_UNORM,
         #PIPE_FORMAT_A8R8G8B8_SRGB,
         PIPE_FORMAT_R5G6B5_UNORM,
         PIPE_FORMAT_A1R5G5B5_UNORM,
         PIPE_FORMAT_A4R4G4B4_UNORM,
-        PIPE_FORMAT_Z32_UNORM,
-        PIPE_FORMAT_Z24S8_UNORM,
-        PIPE_FORMAT_Z24X8_UNORM,
-        PIPE_FORMAT_Z16_UNORM,
         PIPE_FORMAT_A8_UNORM,
         PIPE_FORMAT_L8_UNORM,
         PIPE_FORMAT_YCBCR,
@@ -517,6 +513,13 @@ def main():
         #PIPE_FORMAT_DXT5_RGBA,
     ]
     
+    depth_formats = [
+        PIPE_FORMAT_Z32_UNORM,
+        PIPE_FORMAT_Z24S8_UNORM,
+        PIPE_FORMAT_Z24X8_UNORM,
+        PIPE_FORMAT_Z16_UNORM,
+    ]
+    
     sizes = [64, 32, 16, 8, 4, 2, 1]
     #sizes = [1020, 508, 252, 62, 30, 14, 6, 3]
     #sizes = [64]
@@ -531,8 +534,8 @@ def main():
         PIPE_TEX_FACE_NEG_Z,
     ]
 
-    for target in targets:
-        for format in formats:
+    for format in color_formats:
+        for target in targets:
             for size in sizes:
                 if target == PIPE_TEXTURE_3D:
                     depth = size
@@ -546,17 +549,7 @@ def main():
                         for level in range(0, last_level + 1):
                             zslice = 0
                             while zslice < depth >> level:
-                                if format in (
-                                    PIPE_FORMAT_Z32_UNORM,
-                                    PIPE_FORMAT_Z24S8_UNORM,
-                                    PIPE_FORMAT_Z24X8_UNORM,
-                                    PIPE_FORMAT_Z16_UNORM,
-                                ):
-                                    klass = TextureDepthSampleTest
-                                else:
-                                    klass = TextureColorSampleTest
-
-                                test = klass(
+                                test = TextureColorSampleTest(
                                     dev = dev,
                                     target = target,
                                     format = format, 
@@ -570,6 +563,27 @@ def main():
                                 )
                                 suite.add_test(test)
                                 zslice = (zslice + 1)*2 - 1
+    for format in depth_formats:
+        target = PIPE_TEXTURE_2D
+        depth = 1
+        face = 0
+        last_level = 0
+        level = 0
+        zslice = 0
+        for size in sizes:
+            test = TextureDepthSampleTest(
+                dev = dev,
+                target = target,
+                format = format, 
+                width = size,
+                height = size,
+                depth = depth,
+                last_level = last_level,
+                face = face,
+                level = level,
+                zslice = zslice,
+            )
+            suite.add_test(test)
     suite.run()