Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- libs/vkd3d-shader/hlsl.y | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 291f8392..ec0e23bb 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -588,12 +588,12 @@ static bool add_array_load(struct hlsl_ctx *ctx, struct list *instrs, struct hls struct hlsl_type *data_type; struct hlsl_ir_constant *c; struct hlsl_ir_node *mul; + unsigned int stride;
if (expr_type->type == HLSL_CLASS_ARRAY) { data_type = expr_type->e.array.type; - if (!(c = hlsl_new_uint_constant(ctx, hlsl_type_get_array_element_reg_size(data_type), &loc))) - return false; + stride = hlsl_type_get_array_element_reg_size(data_type); } else if (expr_type->type == HLSL_CLASS_MATRIX) { @@ -604,8 +604,7 @@ static bool add_array_load(struct hlsl_ctx *ctx, struct list *instrs, struct hls else if (expr_type->type == HLSL_CLASS_VECTOR) { data_type = hlsl_get_scalar_type(ctx, expr_type->base_type); - if (!(c = hlsl_new_uint_constant(ctx, 1, &loc))) - return false; + stride = 1; } else { @@ -616,6 +615,8 @@ static bool add_array_load(struct hlsl_ctx *ctx, struct list *instrs, struct hls return false; }
+ if (!(c = hlsl_new_uint_constant(ctx, stride, &loc))) + return false; list_add_tail(instrs, &c->node.entry); if (!(mul = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, index, &c->node))) return false;