[Piglit] [PATCH 2/9] all.py: Use the same MSAA_SAMPLE_COUNTS idiom almost everywhere

Dylan Baker baker.dylan.c at gmail.com
Fri Nov 20 14:13:41 PST 2015


On Thu, Nov 19, 2015 at 08:00:08PM -0800, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
> 
> I could not figure out how to get
> 
>     for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> 
> to work with the (0,) + MSAA_SAMPLE_COUNTS places.

I think it actually makes sense to just convert MSAA_SAMPLE_COUNTS to
strings instead of ints. I just looked through all.py and can't find a
single use of MSAA_SAMPLE_COUNTS as an int, it's cast to str in every
case.

That however, could be a follow up patch, and I can send that.

In either case, I mentioned how to handle the (0,) + MSSA_SMAPLE_COUNTS
on the previous patch.

with or without changes:
Reviewed-by: Dylan Baker <baker.dylan.c at gmail.com>

> 
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Cc: Dylan Baker <baker.dylan.c at gmail.com>
> ---
>  tests/all.py | 83 +++++++++++++++++++++++++++++-------------------------------
>  1 file changed, 40 insertions(+), 43 deletions(-)
> 
> diff --git a/tests/all.py b/tests/all.py
> index 578bcae..1038e07 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -115,9 +115,9 @@ def add_msaa_visual_plain_tests(adder, args, **kwargs):
>      assert isinstance(args, list)
>  
>      adder(args, **kwargs)
> -    for num_samples in MSAA_SAMPLE_COUNTS:
> -        adder(args + ['-samples={}'.format(num_samples)],
> -              ' '.join(args + ['samples={}'.format(num_samples)]),
> +    for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> +        adder(args + ['-samples={}'.format(sample_count)],
> +              ' '.join(args + ['samples={}'.format(sample_count)]),
>                **kwargs)
>  
>  
> @@ -138,10 +138,10 @@ def add_fbo_formats_tests(adder, extension, suffix=''):
>  
>  
>  def add_msaa_formats_tests(adder, extension):
> -    for num_samples in MSAA_SAMPLE_COUNTS:
> -        adder(['ext_framebuffer_multisample-formats', str(num_samples),
> +    for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> +        adder(['ext_framebuffer_multisample-formats', sample_count,
>                 extension],
> -              'multisample-formats {} {}'.format(num_samples, extension))
> +              'multisample-formats {} {}'.format(sample_count, extension))
>      adder(['ext_framebuffer_multisample-fast-clear', extension],
>            'multisample-fast-clear {}'.format(extension))
>  
> @@ -2191,13 +2191,12 @@ with profile.group_manager(
>            'builtin-gl-sample-position {}'.format(num_samples),
>            run_concurrent=False)
>  
> -    for num_samples in MSAA_SAMPLE_COUNTS:
> -        g(['arb_sample_shading-interpolate-at-sample-position',
> -           str(num_samples)],
> -          'interpolate-at-sample-position {}'.format(num_samples),
> +    for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> +        g(['arb_sample_shading-interpolate-at-sample-position', sample_count],
> +          'interpolate-at-sample-position {}'.format(sample_count),
>            run_concurrent=False)
> -        g(['arb_sample_shading-ignore-centroid-qualifier', str(num_samples)],
> -          'ignore-centroid-qualifier {}'.format(num_samples),
> +        g(['arb_sample_shading-ignore-centroid-qualifier', sample_count],
> +          'ignore-centroid-qualifier {}'.format(sample_count),
>            run_concurrent=False)
>  
>      for num_samples in (0,) + MSAA_SAMPLE_COUNTS:
> @@ -2717,15 +2716,15 @@ with profile.group_manager(
>      g(['ext_framebuffer_multisample_blit_scaled-negative-blit-scaled'],
>        'negative-blit-scaled')
>  
> -    for num_samples in MSAA_SAMPLE_COUNTS:
> +    for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
>          g(['ext_framebuffer_multisample_blit_scaled-blit-scaled',
> -           str(num_samples)],
> -          'blit-scaled samples={}'.format(num_samples))
> +           sample_count],
> +          'blit-scaled samples={}'.format(sample_count))
>  
> -    for num_samples in MSAA_SAMPLE_COUNTS:
> +    for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
>          g(['ext_framebuffer_multisample_blit_scaled-blit-scaled',
> -           str(num_samples), 'array'],
> -          'blit-scaled samples={} with GL_TEXTURE_2D_MULTISAMPLE_ARRAY'.format(num_samples))
> +           sample_count, 'array'],
> +          'blit-scaled samples={} with GL_TEXTURE_2D_MULTISAMPLE_ARRAY'.format(sample_count))
>  
>  with profile.group_manager(
>          PiglitGLTest,
> @@ -2797,9 +2796,9 @@ with profile.group_manager(
>                 test_type],
>                'interpolation {} {}'.format(num_samples, test_type))
>  
> -    for num_samples in MSAA_SAMPLE_COUNTS:
> -        g(['ext_framebuffer_multisample-turn-on-off', str(num_samples)],
> -          'turn-on-off {}'.format(num_samples), run_concurrent=False)
> +    for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> +        g(['ext_framebuffer_multisample-turn-on-off', sample_count],
> +          'turn-on-off {}'.format(sample_count), run_concurrent=False)
>  
>          for buffer_type in ('color', 'depth', 'stencil'):
>              if buffer_type == 'color':
> @@ -2808,31 +2807,31 @@ with profile.group_manager(
>                  sensible_options = []
>  
>              for options in power_set(sensible_options):
> -                g(['ext_framebuffer_multisample-upsample', str(num_samples),
> +                g(['ext_framebuffer_multisample-upsample', sample_count,
>                     buffer_type] + options,
>                    'upsample {} {}'.format(
> -                      num_samples, ' '.join([buffer_type] + options)))
> +                      sample_count, ' '.join([buffer_type] + options)))
>                  g(['ext_framebuffer_multisample-multisample-blit',
> -                   str(num_samples), buffer_type] + options,
> +                   sample_count, buffer_type] + options,
>                    'multisample-blit {}'.format(
> -                      ' '.join([str(num_samples), buffer_type] + options)))
> +                      ' '.join([sample_count, buffer_type] + options)))
>  
>              for blit_type in ('msaa', 'upsample', 'downsample'):
>                  g(['ext_framebuffer_multisample-unaligned-blit',
> -                   str(num_samples), buffer_type, blit_type],
> +                   sample_count, buffer_type, blit_type],
>                    'unaligned-blit {} {} {}'.format(
> -                      num_samples, buffer_type, blit_type))
> +                      sample_count, buffer_type, blit_type))
>  
>          for test_mode in ('inverted', 'non-inverted'):
> -            g(['ext_framebuffer_multisample-sample-coverage', str(num_samples),
> +            g(['ext_framebuffer_multisample-sample-coverage', sample_count,
>                 test_mode],
> -              'sample-coverage {} {}'.format(num_samples, test_mode))
> +              'sample-coverage {} {}'.format(sample_count, test_mode))
>  
>          for buffer_type in ('color', 'depth'):
>              g(['ext_framebuffer_multisample-sample-alpha-to-coverage',
> -               str(num_samples), buffer_type],
> +               sample_count, buffer_type],
>                'sample-alpha-to-coverage {} {}'.format(
> -                  num_samples, buffer_type))
> +                  sample_count, buffer_type))
>  
>          for test in ['line-smooth', 'point-smooth', 'polygon-smooth',
>                       'sample-alpha-to-one',
> @@ -2848,31 +2847,29 @@ with profile.group_manager(
>                       'alpha-to-one-single-sample-buffer',
>                       'bitmap', 'polygon-stipple']:
>              g(['ext_framebuffer_multisample-{}'.format(test),
> -               str(num_samples)],
> -              '{} {}'.format(test, num_samples))
> +               sample_count],
> +              '{} {}'.format(test, sample_count))
>  
>          for blit_type in ('msaa', 'upsample', 'downsample', 'normal'):
>              g(['ext_framebuffer_multisample-clip-and-scissor-blit',
> -               str(num_samples), blit_type],
> -              'clip-and-scissor-blit {} {}'.format(str(num_samples),
> -                                                   blit_type))
> +               sample_count, blit_type],
> +              'clip-and-scissor-blit {} {}'.format(sample_count, blit_type))
>  
>          for flip_direction in ('x', 'y'):
> -            g(['ext_framebuffer_multisample-blit-flipped', str(num_samples),
> +            g(['ext_framebuffer_multisample-blit-flipped', sample_count,
>                 flip_direction],
> -              'blit-flipped {} {}'.format(str(num_samples), flip_direction))
> +              'blit-flipped {} {}'.format(sample_count, flip_direction))
>  
>          for buffer_type in ('color', 'depth', 'stencil'):
> -            g(['ext_framebuffer_multisample-clear', str(num_samples),
> -               buffer_type],
> -              'clear {} {}'.format(str(num_samples), buffer_type))
> +            g(['ext_framebuffer_multisample-clear', sample_count, buffer_type],
> +              'clear {} {}'.format(sample_count, buffer_type))
>  
>          for test_type in ('depth', 'depth-computed', 'stencil'):
>              for buffer_config in ('combined', 'separate', 'single'):
> -                g(['ext_framebuffer_multisample-no-color', str(num_samples),
> +                g(['ext_framebuffer_multisample-no-color', sample_count,
>                     test_type, buffer_config],
>                    'no-color {} {} {}'.format(
> -                      num_samples, test_type, buffer_config))
> +                      sample_count, test_type, buffer_config))
>  
>  with profile.group_manager(
>          PiglitGLTest,
> -- 
> 2.1.0
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20151120/bb339938/attachment-0001.sig>


More information about the Piglit mailing list