mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-shader/hlsl: Return void from hlsl_block_add_store_component().
This commit is contained in:
committed by
Henri Verbeet
parent
9e3ac35669
commit
009f5765df
Notes:
Henri Verbeet
2025-03-05 14:16:50 +01:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Francisco Casas (@fcasas) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1401
@@ -1550,20 +1550,20 @@ void hlsl_block_add_simple_store(struct hlsl_ctx *ctx, struct hlsl_block *block,
|
||||
hlsl_block_add_store_index(ctx, block, &lhs_deref, NULL, rhs, 0, &rhs->loc);
|
||||
}
|
||||
|
||||
bool hlsl_block_add_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block,
|
||||
void hlsl_block_add_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;
|
||||
struct hlsl_ir_store *store;
|
||||
|
||||
if (!(store = hlsl_alloc(ctx, sizeof(*store))))
|
||||
return false;
|
||||
return;
|
||||
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 false;
|
||||
return;
|
||||
}
|
||||
hlsl_block_add_block(block, &comp_path_block);
|
||||
hlsl_src_from_node(&store->rhs, rhs);
|
||||
@@ -1572,8 +1572,6 @@ bool hlsl_block_add_store_component(struct hlsl_ctx *ctx, struct hlsl_block *blo
|
||||
store->writemask = (1 << rhs->data_type->e.numeric.dimx) - 1;
|
||||
|
||||
hlsl_block_add_instr(block, &store->node);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
struct hlsl_ir_node *hlsl_new_call(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *decl,
|
||||
|
@@ -1520,7 +1520,7 @@ struct hlsl_ir_node *hlsl_block_add_load_component(struct hlsl_ctx *ctx, struct
|
||||
const struct hlsl_deref *deref, unsigned int comp, const struct vkd3d_shader_location *loc);
|
||||
void hlsl_block_add_simple_store(struct hlsl_ctx *ctx, struct hlsl_block *block,
|
||||
struct hlsl_ir_var *lhs, struct hlsl_ir_node *rhs);
|
||||
bool hlsl_block_add_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block,
|
||||
void hlsl_block_add_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block,
|
||||
const struct hlsl_deref *lhs, unsigned int comp, struct hlsl_ir_node *rhs);
|
||||
void hlsl_block_add_store_index(struct hlsl_ctx *ctx, struct hlsl_block *block,
|
||||
const struct hlsl_deref *lhs, struct hlsl_ir_node *idx, struct hlsl_ir_node *rhs,
|
||||
|
@@ -1611,8 +1611,7 @@ static struct hlsl_ir_node *add_expr(struct hlsl_ctx *ctx, struct hlsl_block *bl
|
||||
if (!(value = add_expr(ctx, block, op, cell_operands, scalar_type, loc)))
|
||||
return NULL;
|
||||
|
||||
if (!hlsl_block_add_store_component(ctx, block, &var_deref, i, value))
|
||||
return NULL;
|
||||
hlsl_block_add_store_component(ctx, block, &var_deref, i, value);
|
||||
}
|
||||
|
||||
if (!(var_load = hlsl_new_var_load(ctx, var, loc)))
|
||||
@@ -2216,11 +2215,7 @@ static bool add_assignment(struct hlsl_ctx *ctx, struct hlsl_block *block, struc
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!hlsl_block_add_store_component(ctx, block, &deref, component, load))
|
||||
{
|
||||
hlsl_cleanup_deref(&deref);
|
||||
return false;
|
||||
}
|
||||
hlsl_block_add_store_component(ctx, block, &deref, component, load);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2393,8 +2388,7 @@ static void initialize_var_components(struct hlsl_ctx *ctx, struct hlsl_block *i
|
||||
if (!(conv = add_implicit_conversion(ctx, instrs, load, dst_comp_type, &src->loc)))
|
||||
return;
|
||||
|
||||
if (!hlsl_block_add_store_component(ctx, instrs, &dst_deref, *store_index, conv))
|
||||
return;
|
||||
hlsl_block_add_store_component(ctx, instrs, &dst_deref, *store_index, conv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3138,8 +3132,7 @@ static struct hlsl_ir_node *add_user_call(struct hlsl_ctx *ctx,
|
||||
return NULL;
|
||||
hlsl_block_add_instr(args->instrs, comp);
|
||||
|
||||
if (!hlsl_block_add_store_component(ctx, args->instrs, ¶m_deref, j, comp))
|
||||
return NULL;
|
||||
hlsl_block_add_store_component(ctx, args->instrs, ¶m_deref, j, comp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4454,9 +4447,8 @@ static bool intrinsic_mul(struct hlsl_ctx *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
if (!hlsl_block_add_store_component(ctx, params->instrs, &var_deref,
|
||||
j * matrix_type->e.numeric.dimx + i, instr))
|
||||
return false;
|
||||
hlsl_block_add_store_component(ctx, params->instrs, &var_deref,
|
||||
j * matrix_type->e.numeric.dimx + i, instr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5112,9 +5104,8 @@ static bool intrinsic_transpose(struct hlsl_ctx *ctx,
|
||||
j * arg->data_type->e.numeric.dimx + i, loc)))
|
||||
return false;
|
||||
|
||||
if (!hlsl_block_add_store_component(ctx, params->instrs, &var_deref,
|
||||
i * var->data_type->e.numeric.dimx + j, load))
|
||||
return false;
|
||||
hlsl_block_add_store_component(ctx, params->instrs, &var_deref,
|
||||
i * var->data_type->e.numeric.dimx + j, load);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1159,8 +1159,7 @@ static bool lower_complex_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
|
||||
|
||||
cast = hlsl_block_add_cast(ctx, block, component_load, dst_comp_type, &arg->loc);
|
||||
|
||||
if (!hlsl_block_add_store_component(ctx, block, &var_deref, dst_idx, cast))
|
||||
return false;
|
||||
hlsl_block_add_store_component(ctx, block, &var_deref, dst_idx, cast);
|
||||
}
|
||||
|
||||
if (!(load = hlsl_new_var_load(ctx, var, &instr->loc)))
|
||||
@@ -1204,8 +1203,7 @@ static bool lower_matrix_swizzles(struct hlsl_ctx *ctx, struct hlsl_ir_node *ins
|
||||
if (!(load = hlsl_add_load_component(ctx, block, swizzle->val.node, k, &instr->loc)))
|
||||
return false;
|
||||
|
||||
if (!hlsl_block_add_store_component(ctx, block, &var_deref, i, load))
|
||||
return false;
|
||||
hlsl_block_add_store_component(ctx, block, &var_deref, i, load);
|
||||
}
|
||||
|
||||
if (!(var_load = hlsl_new_var_load(ctx, var, &instr->loc)))
|
||||
@@ -3561,9 +3559,7 @@ static bool lower_trig(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct
|
||||
for (i = 0; i < type->e.numeric.dimx; ++i)
|
||||
{
|
||||
sincos = hlsl_block_add_unary_expr(ctx, block, op, comps[i], &instr->loc);
|
||||
|
||||
if (!hlsl_block_add_store_component(ctx, block, &var_deref, i, sincos))
|
||||
return false;
|
||||
hlsl_block_add_store_component(ctx, block, &var_deref, i, sincos);
|
||||
}
|
||||
|
||||
if (!(var_load = hlsl_new_load_index(ctx, &var_deref, NULL, &instr->loc)))
|
||||
|
Reference in New Issue
Block a user