mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Add a hlsl_block_add_if() helper.
This commit is contained in:
committed by
Henri Verbeet
parent
20aa37237d
commit
62196b2bf1
Notes:
Henri Verbeet
2025-03-10 15:23:02 +01:00
Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1404
@@ -1789,6 +1789,23 @@ struct hlsl_ir_node *hlsl_new_if(struct hlsl_ctx *ctx, struct hlsl_ir_node *cond
|
||||
return &iff->node;
|
||||
}
|
||||
|
||||
void hlsl_block_add_if(struct hlsl_ctx *ctx, struct hlsl_block *block, struct hlsl_ir_node *condition,
|
||||
struct hlsl_block *then_block, struct hlsl_block *else_block, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_ir_node *instr = hlsl_new_if(ctx, condition, then_block, else_block, loc);
|
||||
|
||||
if (instr)
|
||||
{
|
||||
hlsl_block_add_instr(block, instr);
|
||||
}
|
||||
else
|
||||
{
|
||||
hlsl_block_cleanup(then_block);
|
||||
if (else_block)
|
||||
hlsl_block_cleanup(else_block);
|
||||
}
|
||||
}
|
||||
|
||||
struct hlsl_ir_switch_case *hlsl_new_switch_case(struct hlsl_ctx *ctx, unsigned int value,
|
||||
bool is_default, struct hlsl_block *body, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
|
Reference in New Issue
Block a user