[Piglit] [PATCH] glsl-1.20: Test sizing an array by initialization after the array has been accessed

Ian Romanick idr at freedesktop.org
Fri Dec 6 08:54:22 PST 2013


On 12/05/2013 02:08 PM, Timothy Arceri wrote:
> Reviewed-by: Timothy Arceri <t_arceri at yahoo.com.au>
> 
> Only small issue is the "too small" commit message could do with some
> rewording.

Yeah... the wording for both was fairly rubbish.  I started writing it
one way, but, when I decided to copy-and-paste, partially changed the
wording.  I've changed this to:

glsl-1.20: Test sizing an array by initialization after the array has
been accessed

The "big-enough" test verifies that the compiler accepts an initializer
used to size an array after an access (to the previously implicitly
sized array) has been seen when the access would have been in-bounds in
the sized array.

The "too-small" test verifies that the compiler rejects an initializer
used to size an array after an access (to the previously implicitly
sized array) has been seen when the access would have been out-of-bounds
in the sized array.

> "the compiler rejects an initializer can be used to" ??
> 
> On Thu, 2013-12-05 at 13:17 -0800, Ian Romanick wrote:
>> From: Ian Romanick <ian.d.romanick at intel.com>
>>
>> The "big-enough" test verifies that the compiler accepts an initializer
>> can be used to size an array after an access (to the previously
>> implicitly size) array has been seen when the access would have been
>> in-bounds in the sized array.
>>
>> The "too-small" test verifies that the compiler rejects an initializer
>> can be used to size an array after an access (to the previously
>> implicitly size) array has been seen when the access would have been
>> out-of-bounds in the sized array.
>>
>> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
>> Cc: Timothy Arceri <t_arceri at yahoo.com.au>
>> ---
>>  .../array-resize-after-access-big-enough.vert        | 20 ++++++++++++++++++++
>>  .../array-resize-after-access-too-small.vert         | 20 ++++++++++++++++++++
>>  2 files changed, 40 insertions(+)
>>  create mode 100644 tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-resize-after-access-big-enough.vert
>>  create mode 100644 tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-resize-after-access-too-small.vert
>>
>> diff --git a/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-resize-after-access-big-enough.vert b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-resize-after-access-big-enough.vert
>> new file mode 100644
>> index 0000000..1e21b2d
>> --- /dev/null
>> +++ b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-resize-after-access-big-enough.vert
>> @@ -0,0 +1,20 @@
>> +/* [config]
>> + * expect_result: pass
>> + * glsl_version: 1.20
>> + * [end config]
>> + */
>> +#version 120
>> +
>> +float x[];
>> +
>> +void foo() { x[1] = 2.; }
>> +
>> +// The array must be at least 2 elements because of the previous
>> +// access to x[1].
>> +float x[] = float[2](1., 2.);
>> +
>> +void main()
>> +{
>> +	foo();
>> +	gl_Position = vec4(x[0]);
>> +}
>> diff --git a/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-resize-after-access-too-small.vert b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-resize-after-access-too-small.vert
>> new file mode 100644
>> index 0000000..ebee5e6
>> --- /dev/null
>> +++ b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-resize-after-access-too-small.vert
>> @@ -0,0 +1,20 @@
>> +/* [config]
>> + * expect_result: fail
>> + * glsl_version: 1.20
>> + * [end config]
>> + */
>> +#version 120
>> +
>> +float x[];
>> +
>> +void foo() { x[3] = 2.; }
>> +
>> +// The array must be at least 4 elements because of the previous
>> +// access to x[3].
>> +float x[] = float[2](1., 2.);
>> +
>> +void main()
>> +{
>> +	foo();
>> +	gl_Position = vec4(x[0]);
>> +}
> 
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
> 



More information about the Piglit mailing list