mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader: Forbid storage modifiers on struct fields.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0e504e974a
commit
e285fc57d2
@ -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);
|
field->name = vkd3d_strdup(old_field->name);
|
||||||
if (old_field->semantic)
|
if (old_field->semantic)
|
||||||
field->semantic = vkd3d_strdup(old_field->semantic);
|
field->semantic = vkd3d_strdup(old_field->semantic);
|
||||||
field->modifiers = old_field->modifiers;
|
|
||||||
field->reg_offset = reg_size;
|
field->reg_offset = reg_size;
|
||||||
reg_size += field->type->reg_size;
|
reg_size += field->type->reg_size;
|
||||||
list_add_tail(type->e.elements, &field->entry);
|
list_add_tail(type->e.elements, &field->entry);
|
||||||
|
@ -134,7 +134,6 @@ struct hlsl_struct_field
|
|||||||
struct hlsl_type *type;
|
struct hlsl_type *type;
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *semantic;
|
const char *semantic;
|
||||||
DWORD modifiers;
|
|
||||||
unsigned int reg_offset;
|
unsigned int reg_offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -721,8 +721,7 @@ static struct hlsl_type *apply_type_modifiers(struct hlsl_ctx *ctx, struct hlsl_
|
|||||||
return new_type;
|
return new_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct list *gen_struct_fields(struct hlsl_ctx *ctx, struct hlsl_type *type,
|
static struct list *gen_struct_fields(struct hlsl_ctx *ctx, struct hlsl_type *type, struct list *fields)
|
||||||
DWORD modifiers, struct list *fields)
|
|
||||||
{
|
{
|
||||||
struct parse_variable_def *v, *v_next;
|
struct parse_variable_def *v, *v_next;
|
||||||
struct hlsl_struct_field *field;
|
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->type = hlsl_new_array_type(ctx, field->type, v->arrays.sizes[i]);
|
||||||
field->loc = v->loc;
|
field->loc = v->loc;
|
||||||
field->name = v->name;
|
field->name = v->name;
|
||||||
field->modifiers = modifiers;
|
|
||||||
field->semantic = v->semantic;
|
field->semantic = v->semantic;
|
||||||
if (v->initializer.args_count)
|
if (v->initializer.args_count)
|
||||||
{
|
{
|
||||||
@ -1937,7 +1935,16 @@ field:
|
|||||||
|
|
||||||
if (!(type = apply_type_modifiers(ctx, $2, &modifiers, @1)))
|
if (!(type = apply_type_modifiers(ctx, $2, &modifiers, @1)))
|
||||||
YYABORT;
|
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:
|
func_declaration:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user