From 5dee6561c2a9aeeb951cc9786a8b28eebf8adc4d Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Wed, 7 Jun 2023 15:55:31 -0400 Subject: [PATCH] vkd3d-shader/hlsl: Fold redundant casts again after lower narrowing casts. lower_narrowing_casts() currently creates a new cast calling hlsl_new_cast(). This cast may be redundant, but it is not folded, which is making SM1 emit an unnecessary fixme in some shaders: Aborting due to not yet implemented feature: SM1 "cast" expression. Other passes that call hlsl_new_cast() are lower_int_division() and lower_int_modulus(), so the new fold_redundant_casts() pass is called after these as well. --- libs/vkd3d-shader/hlsl_codegen.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 20d8f0ae..4317604b 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -4068,6 +4068,7 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry hlsl_transform_ir(ctx, lower_int_modulus, body, NULL); hlsl_transform_ir(ctx, lower_int_abs, body, NULL); hlsl_transform_ir(ctx, lower_float_modulus, body, NULL); + hlsl_transform_ir(ctx, fold_redundant_casts, body, NULL); do { progress = hlsl_transform_ir(ctx, hlsl_fold_constant_exprs, body, NULL);