quakeforge/libs/video/renderer/vulkan/vkgen/vkfieldauto.r
Bill Currie 017d2c1f44 [vulkan] Refactor vkgen struct generation
The addition of data an then string support made keeping track of things
in struct's writeTable a nightmare.
2020-12-23 22:13:50 +09:00

43 lines
918 B
R

#include "vkfieldauto.h"
#include "vkgen.h"
#include "vkstruct.h"
@implementation AutoField
-init:(PLItem *) item struct:(Struct *)strct field:(string)fname
{
self = [super init:item struct:strct field:fname];
if (!self) {
return self;
}
field = [strct findField:field_name];
return self;
}
-writeParseData
{
printf("FieldDef: '%s' '%s'\n", struct_name, field_name);
return self;
}
-writeField
{
Type *field_type = [Type findType: field.type];
fprintf (output_file, "\t{\"%s\", field_offset (%s, %s), %s, %s, %s},\n",
field_name, struct_name, field_name,
[field_type parseType], [field_type parseFunc],
[field_type parseData]);
return self;
}
-writeSymbol
{
Type *field_type = [Type findType: field.type];
fprintf (output_file,
"\t{\"%s\", &%s, (void *) field_offset (%s, %s)},\n",
field_name, [field_type cexprType], struct_name, field_name);
return self;
}
@end