vkd3d-shader: Factor out hlsl_new_jump().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura
2021-02-27 18:03:13 -06:00
committed by Alexandre Julliard
parent 774609e1e2
commit ccd67dcf37
3 changed files with 14 additions and 6 deletions

View File

@@ -377,10 +377,8 @@ static bool append_conditional_break(struct list *cond_list)
return false;
list_add_tail(cond_list, &iff->node.entry);
if (!(jump = vkd3d_malloc(sizeof(*jump))))
if (!(jump = hlsl_new_jump(HLSL_IR_JUMP_BREAK, condition->loc)))
return false;
init_node(&jump->node, HLSL_IR_JUMP, NULL, condition->loc);
jump->type = HLSL_IR_JUMP_BREAK;
list_add_head(&iff->then_instrs, &jump->node.entry);
return true;
}
@@ -563,10 +561,8 @@ static struct hlsl_ir_jump *add_return(struct hlsl_ctx *ctx, struct list *instrs
return NULL;
}
if (!(jump = vkd3d_malloc(sizeof(*jump))))
if (!(jump = hlsl_new_jump(HLSL_IR_JUMP_RETURN, loc)))
return NULL;
init_node(&jump->node, HLSL_IR_JUMP, NULL, loc);
jump->type = HLSL_IR_JUMP_RETURN;
list_add_tail(instrs, &jump->node.entry);
return jump;