Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
libs/vkd3d-shader/hlsl.c | 1 -
libs/vkd3d-shader/hlsl.h | 1 -
libs/vkd3d-shader/hlsl.y | 15 +++++++++++----
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
index 85859ada..4526348e 100644
--- a/libs/vkd3d-shader/hlsl.c
+++ b/libs/vkd3d-shader/hlsl.c
@@ -340,7 +340,6 @@ struct hlsl_type *hlsl_type_clone(struct hlsl_ctx *ctx, struct hlsl_type *old, u
field->name = vkd3d_strdup(old_field->name);
if (old_field->semantic)
field->semantic = vkd3d_strdup(old_field->semantic);
- field->modifiers = old_field->modifiers;
field->reg_offset = reg_size;
reg_size += field->type->reg_size;
list_add_tail(type->e.elements, &field->entry);
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h
index 819b8826..523d156d 100644
--- a/libs/vkd3d-shader/hlsl.h
+++ b/libs/vkd3d-shader/hlsl.h
@@ -134,7 +134,6 @@ struct hlsl_struct_field
struct hlsl_type *type;
const char *name;
const char *semantic;
- DWORD modifiers;
unsigned int reg_offset;
};
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index 45767de9..4b0ddea4 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -721,8 +721,7 @@ static struct hlsl_type *apply_type_modifiers(struct hlsl_ctx *ctx, struct hlsl_
return new_type;
}
-static struct list *gen_struct_fields(struct hlsl_ctx *ctx, struct hlsl_type *type,
- DWORD modifiers, struct list *fields)
+static struct list *gen_struct_fields(struct hlsl_ctx *ctx, struct hlsl_type *type, struct list *fields)
{
struct parse_variable_def *v, *v_next;
struct hlsl_struct_field *field;
@@ -748,7 +747,6 @@ static struct list *gen_struct_fields(struct hlsl_ctx *ctx, struct hlsl_type *ty
field->type = hlsl_new_array_type(ctx, field->type, v->arrays.sizes[i]);
field->loc = v->loc;
field->name = v->name;
- field->modifiers = modifiers;
field->semantic = v->semantic;
if (v->initializer.args_count)
{
@@ -1937,7 +1935,16 @@ field:
if (!(type = apply_type_modifiers(ctx, $2, &modifiers, @1)))
YYABORT;
- $$ = gen_struct_fields(ctx, type, modifiers, $3);
+ if (modifiers)
+ {
+ struct vkd3d_string_buffer *string;
+
+ if ((string = hlsl_modifiers_to_string(&ctx->string_buffers, modifiers)))
+ hlsl_error(ctx, @1, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER,
+ "Modifiers '%s' are not allowed on struct fields.", string->buffer);
+ vkd3d_string_buffer_release(&ctx->string_buffers, string);
+ }
+ $$ = gen_struct_fields(ctx, type, $3);
}
func_declaration:
--
2.31.0