[PATCH vkd3d v2 3/5] vkd3d-shader/hlsl: Write SM4 less-than instructions.

Matteo Bruni matteo.mystral at gmail.com
Wed Jan 19 06:10:44 CST 2022


On Mon, Dec 20, 2021 at 10:25 AM Giovanni Mascellani
<gmascellani at codeweavers.com> wrote:
>
> Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
> ---
> v2: Add hlsl_fixme().
> ---
>  libs/vkd3d-shader/hlsl_sm4.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
>
> diff --git a/libs/vkd3d-shader/hlsl_sm4.c b/libs/vkd3d-shader/hlsl_sm4.c
> index d5ea5563..70cf4e13 100644
> --- a/libs/vkd3d-shader/hlsl_sm4.c
> +++ b/libs/vkd3d-shader/hlsl_sm4.c
> @@ -1539,6 +1539,32 @@ static void write_sm4_expr(struct hlsl_ctx *ctx,
>                      break;
>                  }
>
> +                case HLSL_OP2_LESS:
> +                {
> +                    const struct hlsl_type *src_type = arg1->data_type;
> +
> +                    switch (src_type->base_type)
> +                    {
> +                        case HLSL_TYPE_FLOAT:
> +                            write_sm4_binary_op(buffer, VKD3D_SM4_OP_LT, &expr->node, arg1, arg2);
> +                            break;
> +
> +                        case HLSL_TYPE_BOOL:
> +                        case HLSL_TYPE_INT:
> +                            write_sm4_binary_op(buffer, VKD3D_SM4_OP_ILT, &expr->node, arg1, arg2);
> +                            break;
> +
> +                        case HLSL_TYPE_UINT:
> +                            write_sm4_binary_op(buffer, VKD3D_SM4_OP_ULT, &expr->node, arg1, arg2);
> +                            break;
> +
> +                        default:
> +                            hlsl_fixme(ctx, &expr->node.loc, "SM4 less-than between \"%s\".\n", debug_hlsl_type(ctx, src_type));
> +                            break;
> +                    }
> +                    break;
> +                }
> +

According to some testing I did on the side, it looks like
HLSL_TYPE_BOOL should use ULT / UGE instead (and I resent it with that
change). Not the biggest deal, our bool handling needs a lot of work
anyway...



More information about the wine-devel mailing list