[Piglit] [PATCH 3/5] arb_enhanced_layouts: test some more compile time constant features

Timothy Arceri timothy.arceri at collabora.com
Sun Nov 1 17:54:39 PST 2015


Tests some glsl versioning used with the arb_enhanced_layout, as well
as some less basic features such as geting the qualifer value from
a constant array, the length method and unsigned ints.
---
 .../input-location-constant-array-member.vert      | 28 ++++++++++++++++++++++
 .../input-location-glsl-330.vert                   | 16 +++++++++++++
 .../input-location-uint.vert                       | 17 +++++++++++++
 .../input-location-uniform-in-expression.vert      | 21 ++++++++++++++++
 .../invalid-glsl-version.vert                      | 18 ++++++++++++++
 .../length-method-invalid.vert                     | 26 ++++++++++++++++++++
 .../compiler-time-constants/length-method.vert     | 25 +++++++++++++++++++
 7 files changed, 151 insertions(+)
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location-constant-array-member.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location-glsl-330.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location-uint.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location-uniform-in-expression.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/invalid-glsl-version.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/length-method-invalid.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/length-method.vert

diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location-constant-array-member.vert b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location-constant-array-member.vert
new file mode 100644
index 0000000..74e0633
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location-constant-array-member.vert
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.20
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_explicit_attrib_location
+// [end config]
+//
+// Section 4.3.3 (Constant Expressions) of the GLSL 4.50 Spec says:
+//
+// "A constant expression is one of:
+//  an expression formed by an operator on operands that are all constant
+//  expressions, including getting an element of a constant array, or a member
+//  of a constant structure, or components of a constant vector.
+//  However, the lowest precedence operators of the sequence operator (,) and
+//  the assignment operators ( =, +=,...) are not included in the operators
+//  that can create a constant expression.
+
+#version 120
+#extension GL_ARB_explicit_attrib_location: require
+#extension GL_ARB_enhanced_layouts: require
+
+const int start[3] = int[3](3, 2, 1);
+
+layout(location = start[2] + 2) in vec4 b;
+
+void main()
+{
+	gl_Position = b;
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location-glsl-330.vert b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location-glsl-330.vert
new file mode 100644
index 0000000..b69cad4
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location-glsl-330.vert
@@ -0,0 +1,16 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_enhanced_layouts
+// [end config]
+
+#version 330
+#extension GL_ARB_enhanced_layouts: require
+
+const int start = 6;
+layout(location = start + 2) in vec4 b;
+
+void main()
+{
+	gl_Position = b;
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location-uint.vert b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location-uint.vert
new file mode 100644
index 0000000..bc7dbad
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location-uint.vert
@@ -0,0 +1,17 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_explicit_attrib_location
+// [end config]
+
+#version 130
+#extension GL_ARB_explicit_attrib_location: require
+#extension GL_ARB_enhanced_layouts: require
+
+const uint start = 3u;
+layout(location = start + 2u) in vec4 b;
+
+void main()
+{
+	gl_Position = b;
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location-uniform-in-expression.vert b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location-uniform-in-expression.vert
new file mode 100644
index 0000000..d0ef241
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location-uniform-in-expression.vert
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_explicit_attrib_location
+// [end config]
+//
+// Tests that compiler fails if a uniform is part of the constant expression.
+
+#version 110
+#extension GL_ARB_explicit_attrib_location: require
+#extension GL_ARB_enhanced_layouts: require
+
+uniform int n;
+
+const int start = 3;
+layout(location = n + start + 2) in vec4 b;
+
+void main()
+{
+	gl_Position = b;
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/invalid-glsl-version.vert b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/invalid-glsl-version.vert
new file mode 100644
index 0000000..1a5fb77
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/invalid-glsl-version.vert
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// Test that compiler fails when compile-time constants used in unsupported
+// version of glsl and ARB_enhanced_layouts is not enabled.
+
+#version 110
+#extension GL_ARB_explicit_attrib_location: require
+
+const int start = 3;
+layout(location = start + 2) in vec4 b;
+
+void main()
+{
+	gl_Position = b;
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/length-method-invalid.vert b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/length-method-invalid.vert
new file mode 100644
index 0000000..1612a62
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/length-method-invalid.vert
@@ -0,0 +1,26 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_explicit_attrib_location
+// [end config]
+//
+// Section 4.3.3 (Constant Expressions) of the GLSL 4.50 Spec says:
+//
+// "A constant expression is one of:
+//  valid use of the length() method on an explicitly sized object, whether or
+//  not the object itself is constant (implicitly sized or run-time sized
+//  arrays do not return a constant expression)"
+
+#version 120
+#extension GL_ARB_explicit_attrib_location: require
+#extension GL_ARB_enhanced_layouts: require
+
+int start[];
+
+layout(location = start.length() + 2) in vec4 b;
+
+void main()
+{
+	start[1] = 3;
+	gl_Position = b;
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/length-method.vert b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/length-method.vert
new file mode 100644
index 0000000..830db8d
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/length-method.vert
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.20
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_explicit_attrib_location
+// [end config]
+//
+// Section 4.3.3 (Constant Expressions) of the GLSL 4.50 Spec says:
+//
+// "A constant expression is one of:
+//  valid use of the length() method on an explicitly sized object, whether or
+//  not the object itself is constant (implicitly sized or run-time sized
+//  arrays do not return a constant expression)"
+
+#version 120
+#extension GL_ARB_explicit_attrib_location: require
+#extension GL_ARB_enhanced_layouts: require
+
+int start[3];
+
+layout(location = start.length() + 2) in vec4 b;
+
+void main()
+{
+	gl_Position = b;
+}
-- 
2.4.3



More information about the Piglit mailing list