vkd3d-shader/hlsl: Support frac() intrinsic.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=34242 Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Merge request reports
Activity
As far as I can tell, it's translated unconditionally to 'frc' instruction for both sm4 and older. For this specific constant, it does match "x - floor(x)", giving 0.75, with floor begin -3.0. But such optimization on constant input should be done somewhere else, or do you mean we should have a test now anyway?
As far as I can tell, it's translated unconditionally to 'frc' instruction for both sm4 and older. For this specific constant, it does match "x - floor(x)", giving 0.75, with floor begin -3.0. But such optimization on constant input should be done somewhere else, or do you mean we should have a test now anyway?
Right, translating this to "frc" makes sense. We're also implicitly testing the GLSL and SPIR-V backends with .shader_test tests though, and I don't think we have existing coverage for frc/frac() there.
Optimising constant inputs would happen in hlsl_fold_constant_exprs(). I think handling HLSL_OP1_FRACT should be fairly straightforward, but I don't think it's a requirement for this MR.
I do think that as a matter of principle having test coverage for the different intrinsics we implement is simply a good idea. These tests don't necessarily need to be complicated; see e.g. "sqrt.shader_test" for a straightforward example.
I do think that as a matter of principle having test coverage for the different intrinsics we implement is simply a good idea. These tests don't necessarily need to be complicated; see e.g. "sqrt.shader_test" for a straightforward example.
For the record, at some point I duplicated some tests so that both the constant folding path and the real codegen path would be tested. See for example
arithmetic-float.shader_test
vsarithmetic-float-uniform.shader_test
. It wouldn't probably be a bad idea to make that more systematic, but I agree that's not a requirement for this MR. Just saying.
added 1 commit
- abb580c0 - vkd3d-shader/hlsl: Support frac() intrinsic.
added 22 commits
-
abb580c0...d14f42be - 21 commits from branch
wine:master
- cc0e4a68 - vkd3d-shader/hlsl: Support frac() intrinsic.
-
abb580c0...d14f42be - 21 commits from branch
added 2 commits