[Piglit] [PATCH 07/11] mesa_shader_integer_functions: Clone arb_gpu_shader5 overload compiler tests
Ian Romanick
idr at freedesktop.org
Wed Jun 29 21:23:07 UTC 2016
From: Ian Romanick <ian.d.romanick at intel.com>
cd tests/spec/mesa_shader_integer_functions/compiler
cp ../../arb_gpu_shader5/compiler/overloads-*.vert
for i in overloads-*.vert; do
sed --in-place -e 's/1[.]50/1.30/g;s/150/130/g' \
-e 's/ARB_gpu_shader5/MESA_shader_integer_functions/g' \
$i
done
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
.../compiler/overloads-01.vert | 13 +++++++++++
.../compiler/overloads-02.vert | 14 ++++++++++++
.../compiler/overloads-03.vert | 14 ++++++++++++
.../compiler/overloads-04.vert | 14 ++++++++++++
.../compiler/overloads-05.vert | 24 +++++++++++++++++++++
.../compiler/overloads-06.vert | 25 ++++++++++++++++++++++
.../compiler/overloads-07.vert | 24 +++++++++++++++++++++
7 files changed, 128 insertions(+)
create mode 100644 tests/spec/mesa_shader_integer_functions/compiler/overloads-01.vert
create mode 100644 tests/spec/mesa_shader_integer_functions/compiler/overloads-02.vert
create mode 100644 tests/spec/mesa_shader_integer_functions/compiler/overloads-03.vert
create mode 100644 tests/spec/mesa_shader_integer_functions/compiler/overloads-04.vert
create mode 100644 tests/spec/mesa_shader_integer_functions/compiler/overloads-05.vert
create mode 100644 tests/spec/mesa_shader_integer_functions/compiler/overloads-06.vert
create mode 100644 tests/spec/mesa_shader_integer_functions/compiler/overloads-07.vert
diff --git a/tests/spec/mesa_shader_integer_functions/compiler/overloads-01.vert b/tests/spec/mesa_shader_integer_functions/compiler/overloads-01.vert
new file mode 100644
index 0000000..001d44e
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/compiler/overloads-01.vert
@@ -0,0 +1,13 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// require_extensions: GL_MESA_shader_integer_functions
+// [end config]
+
+// Test that overloads which differ only by return type are not allowed.
+
+#version 130
+#extension GL_MESA_shader_integer_functions : enable
+
+int foo(int x) { return 0; }
+float foo(int x) { return 0; } /* differs only by return type. */
diff --git a/tests/spec/mesa_shader_integer_functions/compiler/overloads-02.vert b/tests/spec/mesa_shader_integer_functions/compiler/overloads-02.vert
new file mode 100644
index 0000000..cb58d39
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/compiler/overloads-02.vert
@@ -0,0 +1,14 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// require_extensions: GL_MESA_shader_integer_functions
+// [end config]
+
+// If a function name is declared twice with the same parameter types,
+// then the return types _and all qualifiers_ must match.
+
+#version 130
+#extension GL_MESA_shader_integer_functions : enable
+
+void foo(int x) {}
+void foo(out int x) {}
diff --git a/tests/spec/mesa_shader_integer_functions/compiler/overloads-03.vert b/tests/spec/mesa_shader_integer_functions/compiler/overloads-03.vert
new file mode 100644
index 0000000..a3597b5
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/compiler/overloads-03.vert
@@ -0,0 +1,14 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// require_extensions: GL_MESA_shader_integer_functions
+// [end config]
+
+// If a function name is declared twice with the same parameter types,
+// then the return types _and all qualifiers_ must match.
+
+#version 130
+#extension GL_MESA_shader_integer_functions : enable
+
+void foo(int x) {}
+void foo(const int x) {} /* `const` is mismatched. */
diff --git a/tests/spec/mesa_shader_integer_functions/compiler/overloads-04.vert b/tests/spec/mesa_shader_integer_functions/compiler/overloads-04.vert
new file mode 100644
index 0000000..e0bad8b
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/compiler/overloads-04.vert
@@ -0,0 +1,14 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// require_extensions: GL_MESA_shader_integer_functions
+// [end config]
+
+// If a function name is declared twice with the same parameter types,
+// then the return types _and all qualifiers_ must match.
+
+#version 130
+#extension GL_MESA_shader_integer_functions : enable
+
+void foo(int x) {}
+void foo(precise int x) {} /* `precise` is mismatched. */
diff --git a/tests/spec/mesa_shader_integer_functions/compiler/overloads-05.vert b/tests/spec/mesa_shader_integer_functions/compiler/overloads-05.vert
new file mode 100644
index 0000000..446c6da
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/compiler/overloads-05.vert
@@ -0,0 +1,24 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// require_extensions: GL_MESA_shader_integer_functions
+// [end config]
+
+// Test overload resolution where all candidates require implicit
+// conversions. Under unextended GLSL 1.30, resolution is ambiguous,
+// since both functions require implicit conversions.
+
+#version 130
+#extension GL_MESA_shader_integer_functions : enable
+
+void foo(float x, int y, float z) {}
+void foo(float x, int y, int z) {} /* better for `z` */
+
+void bar()
+{
+ int a = 0;
+ int b = 1;
+ int c = 2;
+
+ foo(a, b, c);
+}
diff --git a/tests/spec/mesa_shader_integer_functions/compiler/overloads-06.vert b/tests/spec/mesa_shader_integer_functions/compiler/overloads-06.vert
new file mode 100644
index 0000000..28deab2
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/compiler/overloads-06.vert
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// require_extensions: GL_MESA_shader_integer_functions
+// [end config]
+
+// Test overload resolution where all candidates require implicit
+// conversions. Under unextended GLSL 1.30, resolution is ambiguous,
+// since both functions require implicit conversions. With MESA_shader_integer_functions,
+// this case is still ambiguous, since neither function is better than the other.
+
+#version 130
+#extension GL_MESA_shader_integer_functions : enable
+
+void foo(float x, int y, float z) {} /* better for `y` */
+void foo(float x, float y, int z) {} /* better for `z` */
+
+void bar()
+{
+ int a = 0;
+ int b = 1;
+ int c = 2;
+
+ foo(a, b, c);
+}
diff --git a/tests/spec/mesa_shader_integer_functions/compiler/overloads-07.vert b/tests/spec/mesa_shader_integer_functions/compiler/overloads-07.vert
new file mode 100644
index 0000000..7f198a2
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_functions/compiler/overloads-07.vert
@@ -0,0 +1,24 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// require_extensions: GL_MESA_shader_integer_functions
+// [end config]
+
+// Test overload resolution where all candidates require implicit
+// conversions. Under unextended GLSL 1.30, resolution is ambiguous,
+// since both functions require implicit conversions. With MESA_shader_integer_functions,
+// this case is still ambiguous, since int->float conversion is not
+// considered better or worse than int->uint conversion.
+
+#version 130
+#extension GL_MESA_shader_integer_functions : enable
+
+void foo(float x) {}
+void foo(uint x) {}
+
+void bar()
+{
+ int x = 0;
+ foo(x);
+}
+
--
2.5.5
More information about the Piglit
mailing list