On Tue Mar 12 11:50:06 2024 +0000, Giovanni Mascellani wrote:
Why aren't you using ABS itself?
While according to the documentation the "abs" instruction exists for all shader profiles starting from ps_2_0 and vs_2_0, the native compiler doesn't use it directly.
* For both ps_2_0 and vs_2_0 it uses this mul trick, because we only care if the absolute value is not 0. * I checked now and for ps_3_0 and vs_3_0 it adds the "_abs" modifier to the src registers of the comparison instruction.
So it may make sense to actually add the path to use ABS if the `profile->major_version` is larger than 2.0, similarly to what lower_ternary() does. I don't know if this is necessary, the only case I can think of where this differ is for very large values where the multiplication falls outside the representable range of as a float, but even in those cases (which I think map to "inf"?) the sign should also be correct.
I will check what happens on Windows on these cases.