Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com
Il 15/02/22 21:17, Francisco Casas ha scritto:
Signed-off-by: Francisco Casas fcasas@codeweavers.com
libs/vkd3d-shader/hlsl.y | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index a24192a3..9cb14f52 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1469,7 +1469,7 @@ static void initialize_numeric_var(struct hlsl_ctx *ctx, struct hlsl_ir_var *var } }
-static void struct_var_initializer(struct hlsl_ctx *ctx, struct list *list, struct hlsl_ir_var *var, +static void struct_var_initializer(struct hlsl_ctx *ctx, struct hlsl_ir_var *var, struct parse_initializer *initializer) { struct hlsl_type *type = var->data_type; @@ -1481,13 +1481,9 @@ static void struct_var_initializer(struct hlsl_ctx *ctx, struct list *list, stru hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_WRONG_PARAMETER_COUNT, "Expected %u components in initializer, but got %u.", hlsl_type_component_count(type), initializer_size(initializer));
free_parse_initializer(initializer); return; }
list_move_tail(list, initializer->instrs);
vkd3d_free(initializer->instrs);
LIST_FOR_EACH_ENTRY(field, type->e.elements, struct hlsl_struct_field, entry) { struct hlsl_ir_node *node = initializer->args[i];
@@ -1501,19 +1497,17 @@ static void struct_var_initializer(struct hlsl_ctx *ctx, struct list *list, stru { if (!(c = hlsl_new_uint_constant(ctx, field->reg_offset, node->loc))) break;
list_add_tail(list, &c->node.entry);
list_add_tail(initializer->instrs, &c->node.entry); if (!(store = hlsl_new_store(ctx, var, &c->node, node, 0, node->loc))) break;
list_add_tail(list, &store->node.entry);
list_add_tail(initializer->instrs, &store->node.entry); } else { hlsl_fixme(ctx, &node->loc, "Implicit cast in structure initializer."); } }
vkd3d_free(initializer->args); }
static void free_parse_variable_def(struct parse_variable_def *v)
@@ -1663,7 +1657,10 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
if (type->type == HLSL_CLASS_STRUCT) {
struct_var_initializer(ctx, statements_list, var, &v->initializer);
struct_var_initializer(ctx, var, &v->initializer);
list_move_tail(statements_list, v->initializer.instrs);
free_parse_initializer(&v->initializer); vkd3d_free(v); continue; }