[Piglit] [PATCH] glsl-1.20: Add tests exposing some crashes with const arrays

Chris Forbes chrisf at ijw.co.nz
Thu Nov 20 17:51:42 PST 2014


Yep, I'll make execution versions of these, and an FS variant. Our FS
backend wasn't hitting an assert if you did this, but didn't do the
right thing.

On Fri, Nov 21, 2014 at 1:35 PM, Ian Romanick <idr at freedesktop.org> wrote:
> On 11/07/2014 10:43 AM, Chris Forbes wrote:
>> I stumbled across these while implementing tessellation. In particular,
>> the first test is a cutdown version of the tessellation nop.shader_test.
>>
>> The crash in array-initializers-1 is caused by the lowering of const arrays to
>> uniforms. The hidden uniforms for both are named 'constarray', and a
>> later phase in the linker gets horribly confused when it tries to look
>> them up by name.
>>
>> I have not yet usefully characterized the crash in double-indirect-1,
>> other than that it is in the i965 backend rather than in the GLSL
>> compiler.
>
> Oof.  These look like good tests to have... it seems like it would be
> pretty easy to make them execution tests.  Who knows what dragons may be
> there...
>
>> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
>> ---
>>
>> Here's a slightly better version of the patch. The first crash turned out to be
>> nothing to do with double-indirection.
>>
>>  tests/all.py                                        |  4 ++++
>>  .../linker/array-initializers-1.shader_test         | 20 ++++++++++++++++++++
>>  .../glsl-1.20/linker/double-indirect-1.shader_test  | 21 +++++++++++++++++++++
>>  3 files changed, 45 insertions(+)
>>  create mode 100644 tests/spec/glsl-1.20/linker/array-initializers-1.shader_test
>>  create mode 100644 tests/spec/glsl-1.20/linker/double-indirect-1.shader_test
>>
>> diff --git a/tests/all.py b/tests/all.py
>> index 4089325..3f004ce 100644
>> --- a/tests/all.py
>> +++ b/tests/all.py
>> @@ -1074,6 +1074,10 @@ spec['glsl-1.20']['execution'] = {}
>>  add_shader_test_dir(spec['glsl-1.20']['execution'],
>>                      os.path.join(testsDir, 'spec', 'glsl-1.20', 'execution'),
>>                      recursive=True)
>> +spec['glsl-1.20']['linker'] = {}
>> +add_shader_test_dir(spec['glsl-1.20']['linker'],
>> +                    os.path.join(testsDir, 'spec', 'glsl-1.20', 'linker'),
>> +                    recursive=True)
>>  add_shader_test_dir(spec['glsl-1.20']['execution'],
>>                      os.path.join(generatedTestDir, 'spec', 'glsl-1.20', 'execution'),
>>                      recursive=True)
>> diff --git a/tests/spec/glsl-1.20/linker/array-initializers-1.shader_test b/tests/spec/glsl-1.20/linker/array-initializers-1.shader_test
>> new file mode 100644
>> index 0000000..911acd4
>> --- /dev/null
>> +++ b/tests/spec/glsl-1.20/linker/array-initializers-1.shader_test
>> @@ -0,0 +1,20 @@
>> +# Demonstrates a crash in mesa.
>> +
>> +[require]
>> +GLSL >= 1.20
>> +
>> +[vertex shader]
>> +#version 120
>> +
>> +const int xs[] = int[](1,2,3);
>> +const int ys[] = int[](1,2);
>> +
>> +uniform int n;
>> +
>> +void main()
>> +{
>> +  gl_Position = vec4(xs[n]+ys[n], 0, 0, 1);
>> +}
>> +
>> +[test]
>> +link success
>> diff --git a/tests/spec/glsl-1.20/linker/double-indirect-1.shader_test b/tests/spec/glsl-1.20/linker/double-indirect-1.shader_test
>> new file mode 100644
>> index 0000000..c1d46e3
>> --- /dev/null
>> +++ b/tests/spec/glsl-1.20/linker/double-indirect-1.shader_test
>> @@ -0,0 +1,21 @@
>> +# Demonstrates a crash in i965. The double indirection via const arrays
>> +# is required to trigger this.
>> +
>> +[require]
>> +GLSL >= 1.20
>> +
>> +[vertex shader]
>> +#version 120
>> +
>> +const float a[] = float[](0);
>> +const int b[] = int[](0);
>> +
>> +uniform int n;
>> +
>> +void main()
>> +{
>> +  gl_Position = vec4(a[b[n]], 0, 0, 1);
>> +}
>> +
>> +[test]
>> +link success
>>
>


More information about the Piglit mailing list