[Piglit] [PATCH 08/10] arb_tessellation_shader: add tests for partial output writes
Marek Olšák
maraeo at gmail.com
Mon Jul 27 17:02:37 PDT 2015
From: Chris Forbes <chrisf at ijw.co.nz>
These cases are interesting for i965 because writemasks for URB writes
require careful code generation.
The partial write is buried in uniform branch to defeat any coalescing a
clever implementation might otherwise do.
v2: fixed by Marek
Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
.../execution/patch-partial-write.shader_test | 64 ++++++++++++++++++++++
.../execution/vertex-partial-write.shader_test | 64 ++++++++++++++++++++++
2 files changed, 128 insertions(+)
create mode 100644 tests/spec/arb_tessellation_shader/execution/patch-partial-write.shader_test
create mode 100644 tests/spec/arb_tessellation_shader/execution/vertex-partial-write.shader_test
diff --git a/tests/spec/arb_tessellation_shader/execution/patch-partial-write.shader_test b/tests/spec/arb_tessellation_shader/execution/patch-partial-write.shader_test
new file mode 100644
index 0000000..8b06018
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/patch-partial-write.shader_test
@@ -0,0 +1,64 @@
+#
+# Test that partial writes of patch outputs work in the control shader
+#
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader passthrough]
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(vertices = 2) out;
+patch out vec4 c;
+uniform int x;
+
+void main()
+{
+ gl_TessLevelInner[0] = 1.0;
+ gl_TessLevelInner[1] = 1.0;
+
+ gl_TessLevelOuter[0] = 1.0;
+ gl_TessLevelOuter[1] = 1.0;
+ gl_TessLevelOuter[2] = 1.0;
+ gl_TessLevelOuter[3] = 1.0;
+
+ c = vec4(1.0);
+ if (x == 0) { /* true, but the compiler cannot see it */
+ c.xz = vec2(0);
+ }
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(quads, equal_spacing) in;
+patch in vec4 c;
+out vec4 fs_c;
+
+void main()
+{
+ gl_Position = vec4(gl_TessCoord.xy * 2 - 1, 0, 1);
+ fs_c = c;
+}
+
+[fragment shader]
+#version 150
+
+in vec4 fs_c;
+
+void main()
+{
+ gl_FragColor = fs_c;
+}
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+patch parameter vertices 1
+draw arrays GL_PATCHES 0 1
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_tessellation_shader/execution/vertex-partial-write.shader_test b/tests/spec/arb_tessellation_shader/execution/vertex-partial-write.shader_test
new file mode 100644
index 0000000..079516c
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/vertex-partial-write.shader_test
@@ -0,0 +1,64 @@
+#
+# Test that partial writes of per-vertex outputs work in the control shader
+#
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader passthrough]
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(vertices = 2) out;
+out vec4 c[];
+uniform int x;
+
+void main()
+{
+ gl_TessLevelInner[0] = 1.0;
+ gl_TessLevelInner[1] = 1.0;
+
+ gl_TessLevelOuter[0] = 1.0;
+ gl_TessLevelOuter[1] = 1.0;
+ gl_TessLevelOuter[2] = 1.0;
+ gl_TessLevelOuter[3] = 1.0;
+
+ c[gl_InvocationID] = vec4(1.0);
+ if (x == 0) { /* true, but the compiler cannot see it */
+ c[gl_InvocationID].xz = vec2(0);
+ }
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(quads, equal_spacing) in;
+in vec4 c[];
+out vec4 fs_c;
+
+void main()
+{
+ gl_Position = vec4(gl_TessCoord.xy * 2 - 1, 0, 1);
+ fs_c = 0.5 * (c[0] + c[1]);
+}
+
+[fragment shader]
+#version 150
+
+in vec4 fs_c;
+
+void main()
+{
+ gl_FragColor = fs_c;
+}
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+patch parameter vertices 1
+draw arrays GL_PATCHES 0 1
+probe all rgba 0.0 1.0 0.0 1.0
--
2.1.4
More information about the Piglit
mailing list