[PATCH vkd3d v3 1/7] vkd3d-shader/hlsl: Lower casts to bool to comparisons.

Matteo Bruni matteo.mystral at gmail.com
Wed Apr 6 11:57:06 CDT 2022


On Wed, Apr 6, 2022 at 3:57 PM Giovanni Mascellani
<gmascellani at codeweavers.com> wrote:
>
> Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
> ---
> v3:
>  * Fix optimization passes order.
>  * Rename lower_cast_to_bool() to lower_casts_to_bool().
> ---
>  libs/vkd3d-shader/hlsl_codegen.c      | 32 +++++++++++++++++++++++++++
>  libs/vkd3d-shader/hlsl_constant_ops.c |  9 ++------
>  libs/vkd3d-shader/hlsl_sm4.c          |  3 ++-
>  3 files changed, 36 insertions(+), 8 deletions(-)

> diff --git a/libs/vkd3d-shader/hlsl_sm4.c b/libs/vkd3d-shader/hlsl_sm4.c
> index 872118c1..f3530084 100644
> --- a/libs/vkd3d-shader/hlsl_sm4.c
> +++ b/libs/vkd3d-shader/hlsl_sm4.c
> @@ -1540,7 +1540,8 @@ static void write_sm4_cast(struct hlsl_ctx *ctx,
>              break;
>
>          case HLSL_TYPE_BOOL:
> -            hlsl_fixme(ctx, &expr->node.loc, "SM4 cast to bool.\n");
> +            /* Casts to bool should have already been lowered. */
> +            assert(0);
>              break;
>
>          default:

So, this is fine of course, but I really think it would be nicer with
the comment "inside" the assert:

assert(!"Casts to bool should have already been lowered.");

This patch also conflicts (pretty trivially) with mine from earlier
today, I'll probably resend it after going through the series.



More information about the wine-devel mailing list