Francisco Casas : vkd3d-shader/hlsl: Pass field to add_record_load() via index.
Alexandre Julliard
julliard at winehq.org
Mon Jul 18 15:37:46 CDT 2022
Module: vkd3d
Branch: master
Commit: b9435fb1ff0fcff6695f186312085323b612a3cb
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=b9435fb1ff0fcff6695f186312085323b612a3cb
Author: Francisco Casas <fcasas at codeweavers.com>
Date: Thu Jul 14 21:23:45 2022 -0400
vkd3d-shader/hlsl: Pass field to add_record_load() via index.
Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura 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 | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index f293b82e..bfafd981 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -669,10 +669,14 @@ static struct hlsl_ir_load *add_load(struct hlsl_ctx *ctx, struct list *instrs,
}
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)
+ unsigned int idx, const struct vkd3d_shader_location loc)
{
+ const struct hlsl_struct_field *field;
struct hlsl_ir_constant *c;
+ assert(idx < record->data_type->e.record.field_count);
+ field = &record->data_type->e.record.fields[idx];
+
if (!(c = hlsl_new_uint_constant(ctx, field->reg_offset, &loc)))
return false;
list_add_tail(instrs, &c->node.entry);
@@ -3948,6 +3952,7 @@ postfix_expr:
{
struct hlsl_type *type = node->data_type;
const struct hlsl_struct_field *field;
+ unsigned int field_idx = 0;
if (!(field = get_struct_field(type->e.record.fields, type->e.record.field_count, $3)))
{
@@ -3955,7 +3960,8 @@ postfix_expr:
YYABORT;
}
- if (!add_record_load(ctx, $1, node, field, @2))
+ field_idx = field - type->e.record.fields;
+ if (!add_record_load(ctx, $1, node, field_idx, @2))
YYABORT;
$$ = $1;
}
More information about the wine-cvs
mailing list