mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Return bool from add_record_load() and add_array_load().
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: Francisco Casas <fcasas@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
367bd15ec5
commit
aaa743033a
@ -569,19 +569,19 @@ static struct hlsl_ir_load *add_load(struct hlsl_ctx *ctx, struct list *instrs,
|
|||||||
return load;
|
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)
|
const struct hlsl_struct_field *field, const struct vkd3d_shader_location loc)
|
||||||
{
|
{
|
||||||
struct hlsl_ir_constant *c;
|
struct hlsl_ir_constant *c;
|
||||||
|
|
||||||
if (!(c = hlsl_new_uint_constant(ctx, field->reg_offset, &loc)))
|
if (!(c = hlsl_new_uint_constant(ctx, field->reg_offset, &loc)))
|
||||||
return NULL;
|
return false;
|
||||||
list_add_tail(instrs, &c->node.entry);
|
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)
|
struct hlsl_ir_node *index, const struct vkd3d_shader_location loc)
|
||||||
{
|
{
|
||||||
const struct hlsl_type *expr_type = array->data_type;
|
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. */
|
/* This needs to be lowered now, while we still have type information. */
|
||||||
FIXME("Index of matrix or vector type.\n");
|
FIXME("Index of matrix or vector type.\n");
|
||||||
return NULL;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
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.");
|
hlsl_error(ctx, &loc, VKD3D_SHADER_ERROR_HLSL_INVALID_INDEX, "Scalar expressions cannot be array-indexed.");
|
||||||
else
|
else
|
||||||
hlsl_error(ctx, &loc, VKD3D_SHADER_ERROR_HLSL_INVALID_INDEX, "Expression cannot be array-indexed.");
|
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)))
|
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);
|
list_add_tail(instrs, &c->node.entry);
|
||||||
if (!(mul = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, index, &c->node)))
|
if (!(mul = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, index, &c->node)))
|
||||||
return NULL;
|
return false;
|
||||||
list_add_tail(instrs, &mul->entry);
|
list_add_tail(instrs, &mul->entry);
|
||||||
index = mul;
|
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)
|
static struct hlsl_struct_field *get_struct_field(struct list *fields, const char *name)
|
||||||
|
Loading…
Reference in New Issue
Block a user