[Piglit] [PATCH v2] glsl-1.10: test bug with lessThan() when the input expression has mixed sizes
Ian Romanick
idr at freedesktop.org
Wed Jun 27 22:58:48 UTC 2018
On 06/27/2018 03:44 PM, Timothy Arceri wrote:
>
>
> On 28/06/18 08:28, Timothy Arceri wrote:
>> 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?
>
> Seems to be a bug with do_tree_grafting()
Either that or in opt_algebraic. It's turning lessThan(a + b, 0) into a
< -b, but it's loosing all the swizzles and the sizes.
>> 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
>>>>
>> _______________________________________________
>> Piglit mailing list
>> Piglit at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/piglit
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
>
More information about the Piglit
mailing list