mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
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:
parent
774609e1e2
commit
ccd67dcf37
@ -499,6 +499,17 @@ struct hlsl_ir_swizzle *hlsl_new_swizzle(struct hlsl_ctx *ctx, DWORD s, unsigned
|
||||
return swizzle;
|
||||
}
|
||||
|
||||
struct hlsl_ir_jump *hlsl_new_jump(enum hlsl_ir_jump_type type, struct vkd3d_shader_location loc)
|
||||
{
|
||||
struct hlsl_ir_jump *jump;
|
||||
|
||||
if (!(jump = vkd3d_malloc(sizeof(*jump))))
|
||||
return NULL;
|
||||
init_node(&jump->node, HLSL_IR_JUMP, NULL, loc);
|
||||
jump->type = type;
|
||||
return jump;
|
||||
}
|
||||
|
||||
bool hlsl_type_is_void(const struct hlsl_type *type)
|
||||
{
|
||||
return type->type == HLSL_CLASS_OBJECT && type->base_type == HLSL_TYPE_VOID;
|
||||
|
@ -529,6 +529,7 @@ struct hlsl_ir_expr *hlsl_new_cast(struct hlsl_ir_node *node, struct hlsl_type *
|
||||
struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx, struct hlsl_type *return_type,
|
||||
struct list *parameters, const char *semantic, struct vkd3d_shader_location loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_if *hlsl_new_if(struct hlsl_ir_node *condition, struct vkd3d_shader_location loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_jump *hlsl_new_jump(enum hlsl_ir_jump_type type, struct vkd3d_shader_location loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_assignment *hlsl_new_simple_assignment(struct hlsl_ir_var *lhs,
|
||||
struct hlsl_ir_node *rhs) DECLSPEC_HIDDEN;
|
||||
struct hlsl_type *hlsl_new_struct_type(struct hlsl_ctx *ctx, const char *name, struct list *fields) DECLSPEC_HIDDEN;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user