[vkgen] Don't queue types for fields with custom parsers

This ensures that unused parser blocks do not get emitted. In the
testing of the upcoming support for fixed arrays, the blend color
constants were being double emitted (both as custom and normal parser)
due to being an array. gcc did not like that (what with all those
warning flags).
This commit is contained in:
Bill Currie 2021-12-04 09:29:38 +09:00
parent a522464fc1
commit c73e4efcb7
4 changed files with 22 additions and 0 deletions

View file

@ -65,4 +65,9 @@
return self;
}
-(int) searchType
{
return 0;
}
@end

View file

@ -23,6 +23,7 @@
-writeField;
-writeSymbol;
-(string) name;
-(int) searchType;
@end
#endif//__renderer_vulkan_vkgen_vkfielddef_h

View file

@ -95,4 +95,9 @@
return field_name;
}
-(int) searchType
{
return 1;
}
@end

View file

@ -30,8 +30,19 @@
-(void) queueFieldTypes
{
qfot_struct_t *strct =&type.strct;
PLItem *field_dict = [parse getObjectForKey:[self name]];
for (int i = 0; i < strct.num_fields; i++) {
qfot_var_t *var = &strct.fields[i];
if (field_dict) {
PLItem *item = [field_dict getObjectForKey:var.name];
FieldDef *def = [FieldDef fielddef:item
struct:self
field:var.name];
if (![def searchType]) {
continue;
}
}
Type *type = [Type findType:var.type];
[type addToQueue];
}