Signed-off-by: Francisco Casas fcasas@codeweavers.com
April 18, 2022 2:35 AM, "Giovanni Mascellani" gmascellani@codeweavers.com wrote:
From: Zebediah Figura zfigura@codeweavers.com
The original patch also change add_load(), but I dropped that part because I need add_load()'s return value for "Support vector indexing".
libs/vkd3d-shader/hlsl.y | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 58d71ff6..fd808648 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -569,19 +569,19 @@ static struct hlsl_ir_load *add_load(struct hlsl_ctx *ctx, struct list *instrs, return load; }
-static struct hlsl_ir_load *add_record_load(struct hlsl_ctx *ctx, struct list *instrs, struct hlsl_ir_node *record, +static bool add_record_load(struct hlsl_ctx *ctx, struct list *instrs, struct hlsl_ir_node *record, const struct hlsl_struct_field *field, const struct vkd3d_shader_location loc) { struct hlsl_ir_constant *c;
if (!(c = hlsl_new_uint_constant(ctx, field->reg_offset, &loc)))
- return NULL;
- return false;
list_add_tail(instrs, &c->node.entry);
- return add_load(ctx, instrs, record, &c->node, field->type, loc);
- return !!add_load(ctx, instrs, record, &c->node, field->type, loc);
}
-static struct hlsl_ir_load *add_array_load(struct hlsl_ctx *ctx, struct list *instrs, struct hlsl_ir_node *array, +static bool add_array_load(struct hlsl_ctx *ctx, struct list *instrs, struct hlsl_ir_node *array, struct hlsl_ir_node *index, const struct vkd3d_shader_location loc) { const struct hlsl_type *expr_type = array->data_type; @@ -597,7 +597,7 @@ static struct hlsl_ir_load *add_array_load(struct hlsl_ctx *ctx, struct list *in { /* This needs to be lowered now, while we still have type information. */ FIXME("Index of matrix or vector type.\n");
- return NULL;
- return false;
} else { @@ -605,18 +605,18 @@ static struct hlsl_ir_load *add_array_load(struct hlsl_ctx *ctx, struct list *in hlsl_error(ctx, &loc, VKD3D_SHADER_ERROR_HLSL_INVALID_INDEX, "Scalar expressions cannot be array-indexed."); else hlsl_error(ctx, &loc, VKD3D_SHADER_ERROR_HLSL_INVALID_INDEX, "Expression cannot be array-indexed.");
- return NULL;
- return false;
}
if (!(c = hlsl_new_uint_constant(ctx, hlsl_type_get_array_element_reg_size(data_type), &loc)))
- return NULL;
- return false;
list_add_tail(instrs, &c->node.entry); if (!(mul = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, index, &c->node)))
- return NULL;
- 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);
}
static struct hlsl_struct_field *get_struct_field(struct list *fields, const char *name)
2.35.2