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

2017-07-05 Thread Timothy Arceri

Thanks!

Reviewed-by: Timothy Arceri 

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 
---
  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 0..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 0..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); }


___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


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

2017-07-05 Thread Ilia Mirkin
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 
---
 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 0..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 0..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); }
-- 
2.13.0

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit