[Piglit] [PATCH v2] glsl-1.10: test bug with lessThan() when the input expression has mixed sizes

Timothy Arceri tarceri at itsqueeze.com
Wed Jun 27 22:28:40 UTC 2018


On 27/06/18 21:58, Tapani Pälli wrote:
> On 06/27/2018 02:43 PM, Timothy Arceri wrote:
>> ---
>>
>>   V2: Fix some spelling typos and the commit description
>>
>>   ...on-vec4-mixed-arithmetic-input.shader_test | 37 +++++++++++++++++++
>>   1 file changed, 37 insertions(+)
>>   create mode 100644 
>> tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test 
>>
>>
>> diff --git 
>> a/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test 
>> b/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test 
>>
>> new file mode 100644
>> index 000000000..78f0068a3
>> --- /dev/null
>> +++ 
>> b/tests/spec/glsl-1.10/execution/comparision-vec4-mixed-arithmetic-input.shader_test 
>>
>> @@ -0,0 +1,37 @@
>> +# This exerises a bug found in a Doom shader were the lessThan() 
>> comparision
>> +# was only done againsts a single component of the mixed arithmetic 
>> expression
> 
> here are some more typos to fix:
> 
> were -> where
> exerises -> exercises
> comparision -> comparison
> againsts -> against

lol, thanks.

> 
> For me running this throws following assert:
> 
> shader_runner: ../src/compiler/glsl/ir.cpp:491: 
> ir_expression::ir_expression(int, ir_rvalue*, ir_rvalue*): Assertion 
> `op0->type == op1->type' failed.
> 
> Is this the issue?

Yes, and in release builds the test fails. It seems to be a broken opt 
somewhere:

       (declare (temporary ) bvec4 lessThan_retval)
       (declare (temporary ) vec4 x)
       (assign  (xyzw) (var_ref x)  (expression vec4 + (swiz w (var_ref 
b) )(swiz xyzw (var_ref a) )) )
       (declare (temporary ) vec4 y)
       (assign  (xyzw) (var_ref y)  (constant vec4 (0.000000 0.000000 
0.000000 0.000000)) )
       (assign  (xyzw) (var_ref lessThan_retval)  (expression bvec4 < 
(var_ref x) (var_ref y) ) )
       (declare (temporary ) bool any_retval)
       (declare (temporary ) bvec4 v)
       (assign  (xyzw) (var_ref v)  (var_ref lessThan_retval) )
       (assign  (x) (var_ref any_retval)  (expression bool any_nequal 
(var_ref v) (constant bvec4 (0 0 0 0)) ) )
       (if (var_ref any_retval) (
         (assign  (xyzw) (var_ref gl_FragColor)  (constant vec4 
(1.000000 0.000000 0.000000 1.000000)) )
       )
       ())

Turns into:


(if (expression bool any_nequal (swiz xxxx (expression bool < (swiz w 
(var_ref b) )(expression vec4 neg (var_ref a) ) ) )(constant bvec4 (0 0 
0 0)) ) (
         (assign  (xyzw) (var_ref gl_FragColor)  (constant vec4 
(1.000000 0.000000 0.000000 1.000000)) )
       )


> 
>> +# rather than all four components.
>> +
>> +[require]
>> +GLSL >= 1.10
>> +
>> +[vertex shader passthrough]
>> +
>> +[fragment shader]
>> +#version 110
>> +
>> +uniform vec4 a;
>> +uniform vec4 b;
>> +
>> +void main() {
>> +    gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
>> +
>> +    if (any(lessThan(b.w + a.xyzw, vec4(0.0))))
>> +        gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
>> +}
>> +
>> +[test]
>> +clear color 0.1 0.1 0.1 0.1
>> +clear
>> +
>> +uniform vec4 a 0.5 0.5 0.5 -1.0
>> +uniform vec4 b 1.0 1.0 1.0 0.5
>> +draw rect -1 -1 2 2
>> +
>> +probe all rgba 1.0 0.0 0.0 1.0
>> +
>> +uniform vec4 a 0.5 0.5 0.5 -0.5
>> +uniform vec4 b 1.0 1.0 1.0 0.5
>> +draw rect -1 -1 2 2
>> +
>> +probe all rgba 0.0 1.0 0.0 1.0
>>


More information about the Piglit mailing list