vkd3d-shader/hlsl: Fix float modulus for vector arguments.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Merge request reports
Activity
added 1 commit
- 846297e8 - vkd3d-shader/hlsl: Fix float modulus for vector arguments.
Given that
hlsl_add_conditional()
is also used inlower_int_division()
andlower_int_modulus()
, which likely have the same problem, shouldn't we rather fixhlsl_add_conditional()
instead?Also, please add the corresponding test in
arithmetic-float-uniform.shader_test
too:[pixel shader] float4 x = {5.0, -42.1, 4.0, 45.0}; float4 y = {15.0, -5.0, 4.1, 5.0}; float4 main() : sv_target { return x % y; } [test] draw quad probe all rgba (5.0, -2.1, 4.0, 0.0) 4
That's just an internal helper for us, it doesn't matter what happens on Windows or will happen in the future.
WRT the test, the general philosophy is to keep
arithmetic-float.shader_test
andarithmetic-float-uniform.shader_test
synchronized, so that the correctness of the constant propagation pass is checked too. Actually, I got it backward: the test you wrote should go intoarithmetic-float-uniform.shader_test
, and the test I wrote should go toarithmetic-float.shader_test
.That's just an internal helper for us, it doesn't matter what happens on Windows or will happen in the future.
I think you misunderstood. What I mean is that explict 'if (x) a=b; else a=c;' might be turned to conditional move with x.xxxx mask, as an optimization. The helper is internal, but I'd rather remove it when it's not useful.
WRT the test, the general philosophy is to keep
arithmetic-float.shader_test
andarithmetic-float-uniform.shader_test
synchronized, so that the correctness of the constant propagation pass is checked too. Actually, I got it backward: the test you wrote should go intoarithmetic-float-uniform.shader_test
, and the test I wrote should go toarithmetic-float.shader_test
.Shouldn't it all go to uniform.shader_test then if it's using uniforms?
Shouldn't it all go to uniform.shader_test then if it's using uniforms?
Yeah, the correct form of my test is actually this:
[pixel shader] float4 main() : sv_target { float4 x = {5.0, -42.1, 4.0, 45.0}; float4 y = {15.0, -5.0, 4.1, 5.0}; return x % y; } [test] draw quad probe all rgba (5.0, -2.1, 4.0, 0.0) 4
Otherwise it doesn't even compile. And that's supposed to be in
arithmetic-float.shader_test
, it doesn't use uniform variables.I think you misunderstood. What I mean is that explict 'if (x) a=b; else a=c;' might be turned to conditional move with x.xxxx mask, as an optimization. The helper is internal, but I'd rather remove it when it's not useful.
Arguably it's still useful as a convenient shorthand for ternary hlsl_new_expr().
added 1 commit
- ad9a6e74 - vkd3d-shader/hlsl: Fix float modulus for vector arguments.
- Resolved by Nikolay Sivov
added 1 commit
- bef51780 - vkd3d-shader/hlsl: Add constant folding for the ternary operator.
added 73 commits
-
bef51780...34b1c0fe - 71 commits from branch
wine:master
- 6d1ba838 - vkd3d-shader/hlsl: Use conditional moves for arithmetic operators instead of branching.
- d9c984c1 - vkd3d-shader/hlsl: Add constant folding for the ternary operator.
-
bef51780...34b1c0fe - 71 commits from branch