diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 58d5c514..e57e26c0 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -1067,16 +1067,13 @@ static void init_node(struct hlsl_ir_node *node, enum hlsl_ir_node_type type, struct hlsl_ir_node *hlsl_new_simple_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *lhs, struct hlsl_ir_node *rhs) { - struct hlsl_ir_store *store; struct hlsl_deref lhs_deref; hlsl_init_simple_deref_from_var(&lhs_deref, lhs); - if (!(store = hlsl_new_store_index(ctx, &lhs_deref, NULL, rhs, 0, &rhs->loc))) - return NULL; - return &store->node; + return hlsl_new_store_index(ctx, &lhs_deref, NULL, rhs, 0, &rhs->loc); } -struct hlsl_ir_store *hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hlsl_deref *lhs, +struct hlsl_ir_node *hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hlsl_deref *lhs, struct hlsl_ir_node *idx, struct hlsl_ir_node *rhs, unsigned int writemask, const struct vkd3d_shader_location *loc) { struct hlsl_ir_store *store; @@ -1105,7 +1102,7 @@ struct hlsl_ir_store *hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hl writemask = (1 << rhs->data_type->dimx) - 1; store->writemask = writemask; - return store; + return &store->node; } bool hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block, diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index f5d73d48..6693d43e 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -1123,7 +1123,7 @@ struct hlsl_ir_node *hlsl_new_load_component(struct hlsl_ctx *ctx, struct hlsl_b const struct hlsl_deref *deref, unsigned int comp, const struct vkd3d_shader_location *loc); struct hlsl_ir_node *hlsl_new_simple_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *lhs, struct hlsl_ir_node *rhs); -struct hlsl_ir_store *hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hlsl_deref *lhs, +struct hlsl_ir_node *hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hlsl_deref *lhs, struct hlsl_ir_node *idx, struct hlsl_ir_node *rhs, unsigned int writemask, const struct vkd3d_shader_location *loc); bool hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block, const struct hlsl_deref *lhs, unsigned int comp, struct hlsl_ir_node *rhs); diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index e3c0a831..3a9ad33d 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1753,8 +1753,7 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in for (i = 0; i < mat->data_type->dimx; ++i) { - struct hlsl_ir_node *cell, *load; - struct hlsl_ir_store *store; + struct hlsl_ir_node *cell, *load, *store; struct hlsl_ir_constant *c; struct hlsl_deref deref; @@ -1780,13 +1779,13 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in hlsl_cleanup_deref(&deref); return NULL; } - list_add_tail(instrs, &store->node.entry); + list_add_tail(instrs, &store->entry); hlsl_cleanup_deref(&deref); } } else { - struct hlsl_ir_store *store; + struct hlsl_ir_node *store; struct hlsl_deref deref; if (!hlsl_init_deref_from_index_chain(ctx, &deref, lhs)) @@ -1797,7 +1796,7 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in hlsl_cleanup_deref(&deref); return NULL; } - list_add_tail(instrs, &store->node.entry); + list_add_tail(instrs, &store->entry); hlsl_cleanup_deref(&deref); } diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 40d19eed..3254739b 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -353,10 +353,9 @@ static void prepend_input_copy(struct hlsl_ctx *ctx, struct list *instrs, struct for (i = 0; i < hlsl_type_major_size(type); ++i) { - struct hlsl_ir_store *store; + struct hlsl_ir_node *store, *cast; struct hlsl_ir_var *input; struct hlsl_ir_load *load; - struct hlsl_ir_node *cast; if (!(input = add_semantic_var(ctx, var, vector_type_src, modifiers, semantic, semantic_index + i, false, loc))) @@ -378,7 +377,7 @@ static void prepend_input_copy(struct hlsl_ctx *ctx, struct list *instrs, struct if (!(store = hlsl_new_store_index(ctx, &lhs->src, &c->node, cast, 0, &var->loc))) return; - list_add_after(&c->node.entry, &store->node.entry); + list_add_after(&c->node.entry, &store->entry); } else { @@ -386,7 +385,7 @@ static void prepend_input_copy(struct hlsl_ctx *ctx, struct list *instrs, struct if (!(store = hlsl_new_store_index(ctx, &lhs->src, NULL, cast, 0, &var->loc))) return; - list_add_after(&cast->entry, &store->node.entry); + list_add_after(&cast->entry, &store->entry); } } } @@ -868,7 +867,7 @@ static struct hlsl_ir_node *add_zero_mipmap_level(struct hlsl_ctx *ctx, struct h struct hlsl_ir_load *coords_load; struct hlsl_deref coords_deref; struct hlsl_ir_constant *zero; - struct hlsl_ir_store *store; + struct hlsl_ir_node *store; struct hlsl_ir_var *coords; assert(dim_count < 4); @@ -880,19 +879,19 @@ static struct hlsl_ir_node *add_zero_mipmap_level(struct hlsl_ctx *ctx, struct h hlsl_init_simple_deref_from_var(&coords_deref, coords); if (!(store = hlsl_new_store_index(ctx, &coords_deref, NULL, index, (1u << dim_count) - 1, loc))) return NULL; - list_add_after(&index->entry, &store->node.entry); + list_add_after(&index->entry, &store->entry); if (!(zero = hlsl_new_uint_constant(ctx, 0, loc))) return NULL; - list_add_after(&store->node.entry, &zero->node.entry); + list_add_after(&store->entry, &zero->node.entry); if (!(store = hlsl_new_store_index(ctx, &coords_deref, NULL, &zero->node, 1u << dim_count, loc))) return NULL; - list_add_after(&zero->node.entry, &store->node.entry); + list_add_after(&zero->node.entry, &store->entry); if (!(coords_load = hlsl_new_var_load(ctx, coords, loc))) return NULL; - list_add_after(&store->node.entry, &coords_load->node.entry); + list_add_after(&store->entry, &coords_load->node.entry); return &coords_load->node; } @@ -964,7 +963,6 @@ static bool lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, for (i = 0; i < mat->data_type->dimx; ++i) { - struct hlsl_ir_store *store; struct hlsl_ir_constant *c; if (!(c = hlsl_new_uint_constant(ctx, i, &instr->loc))) @@ -981,7 +979,7 @@ static bool lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, if (!(store = hlsl_new_store_index(ctx, &row_deref, &c->node, &load->node, 0, &instr->loc))) return false; - list_add_before(&instr->entry, &store->node.entry); + list_add_before(&instr->entry, &store->entry); } if (!(load = hlsl_new_var_load(ctx, var, &instr->loc))) @@ -1769,7 +1767,7 @@ static bool fold_redundant_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *inst static bool split_copy(struct hlsl_ctx *ctx, struct hlsl_ir_store *store, const struct hlsl_ir_load *load, const unsigned int idx, struct hlsl_type *type) { - struct hlsl_ir_store *split_store; + struct hlsl_ir_node *split_store; struct hlsl_ir_load *split_load; struct hlsl_ir_constant *c; @@ -1783,7 +1781,7 @@ static bool split_copy(struct hlsl_ctx *ctx, struct hlsl_ir_store *store, if (!(split_store = hlsl_new_store_index(ctx, &store->lhs, &c->node, &split_load->node, 0, &store->node.loc))) return false; - list_add_before(&store->node.entry, &split_store->node.entry); + list_add_before(&store->node.entry, &split_store->entry); return true; }