[Piglit] [PATCH 6/7] arb_enhanced_layouts: test mismatching component types

Timothy Arceri t_arceri at yahoo.com.au
Wed Nov 11 14:59:28 PST 2015


From: Timothy Arceri <timothy.arceri at collabora.com>

---
 .../type-mismatch-signed-float-illegal.vert        | 28 +++++++++++
 .../type-mismatch-signed-float.vert                | 58 ++++++++++++++++++++++
 .../type-mismatch-signed-unsigned-illegal.vert     | 28 +++++++++++
 .../type-mismatch-signed-unsigned.vert             | 57 +++++++++++++++++++++
 .../type-mismatch-unsigned-float-illegal.vert      | 28 +++++++++++
 .../type-mismatch-unsigned-float.vert              | 57 +++++++++++++++++++++
 6 files changed, 256 insertions(+)
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-float-illegal.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-float.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-unsigned-illegal.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-unsigned.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-unsigned-float-illegal.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-unsigned-float.vert

diff --git a/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-float-illegal.vert b/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-float-illegal.vert
new file mode 100644
index 0000000..4464b51
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-float-illegal.vert
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.40
+// check_link: true
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_separate_shader_objects
+// [end config]
+//
+// From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.50 spec:
+//
+//   "Further, when location aliasing, the aliases sharing the location must
+//   have the same underlying numerical type (floating-point or integer) and
+//   the same auxiliary storage and interpolation qualification"
+
+#version 140
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_separate_shader_objects: require
+
+// consume X/Y/Z components
+layout(location = 0) out ivec3 a;
+
+// consumes W component
+layout(location = 0, component = 3) out float b;
+
+void main()
+{
+  a = ivec3(0);
+  b = 1.0;
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-float.vert b/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-float.vert
new file mode 100644
index 0000000..2a46aa2
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-float.vert
@@ -0,0 +1,58 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.40
+// check_link: true
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_explicit_attrib_location
+// [end config]
+//
+// From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.50 spec:
+//
+//   "Further, when location aliasing, the aliases sharing the location must
+//   have the same underlying numerical type (floating-point or integer) and
+//   the same auxiliary storage and interpolation qualification"
+//
+//   ...
+//
+//   "The one exception where component aliasing is permitted is for two input
+//   variables (not block members) to a vertex shader, which are allowed to
+//   have component aliasing. This vertex-variable component aliasing is
+//   intended only to support vertex shaders where each execution path
+//   accesses at most one input per each aliased component.  Implementations
+//   are permitted, but not required, to generate link-time errors if they
+//   detect that every path through the vertex shader executable accesses
+//   multiple inputs aliased to any single component."
+//
+//   Issue 16 from the ARB_enhanced_layouts spec:
+//
+//   "We do allow this for vertex shader inputs, because we've supported
+//   "aliasing" behavior since OpenGL 2.0. This allows for an "uber-shader"
+//    with variables like:
+//
+//          layout(location=3) in float var1;
+//          layout(location=3) in int var2;
+//
+//   where sometimes it uses <var1> and sometimes <var2>.  Since we don't
+//   treat the code above (with overlapping components) as an error, it
+//   would be strange to treat non-overlapping component assignments as an
+//   error."
+
+
+#version 140
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_explicit_attrib_location: require
+
+uniform int i;
+
+// consume X/Y/Z components
+layout(location = 0) in ivec3 a;
+
+// consumes W component
+layout(location = 0, component = 3) in float b;
+
+void main()
+{
+  if (i == 1)
+    gl_Position = vec4(a, 1.0);
+  else
+    gl_Position = vec4(b);
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-unsigned-illegal.vert b/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-unsigned-illegal.vert
new file mode 100644
index 0000000..48dd641
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-unsigned-illegal.vert
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.40
+// check_link: true
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_separate_shader_objects
+// [end config]
+//
+// From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.50 spec:
+//
+//   "Further, when location aliasing, the aliases sharing the location must
+//   have the same underlying numerical type (floating-point or integer) and
+//   the same auxiliary storage and interpolation qualification"
+
+#version 140
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_separate_shader_objects: require
+
+// consume X/Y/Z components
+layout(location = 0) out ivec3 a;
+
+// consumes W component
+layout(location = 0, component = 3) out uint b;
+
+void main()
+{
+  a = ivec3(0);
+  b = 1u;
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-unsigned.vert b/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-unsigned.vert
new file mode 100644
index 0000000..57f873c
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-signed-unsigned.vert
@@ -0,0 +1,57 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.40
+// check_link: true
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_explicit_attrib_location
+// [end config]
+//
+// From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.50 spec:
+//
+//   "Further, when location aliasing, the aliases sharing the location must
+//   have the same underlying numerical type (floating-point or integer) and
+//   the same auxiliary storage and interpolation qualification"
+//
+//   ...
+//
+//   "The one exception where component aliasing is permitted is for two input
+//   variables (not block members) to a vertex shader, which are allowed to
+//   have component aliasing. This vertex-variable component aliasing is
+//   intended only to support vertex shaders where each execution path
+//   accesses at most one input per each aliased component.  Implementations
+//   are permitted, but not required, to generate link-time errors if they
+//   detect that every path through the vertex shader executable accesses
+//   multiple inputs aliased to any single component."
+//
+//   Issue 16 from the ARB_enhanced_layouts spec:
+//
+//   "We do allow this for vertex shader inputs, because we've supported
+//   "aliasing" behavior since OpenGL 2.0. This allows for an "uber-shader"
+//    with variables like:
+//
+//          layout(location=3) in float var1;
+//          layout(location=3) in int var2;
+//
+//   where sometimes it uses <var1> and sometimes <var2>.  Since we don't
+//   treat the code above (with overlapping components) as an error, it
+//   would be strange to treat non-overlapping component assignments as an
+//   error."
+
+#version 140
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_explicit_attrib_location: require
+
+uniform int i;
+
+// consume X/Y/Z components
+layout(location = 0) in ivec3 a;
+
+// consumes W component
+layout(location = 0, component = 3) in uint b;
+
+void main()
+{
+  if (i == 1)
+    gl_Position = vec4(a, 1.0);
+  else
+    gl_Position = vec4(b);
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-unsigned-float-illegal.vert b/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-unsigned-float-illegal.vert
new file mode 100644
index 0000000..352b846
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-unsigned-float-illegal.vert
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.40
+// check_link: true
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_separate_shader_objects
+// [end config]
+//
+// From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.50 spec:
+//
+//   "Further, when location aliasing, the aliases sharing the location must
+//   have the same underlying numerical type (floating-point or integer) and
+//   the same auxiliary storage and interpolation qualification"
+
+#version 140
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_separate_shader_objects: require
+
+// consume X/Y/Z components
+layout(location = 0) out uvec3 a;
+
+// consumes W component
+layout(location = 0, component = 3) out float b;
+
+void main()
+{
+  a = uvec3(0);
+  b = 1.0;
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-unsigned-float.vert b/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-unsigned-float.vert
new file mode 100644
index 0000000..eddceb1
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/component-layout/type-mismatch-unsigned-float.vert
@@ -0,0 +1,57 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.40
+// check_link: true
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_explicit_attrib_location
+// [end config]
+//
+// From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.50 spec:
+//
+//   "Further, when location aliasing, the aliases sharing the location must
+//   have the same underlying numerical type (floating-point or integer) and
+//   the same auxiliary storage and interpolation qualification"
+//
+//   ...
+//
+//   "The one exception where component aliasing is permitted is for two input
+//   variables (not block members) to a vertex shader, which are allowed to
+//   have component aliasing. This vertex-variable component aliasing is
+//   intended only to support vertex shaders where each execution path
+//   accesses at most one input per each aliased component.  Implementations
+//   are permitted, but not required, to generate link-time errors if they
+//   detect that every path through the vertex shader executable accesses
+//   multiple inputs aliased to any single component."
+//
+//   Issue 16 from the ARB_enhanced_layouts spec:
+//
+//   "We do allow this for vertex shader inputs, because we've supported
+//   "aliasing" behavior since OpenGL 2.0. This allows for an "uber-shader"
+//    with variables like:
+//
+//          layout(location=3) in float var1;
+//          layout(location=3) in int var2;
+//
+//   where sometimes it uses <var1> and sometimes <var2>.  Since we don't
+//   treat the code above (with overlapping components) as an error, it
+//   would be strange to treat non-overlapping component assignments as an
+//   error."
+
+#version 140
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_explicit_attrib_location: require
+
+uniform int i;
+
+// consume X/Y/Z components
+layout(location = 0) in uvec3 a;
+
+// consumes W component
+layout(location = 0, component = 3) in float b;
+
+void main()
+{
+  if (i == 1)
+    gl_Position = vec4(a, 1.0);
+  else
+    gl_Position = vec4(b);
+}
-- 
2.4.3



More information about the Piglit mailing list