summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2016-03-15 21:10:09 -0500
committerNicolai Hähnle <nicolai.haehnle@amd.com>2016-04-14 16:42:14 -0500
commit5fad637420658747f38abe28cb9a5f49425c478d (patch)
tree32182119484d355e572ebdc31353fc7eb503a428
parent25a8564bea9d58a58fb3cfad842a7045d4edb66a (diff)
arb_shader_image_load_store: add disable_early_z test
-rw-r--r--tests/spec/arb_shader_image_load_store/execution/disable_early_z.shader_test72
1 files changed, 72 insertions, 0 deletions
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 000000000..e970757bd
--- /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