[Piglit] [PATCH 2/3] tests/all.py: Make MSAA_SAMPLE_COUNTS contain str() instead of int()
Vinson Lee
vlee at freedesktop.org
Wed Dec 2 19:59:55 PST 2015
On Wed, Dec 2, 2015 at 2:36 PM, <baker.dylan.c at gmail.com> wrote:
> From: Dylan Baker <baker.dylan.c at gmail.com>
>
> In every case MSAA_SAMPLES_COUNTS are converted to str() anyway, (either
> explicitly by calling str(), or implicitly by str.format(). This is
> often done with a pattern like: (str(x) for x in MSAA_SAMPLE_COUNTS).
>
> This is just a waste of time when the values could be strings from the
> start.
>
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
> tests/all.py | 61 ++++++++++++++++++++++++++++++------------------------------
> 1 file changed, 30 insertions(+), 31 deletions(-)
>
> diff --git a/tests/all.py b/tests/all.py
> index 03da7cd..9f1d0e9 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -61,9 +61,9 @@ def add_fbo_depthstencil_tests(group, format, num_samples):
> prefix = 'fbo-'
> create_test = PiglitGLTest
>
> - if num_samples > 1:
> - suffix = ' samples=' + str(num_samples)
> - psamples = '-samples=' + str(num_samples)
> + if int(num_samples) > 1:
> + suffix = ' samples=' + num_samples
> + psamples = '-samples=' + num_samples
> else:
> suffix = ''
> psamples = ''
> @@ -251,7 +251,7 @@ for dirpath, _, filenames in os.walk(_basedir):
> ['asmparsertest', type_, os.path.join(dirpath, filename)])
>
> # List of all of the MSAA sample counts we wish to test
> -MSAA_SAMPLE_COUNTS = (2, 4, 6, 8, 16, 32)
> +MSAA_SAMPLE_COUNTS = ('2', '4', '6', '8', '16', '32')
>
> with profile.group_manager(GleanTest, 'glean') as g:
> g('basic')
> @@ -980,7 +980,7 @@ with profile.group_manager(
> for format in color_formats:
> g(['teximage-colors', format], run_concurrent=False)
>
> - for num_samples in (0, ) + MSAA_SAMPLE_COUNTS:
> + for num_samples in ('0',) + MSAA_SAMPLE_COUNTS:
> add_fbo_depthstencil_tests(
> grouptools.join('spec', '!opengl 1.1'), 'default_fb', num_samples)
>
> @@ -1436,7 +1436,7 @@ for stage in ['vs', 'gs', 'fs']:
>
> for type in ('i', 'u', ''):
> for sampler in ('sampler2DMS', 'sampler2DMSArray'):
> - for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> + for sample_count in MSAA_SAMPLE_COUNTS:
> stype = '{}{}'.format(type, sampler)
> profile.test_list[grouptools.join(
> 'spec', 'arb_shader_texture_image_samples',
> @@ -1750,7 +1750,7 @@ with profile.group_manager(
> g(['texelFetch', 'fs', 'sampler2DMSArray', '4', '98x129x1-98x129x9'])
> g(['arb_texture_multisample-texstate'])
> g(['arb_texture_multisample-errors'])
> - for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> + for sample_count in MSAA_SAMPLE_COUNTS:
> g(['arb_texture_multisample-texelfetch', sample_count])
> g(['arb_texture_multisample-sample-mask'])
> g(['arb_texture_multisample-sample-mask-value'])
> @@ -1769,7 +1769,7 @@ with profile.group_manager(
> grouptools.join('spec', 'ARB_texture_multisample',
> 'fb-completeness')) as g:
>
> - for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> + for sample_count in MSAA_SAMPLE_COUNTS:
> # fb-completeness
> g(['arb_texture_multisample-fb-completeness', sample_count],
> sample_count)
> @@ -1780,7 +1780,7 @@ with profile.group_manager(
>
> stages = ['vs', 'gs', 'fs']
> for sampler, stage, sample_count in itertools.product(
> - samplers_atm, stages, (str(x) for x in MSAA_SAMPLE_COUNTS)):
> + samplers_atm, stages, MSAA_SAMPLE_COUNTS):
> g(['texelFetch', stage, sampler, sample_count],
> '{}-{}-{}'.format(sample_count, stage, sampler))
>
> @@ -1789,7 +1789,7 @@ with profile.group_manager(
> grouptools.join('spec', 'ARB_texture_multisample',
> 'sample-position')) as g:
> # sample positions
> - for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> + for sample_count in MSAA_SAMPLE_COUNTS:
> g(['arb_texture_multisample-sample-position', sample_count],
> sample_count)
>
> @@ -2209,20 +2209,20 @@ with profile.group_manager(
> grouptools.join('spec', 'ARB_sample_shading')) as g:
> g(['arb_sample_shading-api'], run_concurrent=False)
>
> - for num_samples in (0,) + MSAA_SAMPLE_COUNTS:
> - g(['arb_sample_shading-builtin-gl-num-samples', str(num_samples)],
> + for num_samples in ('0',) + MSAA_SAMPLE_COUNTS:
> + g(['arb_sample_shading-builtin-gl-num-samples', num_samples],
> 'builtin-gl-num-samples {0}'.format(num_samples),
> run_concurrent=False)
> - g(['arb_sample_shading-builtin-gl-sample-id', str(num_samples)],
> + g(['arb_sample_shading-builtin-gl-sample-id', num_samples],
> 'builtin-gl-sample-id {}'.format(num_samples), run_concurrent=False)
> - g(['arb_sample_shading-builtin-gl-sample-mask', str(num_samples)],
> + g(['arb_sample_shading-builtin-gl-sample-mask', num_samples],
> 'builtin-gl-sample-mask {}'.format(num_samples),
> run_concurrent=False)
> - g(['arb_sample_shading-builtin-gl-sample-position', str(num_samples)],
> + g(['arb_sample_shading-builtin-gl-sample-position', num_samples],
> 'builtin-gl-sample-position {}'.format(num_samples),
> run_concurrent=False)
>
> - for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> + for sample_count in MSAA_SAMPLE_COUNTS:
> g(['arb_sample_shading-interpolate-at-sample-position', sample_count],
> 'interpolate-at-sample-position {}'.format(sample_count),
> run_concurrent=False)
> @@ -2230,9 +2230,9 @@ with profile.group_manager(
> 'ignore-centroid-qualifier {}'.format(sample_count),
> run_concurrent=False)
>
> - for num_samples in (0,) + MSAA_SAMPLE_COUNTS:
> + for num_samples in ('0',) + MSAA_SAMPLE_COUNTS:
> g(['arb_sample_shading-builtin-gl-sample-mask-simple',
> - str(num_samples)],
> + num_samples],
> 'builtin-gl-sample-mask-simple {}'.format(num_samples))
>
> g(['arb_sample_shading-builtin-gl-sample-mask-mrt-alpha'])
> @@ -2746,12 +2746,12 @@ with profile.group_manager(
> g(['ext_framebuffer_multisample_blit_scaled-negative-blit-scaled'],
> 'negative-blit-scaled')
>
> - for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> + for sample_count in MSAA_SAMPLE_COUNTS:
> g(['ext_framebuffer_multisample_blit_scaled-blit-scaled',
> sample_count],
> 'blit-scaled samples={}'.format(sample_count))
>
> - for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> + for sample_count in MSAA_SAMPLE_COUNTS:
> g(['ext_framebuffer_multisample_blit_scaled-blit-scaled',
> sample_count, 'array'],
> 'blit-scaled samples={} with GL_TEXTURE_2D_MULTISAMPLE_ARRAY'.format(sample_count))
> @@ -2788,13 +2788,13 @@ with profile.group_manager(
> 'alpha-blending slow_cc')
> g(['ext_framebuffer_multisample-fast-clear'], 'fast-clear')
>
> - for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> + for sample_count in MSAA_SAMPLE_COUNTS:
> g(['ext_framebuffer_multisample-alpha-blending-after-rendering',
> sample_count],
> 'alpha-blending-after-rendering {}'.format(sample_count))
>
> - for num_samples in ('all_samples', ) + MSAA_SAMPLE_COUNTS:
> - g(['ext_framebuffer_multisample-formats', str(num_samples)],
> + for num_samples in ('all_samples',) + MSAA_SAMPLE_COUNTS:
> + g(['ext_framebuffer_multisample-formats', num_samples],
> 'formats {}'.format(num_samples))
>
> for test_type in ('color', 'srgb', 'stencil_draw', 'stencil_resolve',
> @@ -2803,28 +2803,27 @@ with profile.group_manager(
> if test_type in ('color', 'srgb'):
> sensible_options.append('linear')
> for options in power_set(sensible_options):
> - g(['ext_framebuffer_multisample-accuracy', str(num_samples),
> + g(['ext_framebuffer_multisample-accuracy', num_samples,
> test_type] + options,
> - ' '.join(['accuracy', str(num_samples), test_type] +
> - options))
> + ' '.join(['accuracy', num_samples, test_type] + options))
>
> # Note: the interpolation tests also check for sensible behaviour with
> # non-multisampled framebuffers, so go ahead and test them with
> # num_samples==0 as well.
> - for num_samples in (0,) + MSAA_SAMPLE_COUNTS:
> + for num_samples in ('0',) + MSAA_SAMPLE_COUNTS:
> g(['ext_framebuffer_multisample-blit-multiple-render-targets',
> - str(num_samples)],
> + num_samples],
> 'blit-multiple-render-targets {}'.format(num_samples))
>
> for test_type in ('non-centroid-disabled', 'centroid-disabled',
> 'centroid-edges', 'non-centroid-deriv',
> 'non-centroid-deriv-disabled', 'centroid-deriv',
> 'centroid-deriv-disabled'):
> - g(['ext_framebuffer_multisample-interpolation', str(num_samples),
> + g(['ext_framebuffer_multisample-interpolation', num_samples,
> test_type],
> 'interpolation {} {}'.format(num_samples, test_type))
>
> - for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> + for sample_count in MSAA_SAMPLE_COUNTS:
> g(['ext_framebuffer_multisample-turn-on-off', sample_count],
> 'turn-on-off {}'.format(sample_count), run_concurrent=False)
>
> @@ -4550,7 +4549,7 @@ with profile.group_manager(
> with profile.group_manager(
> PiglitGLTest,
> grouptools.join('spec', 'EXT_shader_samples_identical')) as g:
> - for sample_count in (str(x) for x in MSAA_SAMPLE_COUNTS):
> + for sample_count in MSAA_SAMPLE_COUNTS:
> g(['ext_shader_samples_identical', sample_count])
>
> if platform.system() is 'Windows':
> --
> 2.6.2
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
Reviewed-by: Vinson Lee <vlee at freedesktop.org>
More information about the Piglit
mailing list