[Piglit] [PATCH] arb_enhanced_layouts: test component packing with patch in tess stages

Timothy Arceri timothy.arceri at collabora.com
Sat Feb 27 03:43:23 UTC 2016


---
 ...s-tcs-tes-fs-patch-array-interleave.shader_test | 139 +++++++++++++++++++++
 .../vs-tcs-tes-fs-patch.shader_test                | 119 ++++++++++++++++++
 2 files changed, 258 insertions(+)
 create mode 100644 tests/spec/arb_enhanced_layouts/execution/component-layout/vs-tcs-tes-fs-patch-array-interleave.shader_test
 create mode 100644 tests/spec/arb_enhanced_layouts/execution/component-layout/vs-tcs-tes-fs-patch.shader_test

diff --git a/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-tcs-tes-fs-patch-array-interleave.shader_test b/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-tcs-tes-fs-patch-array-interleave.shader_test
new file mode 100644
index 0000000..c78fbe8
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-tcs-tes-fs-patch-array-interleave.shader_test
@@ -0,0 +1,139 @@
+# pass an interleaved array through vs->tcs->tes->fs.
+
+[require]
+GLSL >= 1.50
+GL_ARB_arrays_of_arrays
+GL_ARB_enhanced_layouts
+GL_ARB_tessellation_shader
+GL_ARB_separate_shader_objects
+
+[vertex shader]
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_separate_shader_objects: require
+
+in vec4 vertex;
+
+// consume X/Y/Z components of 6 vectors
+layout(location = 0) out vec3 a[6];
+
+// consumes W component of 6 vectors
+layout(location = 0, component = 3) out float b[6];
+
+void main()
+{
+	gl_Position = vertex;
+
+	a[0] = vec3(0.0);
+	a[1] = vec3(1.0);
+	a[2] = vec3(2.0);
+	a[3] = vec3(3.0);
+	a[4] = vec3(4.0);
+	a[5] = vec3(5.0);
+	b[0] = 6.0;
+	b[1] = 7.0;
+	b[2] = 8.0;
+	b[3] = 9.0;
+	b[4] = 10.0;
+	b[5] = 11.0;
+}
+
+
+[tessellation control shader]
+#extension GL_ARB_arrays_of_arrays: require
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_tessellation_shader: require
+#extension GL_ARB_separate_shader_objects: require
+
+layout(vertices = 3) out;
+
+// consume X/Y/Z components of 6 vectors
+layout(location = 0) in vec3 a[][6];
+
+// consumes W component of 6 vectors
+layout(location = 0, component = 3) in float b[][6];
+
+// consume X/Y/Z components of 6 vectors
+layout(location = 0) patch out vec3 a_tcs[6];
+
+// consumes W component of 6 vectors
+layout(location = 0, component = 3) patch out float b_tcs[6];
+
+void main() {
+	gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
+	gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 0.0);
+	gl_TessLevelInner = float[2](0.0, 0.0);
+	a_tcs = a[gl_InvocationID];
+	b_tcs = b[gl_InvocationID];
+}
+
+
+[tessellation evaluation shader]
+#extension GL_ARB_arrays_of_arrays: require
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_tessellation_shader: require
+#extension GL_ARB_separate_shader_objects: require
+
+layout(triangles) in;
+
+// consume X/Y/Z components of 6 vectors
+layout(location = 0) patch in vec3 a_tcs[6];
+
+// consumes W component of 6 vectors
+layout(location = 0, component = 3) patch in float b_tcs[6];
+
+// consume X/Y/Z components of 6 vectors
+layout(location = 0) out vec3 a_tes[6];
+
+// consumes W component of 6 vectors
+layout(location = 0, component = 3) out float b_tes[6];
+
+void main() {
+	gl_Position = gl_in[0].gl_Position * gl_TessCoord[0]
+	            + gl_in[1].gl_Position * gl_TessCoord[1]
+	            + gl_in[2].gl_Position * gl_TessCoord[2];
+
+	a_tes = a_tcs;
+	b_tes = b_tcs;
+}
+
+
+[fragment shader]
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_separate_shader_objects: require
+
+// consume X/Y/Z components of 6 vectors
+layout(location = 0) in vec3 a_tes[6];
+
+// consumes W component of 6 vectors
+layout(location = 0, component = 3) in float b_tes[6];
+
+void main()
+{
+	gl_FragColor = vec4(1, 0, 0, 1);
+
+	for (int i = 0; i < 6; i++) {
+		if (a_tes[i] != vec3(float(i)))
+			gl_FragColor = vec4(0, 1, 0, 1);
+	}
+
+	for (int i = 6; i < 12; i++) {
+		if (b_tes[i-6] != float(i))
+			gl_FragColor = vec4(0, 1, 0, 1);
+	}
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+-1.0  1.0
+-1.0  1.0
+ 1.0 -1.0
+ 1.0  1.0
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+patch parameter vertices 3
+draw arrays GL_PATCHES 0 6
+probe all rgba 1.0 0.0 0.0 1.0
diff --git a/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-tcs-tes-fs-patch.shader_test b/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-tcs-tes-fs-patch.shader_test
new file mode 100644
index 0000000..095e476
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-tcs-tes-fs-patch.shader_test
@@ -0,0 +1,119 @@
+# pass an basic component layout through vs->tcs->tes->fs.
+
+[require]
+GLSL >= 1.50
+GL_ARB_arrays_of_arrays
+GL_ARB_enhanced_layouts
+GL_ARB_tessellation_shader
+GL_ARB_separate_shader_objects
+
+[vertex shader]
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_separate_shader_objects: require
+
+in vec4 vertex;
+
+// consume Y/Z/W components
+layout(location = 0, component = 1) out vec3 a;
+
+// consumes X component
+layout(location = 0) out float b;
+
+void main()
+{
+	gl_Position = vertex;
+
+	a = vec3(0.0, 1.0, 1.0);
+	b = 1.0;
+}
+
+
+[tessellation control shader]
+#extension GL_ARB_arrays_of_arrays: require
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_tessellation_shader: require
+#extension GL_ARB_separate_shader_objects: require
+
+layout(vertices = 3) out;
+
+// consume Y/Z/W components
+layout(location = 0, component = 1) in vec3 a[];
+
+// consumes X component
+layout(location = 0) in float b[];
+
+// consume Y/Z/W components
+layout(location = 0, component = 1) patch out vec3 a_tcs;
+
+// consumes X component
+layout(location = 0) patch out float b_tcs;
+
+void main() {
+	gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
+	gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 0.0);
+	gl_TessLevelInner = float[2](0.0, 0.0);
+	a_tcs = a[gl_InvocationID];
+	b_tcs = b[gl_InvocationID];
+}
+
+
+[tessellation evaluation shader]
+#extension GL_ARB_arrays_of_arrays: require
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_tessellation_shader: require
+#extension GL_ARB_separate_shader_objects: require
+
+layout(triangles) in;
+
+// consume Y/Z/W components
+layout(location = 0, component = 1) patch in vec3 a_tcs;
+
+// consumes X component
+layout(location = 0) patch in float b_tcs;
+
+// consume Y/Z/W components
+layout(location = 0, component = 1) out vec3 a_tes;
+
+// consumes X component
+layout(location = 0) out float b_tes;
+
+void main() {
+	gl_Position = gl_in[0].gl_Position * gl_TessCoord[0]
+	            + gl_in[1].gl_Position * gl_TessCoord[1]
+	            + gl_in[2].gl_Position * gl_TessCoord[2];
+
+	a_tes = a_tcs;
+	b_tes = b_tcs;
+}
+
+
+[fragment shader]
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_separate_shader_objects: require
+
+// consume Y/Z/W components
+layout(location = 0, component = 1) in vec3 a_tes;
+
+// consumes X component
+layout(location = 0) in float b_tes;
+
+void main()
+{
+	gl_FragColor = vec4(b_tes, a_tes);
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+-1.0  1.0
+-1.0  1.0
+ 1.0 -1.0
+ 1.0  1.0
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+patch parameter vertices 3
+draw arrays GL_PATCHES 0 6
+probe all rgba 1.0 0.0 1.0 1.0
-- 
2.5.0



More information about the Piglit mailing list