Giovanni Mascellani : vkd3d-shader/hlsl: Pass a pointer to the location to hlsl_new_*_constant().

Alexandre Julliard julliard at winehq.org
Tue Apr 5 15:38:53 CDT 2022


Module: vkd3d
Branch: master
Commit: 39bd9b0943457aff51a1267cc3b3d357538175cb
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=39bd9b0943457aff51a1267cc3b3d357538175cb

Author: Giovanni Mascellani <gmascellani at codeweavers.com>
Date:   Tue Apr  5 12:33:10 2022 +0200

vkd3d-shader/hlsl: Pass a pointer to the location to hlsl_new_*_constant().

Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 fab06d7c..160de202 100644
--- a/libs/vkd3d-shader/hlsl.h
+++ b/libs/vkd3d-shader/hlsl.h
@@ -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 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);
@@ -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);
 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 a295dd14..fa22e6cd 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -574,7 +574,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);
 
@@ -608,7 +608,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)))
@@ -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,
                 "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);
 
@@ -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 (!(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 b6a8e393..881a6d62 100644
--- a/libs/vkd3d-shader/hlsl_codegen.c
+++ b/libs/vkd3d-shader/hlsl_codegen.c
@@ -94,7 +94,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);
 
@@ -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_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);
 
@@ -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_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);
 




More information about the wine-cvs mailing list