[PATCH vkd3d v2 5/9] vkd3d-shader/hlsl: Pass a pointer to the location to hlsl_new_*_constant().

Francisco Casas fcasas at codeweavers.com
Tue Mar 29 15:15:09 CDT 2022


Signed-off-by: Francisco Casas <fcasas at codeweavers.com>


March 28, 2022 5:59 AM, "Giovanni Mascellani" <gmascellani at codeweavers.com> wrote:

> Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
> ---
> libs/vkd3d-shader/hlsl.c | 8 ++++----
> libs/vkd3d-shader/hlsl.h | 4 ++--
> libs/vkd3d-shader/hlsl.y | 8 ++++----
> libs/vkd3d-shader/hlsl_codegen.c | 6 +++---
> 4 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
> index d88b0b6d..36cc3a91 100644
> --- a/libs/vkd3d-shader/hlsl.c
> +++ b/libs/vkd3d-shader/hlsl.c
> @@ -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,
> - const struct vkd3d_shader_location loc)
> + const struct vkd3d_shader_location *loc)
> {
> struct hlsl_ir_constant *c;
> 
> if (!(c = hlsl_alloc(ctx, sizeof(*c))))
> 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;
> return c;
> }
> 
> 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;
> 
> if (!(c = hlsl_alloc(ctx, sizeof(*c))))
> 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;
> return c;
> }
> diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h
> index 0543e144..c9abbd4a 100644
> --- a/libs/vkd3d-shader/hlsl.h
> +++ b/libs/vkd3d-shader/hlsl.h
> @@ -738,7 +738,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 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,
> - 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_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);
> @@ -757,7 +757,7 @@ struct hlsl_ir_var *hlsl_new_synthetic_var(struct hlsl_ctx *ctx, const char
> *nam
> 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_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 vkd3d_shader_location loc);
> struct hlsl_ir_var *hlsl_new_var(struct hlsl_ctx *ctx, const char *name, struct hlsl_type *type,
> diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
> index 1ab56fba..41fa7df4 100644
> --- a/libs/vkd3d-shader/hlsl.y
> +++ b/libs/vkd3d-shader/hlsl.y
> @@ -573,7 +573,7 @@ static struct hlsl_ir_load *add_record_load(struct hlsl_ctx *ctx, struct list
> *i
> {
> 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;
> list_add_tail(instrs, &c->node.entry);
> 
> @@ -607,7 +607,7 @@ static struct hlsl_ir_load *add_array_load(struct hlsl_ctx *ctx, struct list
> *in
> 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;
> list_add_tail(instrs, &c->node.entry);
> if (!(mul = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, index, &c->node)))
> @@ -1399,7 +1399,7 @@ static bool add_increment(struct hlsl_ctx *ctx, struct list *instrs, bool
> decrem
> hlsl_error(ctx, &loc, VKD3D_SHADER_ERROR_HLSL_MODIFIES_CONST,
> "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;
> list_add_tail(instrs, &one->node.entry);
> 
> @@ -1452,7 +1452,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 (!(c = hlsl_new_uint_constant(ctx, field->reg_offset, node->loc)))
> + if (!(c = hlsl_new_uint_constant(ctx, field->reg_offset, &node->loc)))
> break;
> list_add_tail(list, &c->node.entry);
> 
> diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c
> index 98be3aeb..3d0f9e41 100644
> --- a/libs/vkd3d-shader/hlsl_codegen.c
> +++ b/libs/vkd3d-shader/hlsl_codegen.c
> @@ -92,7 +92,7 @@ static void prepend_input_copy(struct hlsl_ctx *ctx, struct list *instrs, struct
> return;
> 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;
> list_add_after(&load->node.entry, &offset->node.entry);
> 
> @@ -159,7 +159,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_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;
> list_add_tail(instrs, &offset->node.entry);
> 
> @@ -572,7 +572,7 @@ static bool split_copy(struct hlsl_ctx *ctx, struct hlsl_ir_store *store,
> struct hlsl_ir_load *split_load;
> 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;
> list_add_before(&store->node.entry, &c->node.entry);
> 
> -- 
> 2.35.1



More information about the wine-devel mailing list