New tests for location overlap with scalars, doubles and for
duplicated inputs which match the same output variable in the previous
stage.

From the ARB_separate_shader_objects spec v.25:

  "   * An output variable is considered to match an input variable in
        the subequent shader if:

        * the two variables match in name, type, and qualification; or

        * the two variables are declared with the same location layout
          qualifier and match in type and qualification."

...

  " A program will fail to link if any two non-vertex shader input
    variables are assigned to the same location."

Cc: Timothy Arceri <tarc...@itsqueeze.com>
Cc: Iago Toral Quiroga <ito...@igalia.com>
Cc: Ilia Mirkin <imir...@alum.mit.edu>
Signed-off-by: Andres Gomez <ago...@igalia.com>
---
 ...uplicated-input-overlap-double.shader_test | 58 +++++++++++++++++++
 ...ation-duplicated-input-overlap.shader_test | 55 ++++++++++++++++++
 ...plicit-location-overlap-double.shader_test | 49 ++++++++++++++++
 ...o-fs-explicit-location-overlap.shader_test | 49 ++++++++++++++++
 4 files changed, 211 insertions(+)
 create mode 100644 
tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-duplicated-input-overlap-double.shader_test
 create mode 100644 
tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-duplicated-input-overlap.shader_test
 create mode 100644 
tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-overlap-double.shader_test
 create mode 100644 
tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-overlap.shader_test

diff --git 
a/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-duplicated-input-overlap-double.shader_test
 
b/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-duplicated-input-overlap-double.shader_test
new file mode 100644
index 000000000..f0a966e6a
--- /dev/null
+++ 
b/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-duplicated-input-overlap-double.shader_test
@@ -0,0 +1,58 @@
+// From the ARB_separate_shader_objects spec v.25:
+//
+//   "   * An output variable is considered to match an input variable
+//         in the subequent shader if:
+//
+//         * the two variables match in name, type, and qualification;
+//           or
+//
+//         * the two variables are declared with the same location
+//           layout qualifier and match in type and qualification."
+//
+//   ...
+//
+//   " A program will fail to link if any two non-vertex shader input
+//     variables are assigned to the same location."
+
+[require]
+GLSL >= 1.50
+GL_ARB_separate_shader_objects
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#version 150
+#extension GL_ARB_separate_shader_objects : require
+#extension GL_ARB_gpu_shader_fp64 : require
+
+in vec4 piglit_vertex;
+
+layout(location = 0) flat out dvec4 out1;
+
+void main()
+{
+       gl_Position = piglit_vertex;
+       out1 = dvec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_separate_shader_objects : require
+#extension GL_ARB_gpu_shader_fp64 : require
+
+uniform int i;
+
+layout(location = 0) flat in dvec4 in1;
+layout(location = 0) flat in dvec4 in2;
+
+out vec4 color;
+
+void main()
+{
+       if (i == 0)
+               color = vec4(in1);
+       else
+               color = vec4(in2);
+}
+
+[test]
+link error
diff --git 
a/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-duplicated-input-overlap.shader_test
 
b/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-duplicated-input-overlap.shader_test
new file mode 100644
index 000000000..d7e5769b3
--- /dev/null
+++ 
b/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-duplicated-input-overlap.shader_test
@@ -0,0 +1,55 @@
+// From the ARB_separate_shader_objects spec v.25:
+//
+//   "   * An output variable is considered to match an input variable
+//         in the subequent shader if:
+//
+//         * the two variables match in name, type, and qualification;
+//           or
+//
+//         * the two variables are declared with the same location
+//           layout qualifier and match in type and qualification."
+//
+//   ...
+//
+//   " A program will fail to link if any two non-vertex shader input
+//     variables are assigned to the same location."
+
+[require]
+GLSL >= 1.40
+GL_ARB_separate_shader_objects
+
+[vertex shader]
+#version 140
+#extension GL_ARB_separate_shader_objects : require
+
+in vec4 piglit_vertex;
+
+layout(location = 0) out vec4 out1;
+
+void main()
+{
+       gl_Position = piglit_vertex;
+       out1 = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[fragment shader]
+#version 140
+#extension GL_ARB_separate_shader_objects : require
+
+uniform int i;
+
+layout(location = 0) in vec4 in1;
+layout(location = 0) in vec4 in2;
+
+out vec4 color;
+
+void main()
+{
+       if (i == 0)
+               color = in1;
+       else
+               color = in2;
+}
+
+[test]
+link error
diff --git 
a/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-overlap-double.shader_test
 
b/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-overlap-double.shader_test
new file mode 100644
index 000000000..f273f6435
--- /dev/null
+++ 
b/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-overlap-double.shader_test
@@ -0,0 +1,49 @@
+// From the ARB_separate_shader_objects spec v.25:
+//
+//   " A program will fail to link if any two non-vertex shader input
+//     variables are assigned to the same location."
+
+[require]
+GLSL >= 1.50
+GL_ARB_separate_shader_objects
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#version 150
+#extension GL_ARB_separate_shader_objects : require
+#extension GL_ARB_gpu_shader_fp64 : require
+
+in vec4 piglit_vertex;
+
+layout(location = 0) flat out dvec4 out1;
+layout(location = 1) flat out dvec2 out2;
+
+void main()
+{
+       gl_Position = piglit_vertex;
+       out1 = dvec4(1.0, 0.0, 0.0, 1.0);
+       out2 = dvec2(0.0);
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_separate_shader_objects : require
+#extension GL_ARB_gpu_shader_fp64 : require
+
+uniform int i;
+
+layout(location = 0) flat in dvec4 in1;
+layout(location = 1) flat in dvec2 in2;
+
+out vec4 color;
+
+void main()
+{
+       if (i == 0)
+               color = vec4(in1);
+       else
+               color = vec4(in2, in2);
+}
+
+[test]
+link error
diff --git 
a/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-overlap.shader_test
 
b/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-overlap.shader_test
new file mode 100644
index 000000000..9b6e0fe4a
--- /dev/null
+++ 
b/tests/spec/arb_separate_shader_objects/linker/vs-to-fs-explicit-location-overlap.shader_test
@@ -0,0 +1,49 @@
+// From the ARB_separate_shader_objects spec v.25:
+//
+//   " A program will fail to link if any two non-vertex shader input
+//     variables are assigned to the same location."
+
+[require]
+GLSL >= 1.40
+GL_ARB_separate_shader_objects
+
+[vertex shader]
+#version 140
+#extension GL_ARB_separate_shader_objects : require
+
+in vec4 piglit_vertex;
+
+layout(location = 0) out mat2x4 out1;
+layout(location = 1) out vec4 out2;
+
+void main()
+{
+       gl_Position = piglit_vertex;
+       out1[0] = vec4(1.0, 0.0, 0.0, 1.0);
+       out1[1] = vec4(1.0, 1.0, 0.0, 1.0);
+       out2 = vec4(0.0);
+}
+
+[fragment shader]
+#version 140
+#extension GL_ARB_separate_shader_objects : require
+
+uniform int i;
+
+layout(location = 0) in mat2x4 in1;
+layout(location = 1) in vec4 in2;
+
+out vec4 color;
+
+void main()
+{
+       if (i == 0)
+               color = in1[0];
+       else if (i == 1)
+               color = in1[1];
+       else
+               color = in2;
+}
+
+[test]
+link error
-- 
2.20.1

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

Reply via email to