On 01/24/2014 10:40 AM, Kenneth Graunke wrote:
> On 01/24/2014 10:28 AM, Ian Romanick wrote:
>> From: Ian Romanick <[email protected]>
>>
>> Mesa currently passes the chained-assignment.vert, but it fails
>> chained-assignment-with-array-deref.vert with:
>>
>> 0:5(12): error: value of type vec4 cannot be assigned to variable of type 
>> float
>>
>> It seems the type checker is getting confused by the array
>> dereference.
>>
>> I have been told that cases similar to
>> chained-assignment-with-array-deref pass on all other known desktop
>> OpenGL implementations.
>>
>> Signed-off-by: Ian Romanick <[email protected]>
>> ---
>>  .../chained-assignment-with-array-deref.vert                   | 10 
>> ++++++++++
>>  .../compiler/assignment-operators/chained-assignment.vert      | 10 
>> ++++++++++
>>  2 files changed, 20 insertions(+)
>>  create mode 100644 
>> tests/spec/glsl-1.10/compiler/assignment-operators/chained-assignment-with-array-deref.vert
>>  create mode 100644 
>> tests/spec/glsl-1.10/compiler/assignment-operators/chained-assignment.vert
>>
>> diff --git 
>> a/tests/spec/glsl-1.10/compiler/assignment-operators/chained-assignment-with-array-deref.vert
>>  
>> b/tests/spec/glsl-1.10/compiler/assignment-operators/chained-assignment-with-array-deref.vert
>> new file mode 100644
>> index 0000000..1e3a450
>> --- /dev/null
>> +++ 
>> b/tests/spec/glsl-1.10/compiler/assignment-operators/chained-assignment-with-array-deref.vert
>> @@ -0,0 +1,10 @@
>> +/* [config]
>> + * expect_result: pass
>> + * glsl_version: 1.10
>> + * [end config]
>> + */
>> +
>> +void foo(inout vec4 a, float b)
>> +{
>> +    a[0] = a[1] = a[2] = b;
>> +}
> 
> You're only assigning three components of a vec4, which is a bit
> odd...and the "inout" is not necessary/related.
> 
> How about this instead?  (Or, additionally?)
> 
> void splat(vec2 v, float f)
> {
>     v[0] = v[1] = f;
> }

Yeah, that sounds good.

I think I also want a couple other variations:

   v.x = v.y = f;

and

   v[i] = v[j] = f;

>> diff --git 
>> a/tests/spec/glsl-1.10/compiler/assignment-operators/chained-assignment.vert 
>> b/tests/spec/glsl-1.10/compiler/assignment-operators/chained-assignment.vert
>> new file mode 100644
>> index 0000000..5a4c02b
>> --- /dev/null
>> +++ 
>> b/tests/spec/glsl-1.10/compiler/assignment-operators/chained-assignment.vert
>> @@ -0,0 +1,10 @@
>> +/* [config]
>> + * expect_result: pass
>> + * glsl_version: 1.10
>> + * [end config]
>> + */
>> +
>> +void foo(inout float a, inout float b, float c)
>> +{
>> +    a = b = c;
>> +}
> 
> Not sure this is too useful, but it definitely ought to work.

We currently have zero tests of chained assignments, and I wanted a
walk-before-you-run sort of test.  Since this passes, that gives some
information about the source of the error in the second.

I'll drop inout from this case too.

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to