[Piglit] [PATCH 3/3] glsl-es-3.00: Verify that no statment is allowed before the first case in a switch

Chad Versace chad.versace at linux.intel.com
Tue Nov 20 12:32:36 PST 2012


On 11/16/2012 04:08 PM, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
> 
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  tests/all.tests                                    |  7 +++++++
>  .../compiler/no-statement-before-first-case.vert   | 24 ++++++++++++++++++++++
>  2 files changed, 31 insertions(+)
>  create mode 100644 tests/spec/glsl-es-3.00/compiler/no-statement-before-first-case.vert
> 
> diff --git a/tests/all.tests b/tests/all.tests
> index 8f0d2c5..75d7cbb 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -825,6 +825,13 @@ for stage in ['vs', 'fs']:
>  		spec['glsl-1.40/execution/texelFetch/' + stage + '-texelFetch-' + sampler] = concurrent_test('texelFetch 140 ' + stage + ' ' + sampler)
>  		spec['glsl-1.40/execution/texelFetchOffset/' + stage + '-' + sampler] = concurrent_test('texelFetch offset 140 ' + stage + ' ' + sampler)
>  
> +# Group spec/glsl-es-3.00
> +spec['glsl-es-3.00'] = Group()
> +import_glsl_parser_tests(spec['glsl-es-3.00'],
> +			 os.path.join(testsDir, 'spec', 'glsl-es-3.00'),
> +			 ['compiler'])
> +
> +
>  # Group AMD_conservative_depth
>  spec['AMD_conservative_depth'] = Group()
>  import_glsl_parser_tests(spec['AMD_conservative_depth'],
> diff --git a/tests/spec/glsl-es-3.00/compiler/no-statement-before-first-case.vert b/tests/spec/glsl-es-3.00/compiler/no-statement-before-first-case.vert
> new file mode 100644
> index 0000000..737fda3
> --- /dev/null
> +++ b/tests/spec/glsl-es-3.00/compiler/no-statement-before-first-case.vert
> @@ -0,0 +1,24 @@
> +#version 300 es
> +
> +/* [config]
> + * expect_result: fail
> + * glsl_version: 3.00
> + * [end config]
> + *
> + * Page 80 of the OpenGL ES Shading Language 3.00 spec says:
> + *
> + *     "No statements are allowed in a switch statement before the first case
> + *     statement."
> + */
> +
> +uniform int x;
> +
> +void main()
> +{
> +  switch (x) {
> +    gl_Position = vec4(0.);
> +  default:
> +    gl_Position = vec4(1.);
> +    break;
> +  }
> +}

Ha! My eyes instinctively expect a 'break' at the end of the
non-case.

Reviewed-by: Chad Versace <chad.versace at linux.intel.com>



More information about the Piglit mailing list