mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
[vkgen] Add support for read-only values
This makes it possible to use the parser to read in certain fields, but skip over others. The read-only is for cexpr parsing of the read-only fields.
This commit is contained in:
parent
0dab26ce8f
commit
7829ec3adb
7 changed files with 93 additions and 0 deletions
|
@ -11,6 +11,7 @@ vkgen_dat_src= \
|
||||||
libs/video/renderer/vulkan/vkgen/vkfieldcustom.r \
|
libs/video/renderer/vulkan/vkgen/vkfieldcustom.r \
|
||||||
libs/video/renderer/vulkan/vkgen/vkfielddata.r \
|
libs/video/renderer/vulkan/vkgen/vkfielddata.r \
|
||||||
libs/video/renderer/vulkan/vkgen/vkfielddef.r \
|
libs/video/renderer/vulkan/vkgen/vkfielddef.r \
|
||||||
|
libs/video/renderer/vulkan/vkgen/vkfieldreadonly.r \
|
||||||
libs/video/renderer/vulkan/vkgen/vkfieldsingle.r \
|
libs/video/renderer/vulkan/vkgen/vkfieldsingle.r \
|
||||||
libs/video/renderer/vulkan/vkgen/vkfieldstring.r \
|
libs/video/renderer/vulkan/vkgen/vkfieldstring.r \
|
||||||
libs/video/renderer/vulkan/vkgen/vkfieldtype.r \
|
libs/video/renderer/vulkan/vkgen/vkfieldtype.r \
|
||||||
|
@ -53,6 +54,7 @@ EXTRA_DIST += \
|
||||||
libs/video/renderer/vulkan/vkgen/vkfieldcustom.h \
|
libs/video/renderer/vulkan/vkgen/vkfieldcustom.h \
|
||||||
libs/video/renderer/vulkan/vkgen/vkfielddata.h \
|
libs/video/renderer/vulkan/vkgen/vkfielddata.h \
|
||||||
libs/video/renderer/vulkan/vkgen/vkfielddef.h \
|
libs/video/renderer/vulkan/vkgen/vkfielddef.h \
|
||||||
|
libs/video/renderer/vulkan/vkgen/vkfieldreadonly.h \
|
||||||
libs/video/renderer/vulkan/vkgen/vkfieldsingle.h \
|
libs/video/renderer/vulkan/vkgen/vkfieldsingle.h \
|
||||||
libs/video/renderer/vulkan/vkgen/vkfieldstring.h \
|
libs/video/renderer/vulkan/vkgen/vkfieldstring.h \
|
||||||
libs/video/renderer/vulkan/vkgen/vkfieldtype.h \
|
libs/video/renderer/vulkan/vkgen/vkfieldtype.h \
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "vkfieldcustom.h"
|
#include "vkfieldcustom.h"
|
||||||
#include "vkfielddata.h"
|
#include "vkfielddata.h"
|
||||||
#include "vkfielddef.h"
|
#include "vkfielddef.h"
|
||||||
|
#include "vkfieldreadonly.h"
|
||||||
#include "vkfieldsingle.h"
|
#include "vkfieldsingle.h"
|
||||||
#include "vkfieldstring.h"
|
#include "vkfieldstring.h"
|
||||||
#include "vkstruct.h"
|
#include "vkstruct.h"
|
||||||
|
@ -42,6 +43,8 @@
|
||||||
return [[[SingleField alloc] init:item struct:strct field:fname] autorelease];
|
return [[[SingleField alloc] init:item struct:strct field:fname] autorelease];
|
||||||
case "array":
|
case "array":
|
||||||
return [[[ArrayField alloc] init:item struct:strct field:fname] autorelease];
|
return [[[ArrayField alloc] init:item struct:strct field:fname] autorelease];
|
||||||
|
case "readonly":
|
||||||
|
return [[[ReadOnlyField alloc] init:item struct:strct field:fname] autorelease];
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
14
libs/video/renderer/vulkan/vkgen/vkfieldreadonly.h
Normal file
14
libs/video/renderer/vulkan/vkgen/vkfieldreadonly.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef __renderer_vulkan_vkgen_vkfieldreadonly_h
|
||||||
|
#define __renderer_vulkan_vkgen_vkfieldreadonly_h
|
||||||
|
|
||||||
|
#include "vkfielddef.h"
|
||||||
|
|
||||||
|
@class FieldType;
|
||||||
|
|
||||||
|
@interface ReadOnlyField: FieldDef
|
||||||
|
{
|
||||||
|
FieldType *type;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif//__renderer_vulkan_vkgen_vkfieldreadonly_h
|
45
libs/video/renderer/vulkan/vkgen/vkfieldreadonly.r
Normal file
45
libs/video/renderer/vulkan/vkgen/vkfieldreadonly.r
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#include <PropertyList.h>
|
||||||
|
|
||||||
|
#include "vkfieldreadonly.h"
|
||||||
|
#include "vkfieldtype.h"
|
||||||
|
#include "vkgen.h"
|
||||||
|
#include "vktype.h"
|
||||||
|
|
||||||
|
@implementation ReadOnlyField
|
||||||
|
|
||||||
|
-init:(PLItem *) item struct:(Struct *)strct field:(string)fname
|
||||||
|
{
|
||||||
|
self = [super init:item struct:strct field:fname];
|
||||||
|
if (!self) {
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
PLItem *desc = [item getObjectForKey:"type"];
|
||||||
|
type = [[FieldType fieldType:[desc getObjectAtIndex:1]] retain];
|
||||||
|
|
||||||
|
value_field = [[item getObjectForKey:"value"] string];
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
-writeParseData
|
||||||
|
{
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
-writeField
|
||||||
|
{
|
||||||
|
string parse_type = [FieldType anyType];
|
||||||
|
fprintf (output_file, "\t{\"%s\", 0, %s, parse_%s, 0},\n",
|
||||||
|
field_name, parse_type, "ignore");
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
-writeSymbol
|
||||||
|
{
|
||||||
|
fprintf (output_file,
|
||||||
|
"\t{\"%s\", %s, (void *) field_offset (%s, %s)},\n",
|
||||||
|
field_name, [type exprType], struct_name, value_field);
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
|
@ -14,7 +14,9 @@
|
||||||
+fieldType:(PLItem *)item;
|
+fieldType:(PLItem *)item;
|
||||||
-initWithItem:(PLItem *)item;
|
-initWithItem:(PLItem *)item;
|
||||||
-writeParseData;
|
-writeParseData;
|
||||||
|
-(string)exprType;
|
||||||
-(string)parseType;
|
-(string)parseType;
|
||||||
|
+(string)anyType;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
string parseItemType (PLItem *item);
|
string parseItemType (PLItem *item);
|
||||||
|
|
|
@ -65,9 +65,24 @@ parseItemType (PLItem *item)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(string) exprType
|
||||||
|
{
|
||||||
|
return "&" + type + "_type";
|
||||||
|
}
|
||||||
|
|
||||||
-(string) parseType
|
-(string) parseType
|
||||||
{
|
{
|
||||||
return parse_type;
|
return parse_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+(string) anyType
|
||||||
|
{
|
||||||
|
string mask = "QFMultiType"
|
||||||
|
" | (1 << QFString)"
|
||||||
|
" | (1 << QFBinary)"
|
||||||
|
" | (1 << QFArray)"
|
||||||
|
" | (1 << QFDictionary)";
|
||||||
|
return mask;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -7,3 +7,15 @@ typedef struct qfv_subpass_s {
|
||||||
vec4 color;
|
vec4 color;
|
||||||
string name;
|
string name;
|
||||||
} qfv_subpass_t;
|
} qfv_subpass_t;
|
||||||
|
|
||||||
|
//FIXME copy of qfv_output_t in qf_renderpass.h
|
||||||
|
//except it doesn't really matter because a custom spec is used
|
||||||
|
typedef struct qfv_output_s {
|
||||||
|
VkExtent2D extent;
|
||||||
|
VkImage image;
|
||||||
|
VkImageView view;
|
||||||
|
VkFormat format;
|
||||||
|
uint32_t frames;
|
||||||
|
VkImageView *view_list;
|
||||||
|
VkImageLayout finalLayout;
|
||||||
|
} qfv_output_t;
|
||||||
|
|
Loading…
Reference in a new issue