[Piglit] [PATCH 6/8] arb_shader_image_load_store: add disable_early_z test

Nicolai Hähnle nhaehnle at gmail.com
Thu Apr 7 01:10:50 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 .../execution/disable_early_z.shader_test          | 72 ++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 tests/spec/arb_shader_image_load_store/execution/disable_early_z.shader_test

diff --git a/tests/spec/arb_shader_image_load_store/execution/disable_early_z.shader_test b/tests/spec/arb_shader_image_load_store/execution/disable_early_z.shader_test
new file mode 100644
index 0000000..e970757
--- /dev/null
+++ b/tests/spec/arb_shader_image_load_store/execution/disable_early_z.shader_test
@@ -0,0 +1,72 @@
+# Test that Z runs lates when the fragment shader contains stores.
+#
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_shader_image_load_store
+SIZE 256 256
+depthbuffer
+
+[vertex shader]
+#version 130
+in vec4 piglit_vertex;
+
+void main()
+{
+	gl_Position = piglit_vertex;
+	gl_Position.z = 1.0;
+}
+
+[fragment shader]
+#version 330
+#extension GL_ARB_shader_image_load_store: enable
+
+uniform int read;
+uniform vec4 in_color;
+layout(rgba8) uniform image2D img;
+out vec4 outcolor;
+
+void main()
+{
+	vec4 color;
+	if (read != 0) {
+		color = imageLoad(img, ivec2(gl_FragCoord));
+	} else {
+		color = in_color;
+		imageStore(img, ivec2(gl_FragCoord), color);
+	}
+	outcolor = color;
+}
+
+[test]
+texture rgbw 0 (256, 256) GL_RGBA8
+uniform int img 0
+image texture 0 GL_RGBA8
+
+# Clear framebuffer
+clear color 1.0 0.0 0.0 1.0
+clear depth 0.0
+clear
+
+# Clear texture
+uniform int read 0
+uniform vec4 in_color 0.0 0.0 1.0 1.0
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.0 1.0 1.0
+
+memory barrier GL_SHADER_IMAGE_ACCESS_BARRIER_BIT
+
+# Check that Z test kills pixels
+uniform vec4 in_color 1.0 1.0 0.0 1.0
+enable GL_DEPTH_TEST
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.0 1.0 1.0
+
+memory barrier GL_SHADER_IMAGE_ACCESS_BARRIER_BIT
+
+# Check that the texture was still modified
+disable GL_DEPTH_TEST
+uniform int read 1
+uniform vec4 in_color 0.0 0.0 0.0 0.0
+draw rect -1 -1 2 2
+probe all rgba 1.0 1.0 0.0 1.0
-- 
2.5.0



More information about the Piglit mailing list