mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-12-15 08:03:30 -08:00
vkd3d-shader/hlsl: Use a bool type for "new_cond" in lower_conditional_block_discard_nz().
This fixes the assertion error
"sm4_generate_vsir_instr_expr Failed assertion: dst_type->e.numeric.type == HLSL_TYPE_BOOL"
which occurs when compiling the following HLSL shader using the ps_4_0 target profile:
uniform float4 x;
uniform bool b;
float4 main() : SV_Target
{
if (!b)
clip(x.x);
else
clip(x.y);
return x;
}
This commit is contained in:
Notes:
Henri Verbeet
2025-11-10 16:27:19 +01:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1817
@@ -4099,7 +4099,6 @@ static bool lower_conditional_block_stores(struct hlsl_ctx *ctx, struct hlsl_ir_
|
||||
static bool lower_conditional_block_discard_nz(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
|
||||
struct hlsl_ir_node *cond, bool is_then)
|
||||
{
|
||||
struct hlsl_ir_node *operands[HLSL_MAX_OPERANDS] = {0};
|
||||
struct hlsl_ir_node *discard_cond, *new_cond = NULL;
|
||||
struct hlsl_ir_jump *jump;
|
||||
struct hlsl_block block;
|
||||
@@ -4122,12 +4121,8 @@ static bool lower_conditional_block_discard_nz(struct hlsl_ctx *ctx, struct hlsl
|
||||
cond = hlsl_block_add_unary_expr(ctx, &block, HLSL_OP1_LOGIC_NOT, cond, &instr->loc);
|
||||
discard_cond = hlsl_block_add_cast(ctx, &block, discard_cond, cond->data_type, &instr->loc);
|
||||
|
||||
operands[0] = cond;
|
||||
operands[1] = discard_cond;
|
||||
|
||||
/* discard_nz (cond && discard_cond) */
|
||||
new_cond = hlsl_block_add_expr(ctx, &block, HLSL_OP2_LOGIC_AND, operands,
|
||||
hlsl_get_scalar_type(ctx, HLSL_TYPE_UINT), &jump->node.loc);
|
||||
new_cond = hlsl_block_add_binary_expr(ctx, &block, HLSL_OP2_LOGIC_AND, cond, discard_cond);
|
||||
|
||||
list_move_before(&jump->node.entry, &block.instrs);
|
||||
hlsl_src_remove(&jump->condition);
|
||||
|
||||
Reference in New Issue
Block a user