vkd3d-shader/hlsl: Return bool from hlsl_new_store_component().

This commit is contained in:
Zebediah Figura 2022-11-10 20:42:25 -06:00 committed by Alexandre Julliard
parent 6129399b4f
commit 145a2dfd2d
Notes: Alexandre Julliard 2023-05-09 22:25:23 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/196
3 changed files with 12 additions and 17 deletions

View File

@ -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,

View File

@ -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);

View File

@ -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);
}