[Piglit] [PATCH 8/8] arb_shader_storage_buffer_object: add indirect block indexing test

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


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

---
 .../execution/indirect.shader_test                 | 60 ++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 tests/spec/arb_shader_storage_buffer_object/execution/indirect.shader_test

diff --git a/tests/spec/arb_shader_storage_buffer_object/execution/indirect.shader_test b/tests/spec/arb_shader_storage_buffer_object/execution/indirect.shader_test
new file mode 100644
index 0000000..50de38c
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/execution/indirect.shader_test
@@ -0,0 +1,60 @@
+# Tests (dynamically uniform) indirect indexing of SSBOs.
+
+[require]
+GL >= 3.3
+GLSL >= 4.00
+GL_ARB_shader_storage_buffer_object
+
+[vertex shader]
+#version 400
+
+uniform int u_idx;
+in vec4 piglit_vertex;
+flat out int idx;
+
+void main() {
+	idx = u_idx;
+	gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+#version 400
+#extension GL_ARB_shader_storage_buffer_object: require
+
+layout(binding = 0) buffer Data {
+	vec4 color;
+	float color_scale;
+} data[2];
+
+flat in int idx;
+out vec4 outcolor;
+
+void main() {
+    outcolor = data[idx].color * data[idx].color_scale;
+}
+
+[test]
+ssbo 0 32
+ssbo 0 subdata float 0 1.0
+ssbo 0 subdata float 4 2.0
+ssbo 0 subdata float 12 2.0
+ssbo 0 subdata float 16 0.5
+
+ssbo 1 32
+ssbo 1 subdata float 0 1.0
+ssbo 1 subdata float 4 2.0
+ssbo 1 subdata float 12 4.0
+ssbo 1 subdata float 16 0.25
+
+clear color 1.0 0.0 0.0 1.0
+clear
+
+uniform int u_idx 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.5 1.0 0.0 1.0
+
+uniform int u_idx 1
+
+draw rect -1 -1 2 2
+probe all rgba 0.25 0.5 0.0 1.0
-- 
2.5.0



More information about the Piglit mailing list