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.
This commit is contained in:
Francisco Casas 2023-06-07 15:55:31 -04:00 committed by Alexandre Julliard
parent f34b107faf
commit 5dee6561c2
Notes: Alexandre Julliard 2023-06-08 23:22:50 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/226

View File

@ -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_modulus, body, NULL);
hlsl_transform_ir(ctx, lower_int_abs, body, NULL); hlsl_transform_ir(ctx, lower_int_abs, body, NULL);
hlsl_transform_ir(ctx, lower_float_modulus, body, NULL); hlsl_transform_ir(ctx, lower_float_modulus, body, NULL);
hlsl_transform_ir(ctx, fold_redundant_casts, body, NULL);
do do
{ {
progress = hlsl_transform_ir(ctx, hlsl_fold_constant_exprs, body, NULL); progress = hlsl_transform_ir(ctx, hlsl_fold_constant_exprs, body, NULL);