[Piglit] [PATCH 07/11] arb_compute_shader: Test reading and merging multiple source images

Jordan Justen jordan.l.justen at intel.com
Sun Jun 1 17:39:12 PDT 2014


Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 .../execution/multiple-texture-reading.shader_test | 80 ++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 tests/spec/arb_compute_shader/execution/multiple-texture-reading.shader_test

diff --git a/tests/spec/arb_compute_shader/execution/multiple-texture-reading.shader_test b/tests/spec/arb_compute_shader/execution/multiple-texture-reading.shader_test
new file mode 100644
index 0000000..c1c06d4
--- /dev/null
+++ b/tests/spec/arb_compute_shader/execution/multiple-texture-reading.shader_test
@@ -0,0 +1,80 @@
+# Verify reading from multiple images
+
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_compute_shader
+GL_ARB_shader_image_load_store
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+#extension GL_ARB_shader_image_load_store: enable
+
+uniform int select_textures;
+layout(rgba8) readonly uniform image2D src0;
+layout(rgba8) readonly uniform image2D src1;
+writeonly uniform image2D dst;
+
+layout(local_size_x = 16, local_size_y = 16) in;
+
+void main()
+{
+	ivec2 coord = ivec2(gl_GlobalInvocationID.xy);
+	vec4 color = vec4(0, 0, 0, 0);
+	if ((select_textures & 1) == 1) {
+		color += imageLoad(src0, coord);
+	}
+	if ((select_textures & 2) == 2) {
+		color += imageLoad(src1, coord);
+	}
+	imageStore(dst, coord, color);
+}
+
+[test]
+# Setup src0 image
+texture rgbw 0 (16, 16)
+uniform int src0 0
+image texture 0
+fb tex 2d 0
+clear color 1.0 0.0 1.0 0.0
+clear
+
+# Setup src1 image
+texture rgbw 1 (16, 16)
+uniform int src1 1
+image texture 1
+fb tex 2d 1
+clear color 0.0 1.0 0.0 1.0
+clear
+
+# Setup dst image
+texture rgbw 2 (16, 16)
+uniform int dst 2
+image texture 2
+fb tex 2d 2
+
+# Clear dst image to not have the same color as the first test case
+clear color 0.5 0.5 0.5 0.5
+clear
+probe all rgba 0.5 0.5 0.5 0.5
+
+# Use neither source image
+uniform int select_textures 0
+compute 1 1 1
+probe all rgba 0.0 0.0 0.0 0.0
+
+# Use src0 image only
+uniform int select_textures 1
+compute 1 1 1
+#probe all rgba 1.0 0.0 1.0 0.0
+
+# Use src1 image only
+uniform int select_textures 2
+compute 1 1 1
+probe all rgba 0.0 1.0 0.0 1.0
+
+# Use both src0 and src1 images
+uniform int select_textures 3
+compute 1 1 1
+probe all rgba 1.0 1.0 1.0 1.0
-- 
2.0.0.rc4



More information about the Piglit mailing list