From: José Fonseca Date: Wed, 31 Mar 2010 12:27:08 +0000 (+0100) Subject: python/tests: Test all existing gallium formats. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6de8f86ab4cf5d6af3023714b77a3555f2ad58a0;p=mesa.git python/tests: Test all existing gallium formats. --- diff --git a/progs/gallium/python/tests/base.py b/progs/gallium/python/tests/base.py index 3699af81451..6296eb58504 100755 --- a/progs/gallium/python/tests/base.py +++ b/progs/gallium/python/tests/base.py @@ -43,18 +43,9 @@ from gallium import * # Enumerate all pixel formats formats = {} for name, value in globals().items(): - if name.startswith("PIPE_FORMAT_") and isinstance(value, int): + if name.startswith("PIPE_FORMAT_") and isinstance(value, int) and name != "PIPE_FORMAT_COUNT": formats[value] = name -def is_depth_stencil_format(format): - # FIXME: make and use binding to util_format_is_depth_or_stencil - return format in ( - PIPE_FORMAT_Z32_UNORM, - PIPE_FORMAT_S8Z24_UNORM, - PIPE_FORMAT_X8Z24_UNORM, - PIPE_FORMAT_Z16_UNORM, - ) - def make_image(width, height, rgba): import Image outimage = Image.new( diff --git a/progs/gallium/python/tests/texture_sample.py b/progs/gallium/python/tests/texture_sample.py index 9b5c15ad1da..63686463fa5 100755 --- a/progs/gallium/python/tests/texture_sample.py +++ b/progs/gallium/python/tests/texture_sample.py @@ -559,32 +559,9 @@ def main(): PIPE_TEXTURE_3D, ] - color_formats = [ - PIPE_FORMAT_B8G8R8A8_UNORM, - PIPE_FORMAT_B8G8R8X8_UNORM, - #PIPE_FORMAT_B8G8R8A8_SRGB, - PIPE_FORMAT_B5G6R5_UNORM, - PIPE_FORMAT_B5G5R5A1_UNORM, - PIPE_FORMAT_B4G4R4A4_UNORM, - PIPE_FORMAT_A8_UNORM, - PIPE_FORMAT_L8_UNORM, - PIPE_FORMAT_UYVY, - PIPE_FORMAT_DXT1_RGB, - #PIPE_FORMAT_DXT1_RGBA, - #PIPE_FORMAT_DXT3_RGBA, - #PIPE_FORMAT_DXT5_RGBA, - ] - - depth_formats = [ - PIPE_FORMAT_Z32_UNORM, - PIPE_FORMAT_S8Z24_UNORM, - PIPE_FORMAT_X8Z24_UNORM, - PIPE_FORMAT_Z16_UNORM, - ] - - sizes = [64, 32, 16, 8, 4, 2, 1] + #sizes = [64, 32, 16, 8, 4, 2, 1] #sizes = [1020, 508, 252, 62, 30, 14, 6, 3] - #sizes = [64] + sizes = [64] #sizes = [63] faces = [ @@ -598,58 +575,61 @@ def main(): ctx = dev.context_create() - for format in color_formats: - for target in targets: + for format in formats.iterkeys(): + if format == PIPE_FORMAT_NONE: + continue + if not util_format_is_depth_or_stencil(format): + for target in targets: + for size in sizes: + if target == PIPE_TEXTURE_3D: + depth = size + else: + depth = 1 + for face in faces: + if target != PIPE_TEXTURE_CUBE and face: + continue + levels = lods(size) + for last_level in range(levels): + for level in range(0, last_level + 1): + zslice = 0 + while zslice < depth >> level: + test = TextureColorSampleTest( + dev = dev, + ctx = ctx, + target = target, + format = format, + width = size, + height = size, + depth = depth, + last_level = last_level, + face = face, + level = level, + zslice = zslice, + ) + suite.add_test(test) + zslice = (zslice + 1)*2 - 1 + else: + target = PIPE_TEXTURE_2D + depth = 1 + face = 0 + last_level = 0 + level = 0 + zslice = 0 for size in sizes: - if target == PIPE_TEXTURE_3D: - depth = size - else: - depth = 1 - for face in faces: - if target != PIPE_TEXTURE_CUBE and face: - continue - levels = lods(size) - for last_level in range(levels): - for level in range(0, last_level + 1): - zslice = 0 - while zslice < depth >> level: - test = TextureColorSampleTest( - dev = dev, - ctx = ctx, - target = target, - format = format, - width = size, - height = size, - depth = depth, - last_level = last_level, - face = face, - level = level, - zslice = zslice, - ) - 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, - ctx = ctx, - target = target, - format = format, - width = size, - height = size, - depth = depth, - last_level = last_level, - face = face, - level = level, - zslice = zslice, - ) - suite.add_test(test) + test = TextureDepthSampleTest( + dev = dev, + ctx = ctx, + 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()