[PATCH vkd3d 2/2] vkd3d-shader/hlsl: Implement floor().

Nikolay Sivov nsivov at codeweavers.com
Mon Dec 13 03:56:44 CST 2021



On 12/13/21 12:03, Giovanni Mascellani wrote:
> Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
> ---
> For the record, add_unary_arithmetic_expr is not completely correct 
> here, because, for example, it produces an int4 output type when input 
> is int4, while native would convert to float4.
>
> However, integer floor is not implemented anyway, and other intrinsics 
> are broken in the same way, so there's not reason to delay this patch.
>
> Eventually I think it would make sense to have another helper called 
> something like "add_unary_float_arithmetic_expr" that always converts 
> its input to half4 or float4.
>
I don't think it needs to convert anything. For integer input it simply 
should returns it as a result, for floor()/round()/trunc()/ceil().
After that normal cast should happen, resulting in ftoi/itof. Or maybe 
for integer case it's enough to return cast node to arg type.

By the way, is it possible to get textual output right away, without 
going through dxbc -> disasm?



More information about the wine-devel mailing list