From: Zebediah Figura zfigura@codeweavers.com
We emit sm4 if_nz for these, but that does a bitwise comparison to zero, which is wrong for floats. --- libs/vkd3d-shader/hlsl.y | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 110db99da..e3dc2d92c 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -6707,6 +6707,15 @@ selection_statement: } }
+ check_condition_type(ctx, condition); + + if (!(condition = add_cast(ctx, $4, condition, hlsl_get_scalar_type(ctx, HLSL_TYPE_BOOL), &@4))) + { + destroy_block($6.then_block); + destroy_block($6.else_block); + YYABORT; + } + if (!(instr = hlsl_new_if(ctx, condition, $6.then_block, $6.else_block, &@2))) { destroy_block($6.then_block); @@ -6716,8 +6725,6 @@ selection_statement: destroy_block($6.then_block); destroy_block($6.else_block);
- check_condition_type(ctx, condition); - $$ = $4; hlsl_block_add_instr($$, instr); }