[Piglit] [PATCH] es3: add tests for verifying overloading behavior

Timothy Arceri tarceri at itsqueeze.com
Thu Jul 6 00:10:47 UTC 2017


Thanks!

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

On 06/07/17 10:05, Ilia Mirkin wrote:
> An existing bug in mesa made it so that overloads of any functions that
> might be builtins in any language version or extension would not be
> overridable in ESSL 3.00 shaders. This adds tests to ensure that
> builtins available in ESSL 3.00 are rejected properly, but builtins from
> future versions or non-enabled (or available) extensions are allowed to
> be specified.
> 
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>   tests/spec/glsl-es-3.00/compiler/overload-builtin.frag    | 14 ++++++++++++++
>   .../glsl-es-3.00/compiler/overload-future-builtin.frag    | 15 +++++++++++++++
>   2 files changed, 29 insertions(+)
>   create mode 100644 tests/spec/glsl-es-3.00/compiler/overload-builtin.frag
>   create mode 100644 tests/spec/glsl-es-3.00/compiler/overload-future-builtin.frag
> 
> diff --git a/tests/spec/glsl-es-3.00/compiler/overload-builtin.frag b/tests/spec/glsl-es-3.00/compiler/overload-builtin.frag
> new file mode 100644
> index 000000000..8ed837655
> --- /dev/null
> +++ b/tests/spec/glsl-es-3.00/compiler/overload-builtin.frag
> @@ -0,0 +1,14 @@
> +// [config]
> +// expect_result: fail
> +// glsl_version: 3.00
> +// [end config]
> +//
> +// Check that builtins may not be overloaded, even with different parameters.
> +//
> +// From GLSL ES 3.0 spec, chapter 6.1 "Function Definitions", page 71:
> +//
> +//     "A shader cannot redefine or overload built-in functions."
> +//
> +#version 300 es
> +
> +int sqrt(int x) { return x; }
> diff --git a/tests/spec/glsl-es-3.00/compiler/overload-future-builtin.frag b/tests/spec/glsl-es-3.00/compiler/overload-future-builtin.frag
> new file mode 100644
> index 000000000..a3b3ae1cf
> --- /dev/null
> +++ b/tests/spec/glsl-es-3.00/compiler/overload-future-builtin.frag
> @@ -0,0 +1,15 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 3.00
> +// [end config]
> +//
> +// Check that builtins that are not available in ESSL 3.00 may be defined
> +// or overloaded as needed.
> +//
> +#version 300 es
> +precision highp float;
> +
> +int bitfieldExtract(int x) { return x; }
> +int imageAtomicAdd(int x) { return x; }
> +void barrier() { }
> +uint packUnorm4x8(vec4 v) { return uint(v.x); }
> 


More information about the Piglit mailing list