[Piglit] [PATCH] ARB_shader_storage_buffer_object: check ssbo array optimizations
asimiklit.work at gmail.com
asimiklit.work at gmail.com
Fri Feb 15 13:43:11 UTC 2019
From: Andrii Simiklit <andrii.simiklit at globallogic.com>
The tests for a compiler which leads to mismatch between max_array_access
and the var type when the compiler tries to optimize unused ssbo instances.
This mismatch leads to crash because in some cases the type length is less
than the max_array_access field.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109532
Signed-off-by: Andrii Simiklit <andrii.simiklit at globallogic.com>
---
.../compiler/unused-array-element.comp | 34 +++++++++++++++++++
.../compiler/unused-array-element.frag | 32 +++++++++++++++++
2 files changed, 66 insertions(+)
create mode 100644 tests/spec/arb_shader_storage_buffer_object/compiler/unused-array-element.comp
create mode 100644 tests/spec/arb_shader_storage_buffer_object/compiler/unused-array-element.frag
diff --git a/tests/spec/arb_shader_storage_buffer_object/compiler/unused-array-element.comp b/tests/spec/arb_shader_storage_buffer_object/compiler/unused-array-element.comp
new file mode 100644
index 000000000..a5ec4d972
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/compiler/unused-array-element.comp
@@ -0,0 +1,34 @@
+// [config]
+// expect_result: pass
+// glsl_version: 4.30
+// [end config]
+//
+//The tests for a compiler which leads to mismatch between max_array_access
+//and the var type when the compiler tries to optimize unused ssbo instances.
+//This mismatch leads to crash because in some cases the type length is less
+//than the max_array_access field.
+//
+#version 430
+
+layout(local_size_x = 1) in;
+
+layout(packed) buffer BlockA {
+ float a;
+} blockA[3];
+
+layout(packed) buffer BlockB {
+ float a;
+} blockB[2];
+
+layout(packed) buffer BlockC {
+ float a;
+} blockC[2];
+
+buffer Result {
+ float result;
+};
+
+void main()
+{
+ result = blockA[1].a + blockB[0].a + blockC[1].a;
+}
diff --git a/tests/spec/arb_shader_storage_buffer_object/compiler/unused-array-element.frag b/tests/spec/arb_shader_storage_buffer_object/compiler/unused-array-element.frag
new file mode 100644
index 000000000..8fdb1bf2e
--- /dev/null
+++ b/tests/spec/arb_shader_storage_buffer_object/compiler/unused-array-element.frag
@@ -0,0 +1,32 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.20
+// [end config]
+//
+//The tests for a compiler which leads to mismatch between max_array_access
+//and the var type when the compiler tries to optimize unused ssbo instances.
+//This mismatch leads to crash because in some cases the type length is less
+//than the max_array_access field.
+//
+#version 320 es
+
+precision mediump float;
+
+layout(packed) buffer BlockA {
+ float a;
+} blockA[3];
+
+layout(packed) buffer BlockB {
+ float a;
+} blockB[2];
+
+layout(packed) buffer BlockC {
+ float a;
+} blockC[2];
+
+out vec4 color;
+
+void main()
+{
+ color = vec4(blockA[1].a, blockB[0].a, blockC[1].a, 1.0);
+}
\ No newline at end of file
--
2.17.1
More information about the Piglit
mailing list