From: Zebediah Figura zfigura@codeweavers.com
--- libs/vkd3d-shader/hlsl.c | 8 ++++---- libs/vkd3d-shader/hlsl.h | 2 +- libs/vkd3d-shader/hlsl.y | 19 +++++++------------ 3 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 253437a7..54bfd3ba 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -1105,7 +1105,7 @@ struct hlsl_ir_store *hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hl return store; }
-struct hlsl_ir_store *hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block, +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) { struct hlsl_block comp_path_block; @@ -1114,13 +1114,13 @@ struct hlsl_ir_store *hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl hlsl_block_init(block);
if (!(store = hlsl_alloc(ctx, sizeof(*store)))) - return NULL; + return false; init_node(&store->node, HLSL_IR_STORE, NULL, &rhs->loc);
if (!init_deref_from_component_index(ctx, &comp_path_block, &store->lhs, lhs, comp, &rhs->loc)) { vkd3d_free(store); - return NULL; + return false; } hlsl_block_add_block(block, &comp_path_block); hlsl_src_from_node(&store->rhs, rhs); @@ -1130,7 +1130,7 @@ struct hlsl_ir_store *hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl
hlsl_block_add_instr(block, &store->node);
- return store; + return true; }
struct hlsl_ir_node *hlsl_new_call(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *decl, diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index a3453538..fc410e26 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -1125,7 +1125,7 @@ struct hlsl_ir_node *hlsl_new_load_component(struct hlsl_ctx *ctx, struct hlsl_b struct hlsl_ir_store *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 *idx, struct hlsl_ir_node *rhs, unsigned int writemask, const struct vkd3d_shader_location *loc); -struct hlsl_ir_store *hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block, +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);
bool hlsl_index_is_noncontiguous(struct hlsl_ir_index *index); diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index a3ddae51..58aef12e 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -313,7 +313,6 @@ static struct hlsl_ir_node *add_cast(struct hlsl_ctx *ctx, struct list *instrs, { struct hlsl_ir_node *component_load; struct hlsl_type *dst_comp_type; - struct hlsl_ir_store *store; struct hlsl_block block; unsigned int src_idx;
@@ -341,7 +340,7 @@ static struct hlsl_ir_node *add_cast(struct hlsl_ctx *ctx, struct list *instrs, return NULL; list_add_tail(instrs, &cast->entry);
- if (!(store = hlsl_new_store_component(ctx, &block, &var_deref, dst_idx, cast))) + if (!hlsl_new_store_component(ctx, &block, &var_deref, dst_idx, cast)) return NULL; list_move_tail(instrs, &block.instrs); } @@ -1276,7 +1275,6 @@ static struct hlsl_ir_node *add_expr(struct hlsl_ctx *ctx, struct list *instrs, for (i = 0; i < type->dimy * type->dimx; ++i) { struct hlsl_ir_node *value, *cell_operands[HLSL_MAX_OPERANDS] = { NULL }; - struct hlsl_ir_store *store; struct hlsl_block block; unsigned int j;
@@ -1294,7 +1292,7 @@ static struct hlsl_ir_node *add_expr(struct hlsl_ctx *ctx, struct list *instrs, if (!(value = add_expr(ctx, instrs, op, cell_operands, scalar_type, loc))) return NULL;
- if (!(store = hlsl_new_store_component(ctx, &block, &var_deref, i, value))) + if (!hlsl_new_store_component(ctx, &block, &var_deref, i, value)) return NULL; list_move_tail(instrs, &block.instrs); } @@ -1860,7 +1858,6 @@ static void initialize_var_components(struct hlsl_ctx *ctx, struct list *instrs, { struct hlsl_ir_node *conv, *load; struct hlsl_type *dst_comp_type; - struct hlsl_ir_store *store; struct hlsl_block block;
if (!(load = add_load_component(ctx, instrs, src, k, &src->loc))) @@ -1871,7 +1868,7 @@ static void initialize_var_components(struct hlsl_ctx *ctx, struct list *instrs, if (!(conv = add_implicit_conversion(ctx, instrs, load, dst_comp_type, &src->loc))) return;
- if (!(store = hlsl_new_store_component(ctx, &block, &dst_deref, *store_index, conv))) + if (!hlsl_new_store_component(ctx, &block, &dst_deref, *store_index, conv)) return; list_move_tail(instrs, &block.instrs);
@@ -2881,7 +2878,7 @@ static bool intrinsic_lit(struct hlsl_ctx *ctx, if (!(diffuse = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MAX, n_l, zero, loc))) return false;
- if (!(store = hlsl_new_store_component(ctx, &block, &var_deref, 1, diffuse))) + if (!hlsl_new_store_component(ctx, &block, &var_deref, 1, diffuse)) return false; list_move_tail(params->instrs, &block.instrs);
@@ -2901,7 +2898,7 @@ static bool intrinsic_lit(struct hlsl_ctx *ctx, if (!(load = hlsl_add_conditional(ctx, params->instrs, specular_or, zero, specular_pow))) return false;
- if (!(store = hlsl_new_store_component(ctx, &block, &var_deref, 2, &load->node))) + if (!hlsl_new_store_component(ctx, &block, &var_deref, 2, &load->node)) return false; list_move_tail(params->instrs, &block.instrs);
@@ -3034,7 +3031,6 @@ static bool intrinsic_mul(struct hlsl_ctx *ctx, for (j = 0; j < matrix_type->dimy; ++j) { struct hlsl_ir_node *instr = NULL; - struct hlsl_ir_store *store; struct hlsl_block block;
for (k = 0; k < cast_type1->dimx && k < cast_type2->dimy; ++k) @@ -3061,7 +3057,7 @@ static bool intrinsic_mul(struct hlsl_ctx *ctx, } }
- if (!(store = hlsl_new_store_component(ctx, &block, &var_deref, j * matrix_type->dimx + i, instr))) + if (!hlsl_new_store_component(ctx, &block, &var_deref, j * matrix_type->dimx + i, instr)) return false; list_move_tail(params->instrs, &block.instrs); } @@ -3398,13 +3394,12 @@ static bool intrinsic_transpose(struct hlsl_ctx *ctx, { for (j = 0; j < arg_type->dimy; ++j) { - struct hlsl_ir_store *store; struct hlsl_block block;
if (!(load = add_load_component(ctx, params->instrs, arg, j * arg->data_type->dimx + i, loc))) return false;
- if (!(store = hlsl_new_store_component(ctx, &block, &var_deref, i * var->data_type->dimx + j, load))) + if (!hlsl_new_store_component(ctx, &block, &var_deref, i * var->data_type->dimx + j, load)) return false; list_move_tail(params->instrs, &block.instrs); }