mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader: Factor out hlsl_new_load().
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
3ac20487f8
commit
6d10d887d0
@ -497,17 +497,24 @@ struct hlsl_ir_if *hlsl_new_if(struct hlsl_ir_node *condition, struct vkd3d_shad
|
|||||||
return iff;
|
return iff;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct hlsl_ir_load *hlsl_new_var_load(struct hlsl_ir_var *var, const struct vkd3d_shader_location loc)
|
struct hlsl_ir_load *hlsl_new_load(struct hlsl_ir_var *var, struct hlsl_ir_node *offset,
|
||||||
|
struct hlsl_type *type, const struct vkd3d_shader_location loc)
|
||||||
{
|
{
|
||||||
struct hlsl_ir_load *load;
|
struct hlsl_ir_load *load;
|
||||||
|
|
||||||
if (!(load = vkd3d_calloc(1, sizeof(*load))))
|
if (!(load = vkd3d_calloc(1, sizeof(*load))))
|
||||||
return NULL;
|
return NULL;
|
||||||
init_node(&load->node, HLSL_IR_LOAD, var->data_type, loc);
|
init_node(&load->node, HLSL_IR_LOAD, type, loc);
|
||||||
load->src.var = var;
|
load->src.var = var;
|
||||||
|
hlsl_src_from_node(&load->src.offset, offset);
|
||||||
return load;
|
return load;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct hlsl_ir_load *hlsl_new_var_load(struct hlsl_ir_var *var, const struct vkd3d_shader_location loc)
|
||||||
|
{
|
||||||
|
return hlsl_new_load(var, NULL, var->data_type, loc);
|
||||||
|
}
|
||||||
|
|
||||||
struct hlsl_ir_swizzle *hlsl_new_swizzle(struct hlsl_ctx *ctx, DWORD s, unsigned int components,
|
struct hlsl_ir_swizzle *hlsl_new_swizzle(struct hlsl_ctx *ctx, DWORD s, unsigned int components,
|
||||||
struct hlsl_ir_node *val, struct vkd3d_shader_location *loc)
|
struct hlsl_ir_node *val, struct vkd3d_shader_location *loc)
|
||||||
{
|
{
|
||||||
|
@ -530,6 +530,8 @@ struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx, struct hl
|
|||||||
struct list *parameters, const char *semantic, struct vkd3d_shader_location loc) DECLSPEC_HIDDEN;
|
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_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_jump *hlsl_new_jump(enum hlsl_ir_jump_type type, struct vkd3d_shader_location loc) DECLSPEC_HIDDEN;
|
||||||
|
struct hlsl_ir_load *hlsl_new_load(struct hlsl_ir_var *var, struct hlsl_ir_node *offset, struct hlsl_type *type,
|
||||||
|
struct vkd3d_shader_location loc) DECLSPEC_HIDDEN;
|
||||||
struct hlsl_ir_loop *hlsl_new_loop(struct vkd3d_shader_location loc) DECLSPEC_HIDDEN;
|
struct hlsl_ir_loop *hlsl_new_loop(struct vkd3d_shader_location loc) DECLSPEC_HIDDEN;
|
||||||
struct hlsl_ir_assignment *hlsl_new_simple_assignment(struct hlsl_ir_var *lhs,
|
struct hlsl_ir_assignment *hlsl_new_simple_assignment(struct hlsl_ir_var *lhs,
|
||||||
struct hlsl_ir_node *rhs) DECLSPEC_HIDDEN;
|
struct hlsl_ir_node *rhs) DECLSPEC_HIDDEN;
|
||||||
|
@ -610,11 +610,8 @@ static struct hlsl_ir_load *add_load(struct hlsl_ctx *ctx, struct list *instrs,
|
|||||||
list_add_tail(instrs, &assign->node.entry);
|
list_add_tail(instrs, &assign->node.entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(load = vkd3d_malloc(sizeof(*load))))
|
if (!(load = hlsl_new_load(var, offset, data_type, loc)))
|
||||||
return NULL;
|
return NULL;
|
||||||
init_node(&load->node, HLSL_IR_LOAD, data_type, loc);
|
|
||||||
load->src.var = var;
|
|
||||||
hlsl_src_from_node(&load->src.offset, offset);
|
|
||||||
list_add_tail(instrs, &load->node.entry);
|
list_add_tail(instrs, &load->node.entry);
|
||||||
return load;
|
return load;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user