[qfcc] Fix copying of structs for block types

I forgot to set the symbol type of the members and the number of symbols
in the struct. Fixes the excessive initializers when writing to a block
struct.

Also ensure the type name has "tag "  in it.
This commit is contained in:
Bill Currie 2025-02-16 12:31:42 +09:00
parent 192b42737a
commit e5ff5a223b

View file

@ -122,7 +122,7 @@ glsl_block_type (const type_t *type, const char *pre_tag)
auto tag = save_string (va (0, "%s.%s", pre_tag, name));
type_t new = {
.type = ev_invalid,
.name = tag,
.name = save_string (va (0, "tag %s", tag)),
.meta = ty_struct,
};
auto nt = find_type (&new);
@ -135,10 +135,12 @@ glsl_block_type (const type_t *type, const char *pre_tag)
for (auto s = type->symtab->symbols; s; s = s->next) {
auto ftype = glsl_block_type (s->type, tag);
auto sym = new_symbol_type (s->name, ftype);
sym->sy_type = sy_offset;
sym->offset = -1;
sym->id = s->id;
symtab_addsymbol (nt->symtab, sym);
}
nt->symtab->count = type->symtab->count;
return nt;
}
return type;