ARB_shader_storage_buffer_object: check ssbo array optimizations

Submitted by andrey simiklit on Feb. 15, 2019, 1:43 p.m.

Details

Message ID 20190215134311.9885-1-asimiklit.work@gmail.com
State New
Headers show
Series "ARB_shader_storage_buffer_object: check ssbo array optimizations" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

andrey simiklit Feb. 15, 2019, 1:43 p.m.
From: Andrii Simiklit <andrii.simiklit@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@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

Patch hide | download patch | download mbox

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

Comments

I made a couple small adjustments to the tests and pushed them.

Thanks!

On 2/15/19 5:43 AM, asimiklit.work@gmail.com wrote:
> From: Andrii Simiklit <andrii.simiklit@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@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
>
Thanks for reviewing and push)
Andrii.

On Fri, Feb 22, 2019 at 8:25 PM Ian Romanick <idr@freedesktop.org> wrote:

> I made a couple small adjustments to the tests and pushed them.
>
> Thanks!
>
> On 2/15/19 5:43 AM, asimiklit.work@gmail.com wrote:
> > From: Andrii Simiklit <andrii.simiklit@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@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
> >
>
>