Zebediah Figura : vkd3d-shader/hlsl: Return bool from add_record_load() and add_array_load().
Alexandre Julliard
julliard at winehq.org
Wed Apr 20 16:48:25 CDT 2022
Module: vkd3d
Branch: master
Commit: aaa743033a5ede8b8c946c91e942b7853315aa9a
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=aaa743033a5ede8b8c946c91e942b7853315aa9a
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Mon Apr 18 08:34:00 2022 +0200
vkd3d-shader/hlsl: Return bool from add_record_load() and add_array_load().
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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)
More information about the wine-cvs
mailing list