mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Pass a pointer to the location to hlsl_new_*_constant().
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Francisco Casas <fcasas@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
58956922df
commit
39bd9b0943
@ -564,25 +564,25 @@ struct hlsl_ir_store *hlsl_new_simple_store(struct hlsl_ctx *ctx, struct hlsl_ir
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct hlsl_ir_constant *hlsl_new_int_constant(struct hlsl_ctx *ctx, int n,
|
struct hlsl_ir_constant *hlsl_new_int_constant(struct hlsl_ctx *ctx, int n,
|
||||||
const struct vkd3d_shader_location loc)
|
const struct vkd3d_shader_location *loc)
|
||||||
{
|
{
|
||||||
struct hlsl_ir_constant *c;
|
struct hlsl_ir_constant *c;
|
||||||
|
|
||||||
if (!(c = hlsl_alloc(ctx, sizeof(*c))))
|
if (!(c = hlsl_alloc(ctx, sizeof(*c))))
|
||||||
return NULL;
|
return NULL;
|
||||||
init_node(&c->node, HLSL_IR_CONSTANT, hlsl_get_scalar_type(ctx, HLSL_TYPE_INT), loc);
|
init_node(&c->node, HLSL_IR_CONSTANT, hlsl_get_scalar_type(ctx, HLSL_TYPE_INT), *loc);
|
||||||
c->value[0].i = n;
|
c->value[0].i = n;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct hlsl_ir_constant *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n,
|
struct hlsl_ir_constant *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n,
|
||||||
const struct vkd3d_shader_location loc)
|
const struct vkd3d_shader_location *loc)
|
||||||
{
|
{
|
||||||
struct hlsl_ir_constant *c;
|
struct hlsl_ir_constant *c;
|
||||||
|
|
||||||
if (!(c = hlsl_alloc(ctx, sizeof(*c))))
|
if (!(c = hlsl_alloc(ctx, sizeof(*c))))
|
||||||
return NULL;
|
return NULL;
|
||||||
init_node(&c->node, HLSL_IR_CONSTANT, hlsl_get_scalar_type(ctx, HLSL_TYPE_UINT), loc);
|
init_node(&c->node, HLSL_IR_CONSTANT, hlsl_get_scalar_type(ctx, HLSL_TYPE_UINT), *loc);
|
||||||
c->value[0].u = n;
|
c->value[0].u = n;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -739,7 +739,7 @@ struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx, struct hl
|
|||||||
struct list *parameters, const struct hlsl_semantic *semantic, struct vkd3d_shader_location loc);
|
struct list *parameters, const struct hlsl_semantic *semantic, struct vkd3d_shader_location loc);
|
||||||
struct hlsl_ir_if *hlsl_new_if(struct hlsl_ctx *ctx, struct hlsl_ir_node *condition, struct vkd3d_shader_location loc);
|
struct hlsl_ir_if *hlsl_new_if(struct hlsl_ctx *ctx, struct hlsl_ir_node *condition, struct vkd3d_shader_location loc);
|
||||||
struct hlsl_ir_constant *hlsl_new_int_constant(struct hlsl_ctx *ctx, int n,
|
struct hlsl_ir_constant *hlsl_new_int_constant(struct hlsl_ctx *ctx, int n,
|
||||||
const struct vkd3d_shader_location loc);
|
const struct vkd3d_shader_location *loc);
|
||||||
struct hlsl_ir_jump *hlsl_new_jump(struct hlsl_ctx *ctx, enum hlsl_ir_jump_type type, struct vkd3d_shader_location loc);
|
struct hlsl_ir_jump *hlsl_new_jump(struct hlsl_ctx *ctx, enum hlsl_ir_jump_type type, struct vkd3d_shader_location loc);
|
||||||
struct hlsl_ir_load *hlsl_new_load(struct hlsl_ctx *ctx, struct hlsl_ir_var *var, struct hlsl_ir_node *offset,
|
struct hlsl_ir_load *hlsl_new_load(struct hlsl_ctx *ctx, struct hlsl_ir_var *var, struct hlsl_ir_node *offset,
|
||||||
struct hlsl_type *type, struct vkd3d_shader_location loc);
|
struct hlsl_type *type, struct vkd3d_shader_location loc);
|
||||||
@ -758,7 +758,7 @@ struct hlsl_ir_var *hlsl_new_synthetic_var(struct hlsl_ctx *ctx, const char *nam
|
|||||||
const struct vkd3d_shader_location loc);
|
const struct vkd3d_shader_location loc);
|
||||||
struct hlsl_type *hlsl_new_texture_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim, struct hlsl_type *format);
|
struct hlsl_type *hlsl_new_texture_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim, struct hlsl_type *format);
|
||||||
struct hlsl_ir_constant *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n,
|
struct hlsl_ir_constant *hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n,
|
||||||
const struct vkd3d_shader_location loc);
|
const struct vkd3d_shader_location *loc);
|
||||||
struct hlsl_ir_node *hlsl_new_unary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg,
|
struct hlsl_ir_node *hlsl_new_unary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg,
|
||||||
struct vkd3d_shader_location loc);
|
struct vkd3d_shader_location loc);
|
||||||
struct hlsl_ir_var *hlsl_new_var(struct hlsl_ctx *ctx, const char *name, struct hlsl_type *type,
|
struct hlsl_ir_var *hlsl_new_var(struct hlsl_ctx *ctx, const char *name, struct hlsl_type *type,
|
||||||
|
@ -574,7 +574,7 @@ static struct hlsl_ir_load *add_record_load(struct hlsl_ctx *ctx, struct list *i
|
|||||||
{
|
{
|
||||||
struct hlsl_ir_constant *c;
|
struct hlsl_ir_constant *c;
|
||||||
|
|
||||||
if (!(c = hlsl_new_uint_constant(ctx, field->reg_offset, loc)))
|
if (!(c = hlsl_new_uint_constant(ctx, field->reg_offset, &loc)))
|
||||||
return NULL;
|
return NULL;
|
||||||
list_add_tail(instrs, &c->node.entry);
|
list_add_tail(instrs, &c->node.entry);
|
||||||
|
|
||||||
@ -608,7 +608,7 @@ static struct hlsl_ir_load *add_array_load(struct hlsl_ctx *ctx, struct list *in
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(c = hlsl_new_uint_constant(ctx, hlsl_type_get_array_element_reg_size(data_type), loc)))
|
if (!(c = hlsl_new_uint_constant(ctx, hlsl_type_get_array_element_reg_size(data_type), &loc)))
|
||||||
return NULL;
|
return NULL;
|
||||||
list_add_tail(instrs, &c->node.entry);
|
list_add_tail(instrs, &c->node.entry);
|
||||||
if (!(mul = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, index, &c->node)))
|
if (!(mul = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, index, &c->node)))
|
||||||
@ -1424,7 +1424,7 @@ static bool add_increment(struct hlsl_ctx *ctx, struct list *instrs, bool decrem
|
|||||||
hlsl_error(ctx, &loc, VKD3D_SHADER_ERROR_HLSL_MODIFIES_CONST,
|
hlsl_error(ctx, &loc, VKD3D_SHADER_ERROR_HLSL_MODIFIES_CONST,
|
||||||
"Argument to %s%screment operator is const.", post ? "post" : "pre", decrement ? "de" : "in");
|
"Argument to %s%screment operator is const.", post ? "post" : "pre", decrement ? "de" : "in");
|
||||||
|
|
||||||
if (!(one = hlsl_new_int_constant(ctx, 1, loc)))
|
if (!(one = hlsl_new_int_constant(ctx, 1, &loc)))
|
||||||
return false;
|
return false;
|
||||||
list_add_tail(instrs, &one->node.entry);
|
list_add_tail(instrs, &one->node.entry);
|
||||||
|
|
||||||
@ -1477,7 +1477,7 @@ static void struct_var_initializer(struct hlsl_ctx *ctx, struct list *list, stru
|
|||||||
|
|
||||||
if (hlsl_type_component_count(field->type) == hlsl_type_component_count(node->data_type))
|
if (hlsl_type_component_count(field->type) == hlsl_type_component_count(node->data_type))
|
||||||
{
|
{
|
||||||
if (!(c = hlsl_new_uint_constant(ctx, field->reg_offset, node->loc)))
|
if (!(c = hlsl_new_uint_constant(ctx, field->reg_offset, &node->loc)))
|
||||||
break;
|
break;
|
||||||
list_add_tail(list, &c->node.entry);
|
list_add_tail(list, &c->node.entry);
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ static void prepend_input_copy(struct hlsl_ctx *ctx, struct list *instrs, struct
|
|||||||
return;
|
return;
|
||||||
list_add_head(instrs, &load->node.entry);
|
list_add_head(instrs, &load->node.entry);
|
||||||
|
|
||||||
if (!(offset = hlsl_new_uint_constant(ctx, field_offset, var->loc)))
|
if (!(offset = hlsl_new_uint_constant(ctx, field_offset, &var->loc)))
|
||||||
return;
|
return;
|
||||||
list_add_after(&load->node.entry, &offset->node.entry);
|
list_add_after(&load->node.entry, &offset->node.entry);
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ static void append_output_copy(struct hlsl_ctx *ctx, struct list *instrs, struct
|
|||||||
list_add_before(&var->scope_entry, &output->scope_entry);
|
list_add_before(&var->scope_entry, &output->scope_entry);
|
||||||
list_add_tail(&ctx->extern_vars, &output->extern_entry);
|
list_add_tail(&ctx->extern_vars, &output->extern_entry);
|
||||||
|
|
||||||
if (!(offset = hlsl_new_uint_constant(ctx, field_offset, var->loc)))
|
if (!(offset = hlsl_new_uint_constant(ctx, field_offset, &var->loc)))
|
||||||
return;
|
return;
|
||||||
list_add_tail(instrs, &offset->node.entry);
|
list_add_tail(instrs, &offset->node.entry);
|
||||||
|
|
||||||
@ -577,7 +577,7 @@ static bool split_copy(struct hlsl_ctx *ctx, struct hlsl_ir_store *store,
|
|||||||
struct hlsl_ir_load *split_load;
|
struct hlsl_ir_load *split_load;
|
||||||
struct hlsl_ir_constant *c;
|
struct hlsl_ir_constant *c;
|
||||||
|
|
||||||
if (!(c = hlsl_new_uint_constant(ctx, offset, store->node.loc)))
|
if (!(c = hlsl_new_uint_constant(ctx, offset, &store->node.loc)))
|
||||||
return false;
|
return false;
|
||||||
list_add_before(&store->node.entry, &c->node.entry);
|
list_add_before(&store->node.entry, &c->node.entry);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user