mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Simplify flow in add_array_load().
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
committed by
Alexandre Julliard
parent
c5c50a8b9b
commit
e2b4f01a9f
@@ -587,13 +587,18 @@ static bool add_array_load(struct hlsl_ctx *ctx, struct list *instrs, struct hls
|
|||||||
const struct hlsl_type *expr_type = array->data_type;
|
const struct hlsl_type *expr_type = array->data_type;
|
||||||
struct hlsl_type *data_type;
|
struct hlsl_type *data_type;
|
||||||
struct hlsl_ir_constant *c;
|
struct hlsl_ir_constant *c;
|
||||||
struct hlsl_ir_node *mul;
|
|
||||||
|
|
||||||
if (expr_type->type == HLSL_CLASS_ARRAY)
|
if (expr_type->type == HLSL_CLASS_ARRAY)
|
||||||
{
|
{
|
||||||
data_type = expr_type->e.array.type;
|
data_type = expr_type->e.array.type;
|
||||||
|
|
||||||
if (!(c = hlsl_new_uint_constant(ctx, hlsl_type_get_array_element_reg_size(data_type), &loc)))
|
if (!(c = hlsl_new_uint_constant(ctx, hlsl_type_get_array_element_reg_size(data_type), &loc)))
|
||||||
return false;
|
return false;
|
||||||
|
list_add_tail(instrs, &c->node.entry);
|
||||||
|
|
||||||
|
if (!(index = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, index, &c->node)))
|
||||||
|
return false;
|
||||||
|
list_add_tail(instrs, &index->entry);
|
||||||
}
|
}
|
||||||
else if (expr_type->type == HLSL_CLASS_MATRIX)
|
else if (expr_type->type == HLSL_CLASS_MATRIX)
|
||||||
{
|
{
|
||||||
@@ -604,8 +609,6 @@ static bool add_array_load(struct hlsl_ctx *ctx, struct list *instrs, struct hls
|
|||||||
else if (expr_type->type == HLSL_CLASS_VECTOR)
|
else if (expr_type->type == HLSL_CLASS_VECTOR)
|
||||||
{
|
{
|
||||||
data_type = hlsl_get_scalar_type(ctx, expr_type->base_type);
|
data_type = hlsl_get_scalar_type(ctx, expr_type->base_type);
|
||||||
if (!(c = hlsl_new_uint_constant(ctx, 1, &loc)))
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -616,12 +619,6 @@ static bool add_array_load(struct hlsl_ctx *ctx, struct list *instrs, struct hls
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
list_add_tail(instrs, &c->node.entry);
|
|
||||||
if (!(mul = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, index, &c->node)))
|
|
||||||
return false;
|
|
||||||
list_add_tail(instrs, &mul->entry);
|
|
||||||
index = mul;
|
|
||||||
|
|
||||||
return !!add_load(ctx, instrs, array, index, data_type, loc);
|
return !!add_load(ctx, instrs, array, index, data_type, loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user