metagen: simplify enum generation; reading/organization pass over raddbgi_from_pdb

This commit is contained in:
Ryan Fleury
2024-02-13 10:55:06 -08:00
parent 4a9e5512f6
commit ea840a71e8
27 changed files with 1149 additions and 765 deletions
+2 -4
View File
@@ -13,14 +13,12 @@
typedef U32 CV_TypeId; typedef U32 CV_TypeId;
typedef U32 CV_ItemId; typedef U32 CV_ItemId;
static CV_TypeId cv_type_id_variadic = 0xFFFFFFFF;
typedef U16 CV_ModIndex; typedef U16 CV_ModIndex;
typedef U16 CV_SectionIndex; typedef U16 CV_SectionIndex;
typedef U16 CV_Reg; typedef U16 CV_Reg;
read_only global CV_TypeId cv_type_id_variadic = 0xFFFFFFFF;
#define CV_NumericKindXList(X) \ #define CV_NumericKindXList(X) \
X(CHAR, 0x8000)\ X(CHAR, 0x8000)\
X(SHORT, 0x8001)\ X(SHORT, 0x8001)\
+28
View File
@@ -0,0 +1,28 @@
@table(name val)
CV_NumericKindTable:
{
{CHAR 0x8000}
{SHORT 0x8001}
{USHORT 0x8002}
{LONG 0x8003}
{ULONG 0x8004}
{FLOAT32 0x8005}
{FLOAT64 0x8006}
{FLOAT80 0x8007}
{FLOAT128 0x8008}
{QUADWORD 0x8009}
{UQUADWORD 0x800a}
{FLOAT48 0x800b}
{COMPLEX32 0x800c}
{COMPLEX64 0x800d}
{COMPLEX80 0x800e}
{COMPLEX128 0x800f}
{VARSTRING 0x8010}
{OCTWORD 0x8017}
{UOCTWORD 0x8018}
{DECIMAL 0x8019}
{DATE 0x801a}
{UTF8STRING 0x801b}
{FLOAT16 0x801c}
}
+4 -4
View File
@@ -49,11 +49,11 @@ CTRL_ExceptionCodeKindTable:
//////////////////////////////// ////////////////////////////////
//~ rjf: Generators //~ rjf: Generators
@table_gen_enum CTRL_ExceptionCodeKind: @enum CTRL_ExceptionCodeKind:
{ {
`CTRL_ExceptionCodeKind_Null,`; Null,
@expand(CTRL_ExceptionCodeKindTable a) `CTRL_ExceptionCodeKind_$(a.name),`; @expand(CTRL_ExceptionCodeKindTable a) `$(a.name)`,
`CTRL_ExceptionCodeKind_COUNT`; COUNT,
} }
@table_gen_data(type:U32, fallback:0) @table_gen_data(type:U32, fallback:0)
+1 -1
View File
@@ -46,7 +46,7 @@ CTRL_ExceptionCodeKind_Win32ProcedureNotFound,
CTRL_ExceptionCodeKind_Win32SanitizerErrorDetected, CTRL_ExceptionCodeKind_Win32SanitizerErrorDetected,
CTRL_ExceptionCodeKind_Win32SanitizerRawAccessViolation, CTRL_ExceptionCodeKind_Win32SanitizerRawAccessViolation,
CTRL_ExceptionCodeKind_Win32DirectXDebugLayer, CTRL_ExceptionCodeKind_Win32DirectXDebugLayer,
CTRL_ExceptionCodeKind_COUNT CTRL_ExceptionCodeKind_COUNT,
} CTRL_ExceptionCodeKind; } CTRL_ExceptionCodeKind;
U32 ctrl_exception_code_kind_code_table[] = U32 ctrl_exception_code_kind_code_table[] =
+22 -32
View File
@@ -1688,59 +1688,49 @@ DF_DevToggleTable:
//- rjf: enums //- rjf: enums
@table_gen_enum @enum DF_CfgSrc:
DF_CfgSrc:
{ {
@expand(DF_CfgSrcTable a) `DF_CfgSrc_$(a.name),`; @expand(DF_CfgSrcTable a) `$(a.name)`,
`DF_CfgSrc_COUNT`; COUNT,
} }
@table_gen_enum @enum DF_EntityKind:
DF_EntityKind:
{ {
@expand(DF_EntityKindTable a) `DF_EntityKind_$(a.name),`; @expand(DF_EntityKindTable a) `$(a.name)`,
`DF_EntityKind_COUNT`; COUNT,
} }
@table_gen_enum @enum DF_NameKind:
DF_NameKind:
{ {
@expand(DF_NameKindTable, a) `DF_NameKind_$(a.name),`; @expand(DF_NameKindTable, a) `$(a.name)`,
`DF_NameKind_COUNT`; COUNT,
} }
@table_gen_enum @enum DF_CoreCmdKind:
DF_CoreCmdKind:
{ {
@expand(DF_CoreCmdTable, a) @expand(DF_CoreCmdTable, a) `$(a.name)`,
`DF_CoreCmdKind_$(a.name),`, COUNT,
`DF_CoreCmdKind_COUNT`,
} }
@table_gen_enum @enum DF_IconKind:
DF_IconKind:
{ {
@expand(DF_IconTable a) @expand(DF_IconTable a) `$(a.name)`,
`DF_IconKind_$(a.name),`; COUNT,
`DF_IconKind_COUNT`;
} }
@table_gen_enum @enum DF_CoreViewRuleKind:
DF_CoreViewRuleKind:
{ {
@expand(DF_CoreViewRuleTable a) `DF_CoreViewRuleKind_$(a.name),`; @expand(DF_CoreViewRuleTable a) `$(a.name)`,
`DF_CoreViewRuleKind_COUNT`; COUNT,
} }
//- rjf: command params //- rjf: command params
@table_gen_enum @enum DF_CmdParamSlot:
DF_CmdParamSlot:
{ {
`DF_CmdParamSlot_Null,`; Null,
@expand(DF_CmdParamSlotTable a) @expand(DF_CmdParamSlotTable a) `$(a.name)`,
`DF_CmdParamSlot_$(a.name),`; COUNT,
`DF_CmdParamSlot_COUNT`;
} }
@table_gen @table_gen
+7 -7
View File
@@ -12,7 +12,7 @@ DF_CfgSrc_User,
DF_CfgSrc_Profile, DF_CfgSrc_Profile,
DF_CfgSrc_CommandLine, DF_CfgSrc_CommandLine,
DF_CfgSrc_Transient, DF_CfgSrc_Transient,
DF_CfgSrc_COUNT DF_CfgSrc_COUNT,
} DF_CfgSrc; } DF_CfgSrc;
typedef enum DF_EntityKind typedef enum DF_EntityKind
@@ -44,7 +44,7 @@ DF_EntityKind_PendingThreadName,
DF_EntityKind_ConversionTask, DF_EntityKind_ConversionTask,
DF_EntityKind_ConversionFail, DF_EntityKind_ConversionFail,
DF_EntityKind_EndedProcess, DF_EntityKind_EndedProcess,
DF_EntityKind_COUNT DF_EntityKind_COUNT,
} DF_EntityKind; } DF_EntityKind;
typedef enum DF_NameKind typedef enum DF_NameKind
@@ -52,7 +52,7 @@ typedef enum DF_NameKind
DF_NameKind_Null, DF_NameKind_Null,
DF_NameKind_EntityName, DF_NameKind_EntityName,
DF_NameKind_EntityKindName, DF_NameKind_EntityKindName,
DF_NameKind_COUNT DF_NameKind_COUNT,
} DF_NameKind; } DF_NameKind;
typedef enum DF_CoreCmdKind typedef enum DF_CoreCmdKind
@@ -263,7 +263,7 @@ DF_CoreCmdKind_PickFileOrFolder,
DF_CoreCmdKind_CompleteQuery, DF_CoreCmdKind_CompleteQuery,
DF_CoreCmdKind_CancelQuery, DF_CoreCmdKind_CancelQuery,
DF_CoreCmdKind_ToggleDevMenu, DF_CoreCmdKind_ToggleDevMenu,
DF_CoreCmdKind_COUNT DF_CoreCmdKind_COUNT,
} DF_CoreCmdKind; } DF_CoreCmdKind;
typedef enum DF_IconKind typedef enum DF_IconKind
@@ -337,7 +337,7 @@ DF_IconKind_QuestionMark,
DF_IconKind_Person, DF_IconKind_Person,
DF_IconKind_Briefcase, DF_IconKind_Briefcase,
DF_IconKind_Dot, DF_IconKind_Dot,
DF_IconKind_COUNT DF_IconKind_COUNT,
} DF_IconKind; } DF_IconKind;
typedef enum DF_CoreViewRuleKind typedef enum DF_CoreViewRuleKind
@@ -358,7 +358,7 @@ DF_CoreViewRuleKind_Text,
DF_CoreViewRuleKind_Disasm, DF_CoreViewRuleKind_Disasm,
DF_CoreViewRuleKind_Bitmap, DF_CoreViewRuleKind_Bitmap,
DF_CoreViewRuleKind_Geo, DF_CoreViewRuleKind_Geo,
DF_CoreViewRuleKind_COUNT DF_CoreViewRuleKind_COUNT,
} DF_CoreViewRuleKind; } DF_CoreViewRuleKind;
typedef enum DF_CmdParamSlot typedef enum DF_CmdParamSlot
@@ -382,7 +382,7 @@ DF_CmdParamSlot_Index,
DF_CmdParamSlot_ID, DF_CmdParamSlot_ID,
DF_CmdParamSlot_PreferDisassembly, DF_CmdParamSlot_PreferDisassembly,
DF_CmdParamSlot_ForceConfirm, DF_CmdParamSlot_ForceConfirm,
DF_CmdParamSlot_COUNT DF_CmdParamSlot_COUNT,
} DF_CmdParamSlot; } DF_CmdParamSlot;
typedef struct DF_CmdParams DF_CmdParams; typedef struct DF_CmdParams DF_CmdParams;
+9 -15
View File
@@ -400,28 +400,22 @@ DF_ThemePresetColorTable:
//- rjf: enums //- rjf: enums
@table_gen_enum @enum DF_GfxViewKind:
DF_GfxViewKind:
{ {
@expand(DF_GfxViewTable a) @expand(DF_GfxViewTable a) `$(a.name)`,
`DF_GfxViewKind_$(a.name),` COUNT,
`DF_GfxViewKind_COUNT`;
} }
@table_gen_enum @enum DF_ThemeColor:
DF_ThemeColor:
{ {
@expand(DF_ThemeTable, a) @expand(DF_ThemeTable a) `$(a.name)`,
`DF_ThemeColor_$(a.name),`; COUNT,
`DF_ThemeColor_COUNT`;
} }
@table_gen_enum @enum DF_ThemePreset:
DF_ThemePreset:
{ {
@expand(DF_ThemePresetTable a) @expand(DF_ThemePresetTable a) `$(a.name)`,
`DF_ThemePreset_$(a.name),`; COUNT,
`DF_ThemePreset_COUNT`;
} }
//- rjf: theme preset color tables //- rjf: theme preset color tables
+3 -3
View File
@@ -37,7 +37,7 @@ DF_GfxViewKind_Breakpoints,
DF_GfxViewKind_WatchPins, DF_GfxViewKind_WatchPins,
DF_GfxViewKind_ExceptionFilters, DF_GfxViewKind_ExceptionFilters,
DF_GfxViewKind_Theme, DF_GfxViewKind_Theme,
DF_GfxViewKind_COUNT DF_GfxViewKind_COUNT,
} DF_GfxViewKind; } DF_GfxViewKind;
typedef enum DF_ThemeColor typedef enum DF_ThemeColor
@@ -95,7 +95,7 @@ DF_ThemeColor_Thread7,
DF_ThemeColor_ThreadUnwound, DF_ThemeColor_ThreadUnwound,
DF_ThemeColor_InactivePanelOverlay, DF_ThemeColor_InactivePanelOverlay,
DF_ThemeColor_DropShadow, DF_ThemeColor_DropShadow,
DF_ThemeColor_COUNT DF_ThemeColor_COUNT,
} DF_ThemeColor; } DF_ThemeColor;
typedef enum DF_ThemePreset typedef enum DF_ThemePreset
@@ -109,7 +109,7 @@ DF_ThemePreset_SolarizedLight,
DF_ThemePreset_HandmadeHero, DF_ThemePreset_HandmadeHero,
DF_ThemePreset_FourCoder, DF_ThemePreset_FourCoder,
DF_ThemePreset_FarManager, DF_ThemePreset_FarManager,
DF_ThemePreset_COUNT DF_ThemePreset_COUNT,
} DF_ThemePreset; } DF_ThemePreset;
DF_VIEW_SETUP_FUNCTION_DEF(Null); DF_VIEW_SETUP_FUNCTION_DEF(Null);
+3 -3
View File
@@ -81,10 +81,10 @@ EVAL_ResultCodeTable:
``; ``;
} }
@table_gen_enum EVAL_ResultCode: @enum EVAL_ResultCode:
{ {
@expand(EVAL_ResultCodeTable a) `EVAL_ResultCode_$(a.name),`; @expand(EVAL_ResultCodeTable a) `$(a.name)`,
EVAL_ResultCode_COUNT COUNT,
} }
@table_gen_data(type:U8, fallback:0) @table_gen_data(type:U8, fallback:0)
+1 -1
View File
@@ -19,7 +19,7 @@ EVAL_ResultCode_BadModuleBase,
EVAL_ResultCode_BadTLSBase, EVAL_ResultCode_BadTLSBase,
EVAL_ResultCode_InsufficientStackSpace, EVAL_ResultCode_InsufficientStackSpace,
EVAL_ResultCode_MalformedBytecode, EVAL_ResultCode_MalformedBytecode,
EVAL_ResultCode_COUNT EVAL_ResultCode_COUNT,
} EVAL_ResultCode; } EVAL_ResultCode;
typedef U32 EVAL_ExprKind; typedef U32 EVAL_ExprKind;
+31 -7
View File
@@ -98,8 +98,16 @@ int main(int argument_count, char **arguments)
for(MD_Msg *msg = parse.msgs.first; msg != 0; msg = msg->next) for(MD_Msg *msg = parse.msgs.first; msg != 0; msg = msg->next)
{ {
TxtPt pt = mg_txt_pt_from_string_off(data, msg->node->src_offset); TxtPt pt = mg_txt_pt_from_string_off(data, msg->node->src_offset);
// TODO(rjf): error kind display & locations String8 msg_kind_string = {0};
fprintf(stderr, "%.*s:%i:%i %.*s\n", str8_varg(file_path), (int)pt.line, (int)pt.column, str8_varg(msg->string)); switch(msg->kind)
{
default:{}break;
case MD_MsgKind_Note: {msg_kind_string = str8_lit("note");}break;
case MD_MsgKind_Warning: {msg_kind_string = str8_lit("warning");}break;
case MD_MsgKind_Error: {msg_kind_string = str8_lit("error");}break;
case MD_MsgKind_FatalError: {msg_kind_string = str8_lit("fatal error");}break;
}
fprintf(stderr, "%.*s:%i:%i: %.*s: %.*s\n", str8_varg(file_path), (int)pt.line, (int)pt.column, str8_varg(msg_kind_string), str8_varg(msg->string));
} }
} }
} }
@@ -141,19 +149,35 @@ int main(int argument_count, char **arguments)
MD_Node *file = n->v.root; MD_Node *file = n->v.root;
for(MD_EachNode(node, file->first)) for(MD_EachNode(node, file->first))
{ {
if(md_node_has_tag(node, str8_lit("table_gen_enum"), 0)) MD_Node *tag = md_tag_from_string(node, str8_lit("enum"), 0);
if(!md_node_is_nil(tag))
{ {
String8 enum_base_type_name = tag->first->string;
String8 layer_key = mg_layer_key_from_path(file->string); String8 layer_key = mg_layer_key_from_path(file->string);
MG_Layer *layer = mg_layer_from_key(layer_key); MG_Layer *layer = mg_layer_from_key(layer_key);
String8List gen_strings = mg_string_list_from_table_gen(mg_arena, table_grid_map, table_col_map, str8_lit(""), node); String8List gen_strings = mg_string_list_from_table_gen(mg_arena, table_grid_map, table_col_map, str8_lit(""), node);
str8_list_pushf(mg_arena, &layer->enums, "typedef enum %S\n{\n", node->string); if(enum_base_type_name.size == 0)
{
str8_list_pushf(mg_arena, &layer->enums, "typedef enum %S\n{\n", node->string);
}
else
{
str8_list_pushf(mg_arena, &layer->enums, "typedef %S %S;\n", enum_base_type_name, node->string);
str8_list_pushf(mg_arena, &layer->enums, "typedef enum %SEnum\n{\n", node->string);
}
for(String8Node *n = gen_strings.first; n != 0; n = n->next) for(String8Node *n = gen_strings.first; n != 0; n = n->next)
{ {
String8 escaped = mg_escaped_from_str8(mg_arena, n->string); String8 escaped = mg_escaped_from_str8(mg_arena, n->string);
str8_list_push(mg_arena, &layer->enums, escaped); str8_list_pushf(mg_arena, &layer->enums, "%S_%S,\n", node->string, escaped);
str8_list_push(mg_arena, &layer->enums, str8_lit("\n")); }
if(enum_base_type_name.size == 0)
{
str8_list_pushf(mg_arena, &layer->enums, "} %S;\n\n", node->string);
}
else
{
str8_list_pushf(mg_arena, &layer->enums, "} %SEnum;\n\n", node->string);
} }
str8_list_pushf(mg_arena, &layer->enums, "} %S;\n\n", node->string);
} }
} }
} }
+1 -1
View File
@@ -151,7 +151,7 @@ OS_Key_Num9,
OS_Key_LeftMouseButton, OS_Key_LeftMouseButton,
OS_Key_MiddleMouseButton, OS_Key_MiddleMouseButton,
OS_Key_RightMouseButton, OS_Key_RightMouseButton,
OS_Key_COUNT OS_Key_COUNT,
} OS_Key; } OS_Key;
String8 os_g_key_display_string_table[] = String8 os_g_key_display_string_table[] =
+3 -4
View File
@@ -155,11 +155,10 @@ OS_KeyTable:
//////////////////////////////// ////////////////////////////////
//~ rjf: Generators //~ rjf: Generators
@table_gen_enum @enum OS_Key:
OS_Key:
{ {
@expand(OS_KeyTable a) `OS_Key_$(a.name),`; @expand(OS_KeyTable a) `$(a.name)`,
`OS_Key_COUNT`; COUNT,
} }
@table_gen_data(type: String8, fallback:`{0}`) @table_gen_data(type: String8, fallback:`{0}`)
@@ -4,7 +4,7 @@
//////////////////////////////// ////////////////////////////////
//~ CodeView Conversion Functions //~ CodeView Conversion Functions
static RADDBGI_Arch internal RADDBGI_Arch
raddbgi_arch_from_cv_arch(CV_Arch cv_arch){ raddbgi_arch_from_cv_arch(CV_Arch cv_arch){
RADDBGI_Arch result = 0; RADDBGI_Arch result = 0;
switch (cv_arch){ switch (cv_arch){
@@ -73,7 +73,7 @@ raddbgi_arch_from_cv_arch(CV_Arch cv_arch){
return(result); return(result);
} }
static RADDBGI_RegisterCode internal RADDBGI_RegisterCode
raddbgi_reg_code_from_cv_reg_code(RADDBGI_Arch arch, CV_Reg reg_code){ raddbgi_reg_code_from_cv_reg_code(RADDBGI_Arch arch, CV_Reg reg_code){
RADDBGI_RegisterCode result = 0; RADDBGI_RegisterCode result = 0;
switch (arch){ switch (arch){
@@ -98,7 +98,7 @@ raddbgi_reg_code_from_cv_reg_code(RADDBGI_Arch arch, CV_Reg reg_code){
return(result); return(result);
} }
static RADDBGI_Language internal RADDBGI_Language
raddbgi_language_from_cv_language(CV_Language cv_language){ raddbgi_language_from_cv_language(CV_Language cv_language){
RADDBGI_Language result = 0; RADDBGI_Language result = 0;
switch (cv_language){ switch (cv_language){
@@ -7,8 +7,8 @@
//////////////////////////////// ////////////////////////////////
//~ CodeView Conversion Functions //~ CodeView Conversion Functions
static RADDBGI_Arch raddbgi_arch_from_cv_arch(CV_Arch arch); internal RADDBGI_Arch raddbgi_arch_from_cv_arch(CV_Arch arch);
static RADDBGI_RegisterCode raddbgi_reg_code_from_cv_reg_code(RADDBGI_Arch arch, CV_Reg reg_code); internal RADDBGI_RegisterCode raddbgi_reg_code_from_cv_reg_code(RADDBGI_Arch arch, CV_Reg reg_code);
static RADDBGI_Language raddbgi_language_from_cv_language(CV_Language language); internal RADDBGI_Language raddbgi_language_from_cv_language(CV_Language language);
#endif //RADDBGI_CODEVIEW_CONVERSION_H #endif //RADDBGI_CODEVIEW_CONVERSION_H
@@ -4,7 +4,7 @@
//////////////////////////////// ////////////////////////////////
//~ COFF Conversion Functions //~ COFF Conversion Functions
static RADDBGI_BinarySectionFlags internal RADDBGI_BinarySectionFlags
raddbgi_binary_section_flags_from_coff_section_flags(COFF_SectionFlags flags){ raddbgi_binary_section_flags_from_coff_section_flags(COFF_SectionFlags flags){
RADDBGI_BinarySectionFlags result = 0; RADDBGI_BinarySectionFlags result = 0;
@@ -7,6 +7,6 @@
//////////////////////////////// ////////////////////////////////
//~ COFF Conversion Functions //~ COFF Conversion Functions
static RADDBGI_BinarySectionFlags raddbgi_binary_section_flags_from_coff_section_flags(COFF_SectionFlags flags); internal RADDBGI_BinarySectionFlags raddbgi_binary_section_flags_from_coff_section_flags(COFF_SectionFlags flags);
#endif //RADDBGI_COFF_CONVERSION_H #endif //RADDBGI_COFF_CONVERSION_H
File diff suppressed because it is too large Load Diff
+186 -154
View File
@@ -5,18 +5,19 @@
#define RADDBGI_FROM_PDB_H #define RADDBGI_FROM_PDB_H
//////////////////////////////// ////////////////////////////////
//~ Program Parameters Type //~ rjf: Conversion Parameters Type
typedef struct PDBCONV_Params{ typedef struct PDBCONV_Params PDBCONV_Params;
struct PDBCONV_Params
{
String8 input_pdb_name; String8 input_pdb_name;
String8 input_pdb_data; String8 input_pdb_data;
String8 input_exe_name; String8 input_exe_name;
String8 input_exe_data; String8 input_exe_data;
String8 output_name; String8 output_name;
struct{ struct
{
B8 input; B8 input;
B8 output; B8 output;
B8 parsing; B8 parsing;
@@ -36,73 +37,95 @@ typedef struct PDBCONV_Params{
B8 dump__last; B8 dump__last;
String8List errors; String8List errors;
} PDBCONV_Params; };
//////////////////////////////// ////////////////////////////////
//~ Program Parameters Parser //~ rjf: PDB Type & Symbol Info Translation Helper Types
static PDBCONV_Params *pdb_convert_params_from_cmd_line(Arena *arena, CmdLine *cmdline); //- rjf: typeid forward reference map
//////////////////////////////// typedef struct PDBCONV_FwdNode PDBCONV_FwdNode;
//~ PDB Type & Symbol Info Translation Helpers struct PDBCONV_FwdNode
{
//- translation helper types PDBCONV_FwdNode *next;
typedef struct PDBCONV_FwdNode{
struct PDBCONV_FwdNode *next;
CV_TypeId key; CV_TypeId key;
CV_TypeId val; CV_TypeId val;
} PDBCONV_FwdNode; };
typedef struct PDBCONV_FwdMap{ typedef struct PDBCONV_FwdMap PDBCONV_FwdMap;
struct PDBCONV_FwdMap
{
PDBCONV_FwdNode **buckets; PDBCONV_FwdNode **buckets;
U64 buckets_count; U64 buckets_count;
U64 bucket_collision_count; U64 bucket_collision_count;
U64 pair_count; U64 pair_count;
} PDBCONV_FwdMap; };
typedef struct PDBCONV_TypeRev{ //- rjf: type revisit lists
struct PDBCONV_TypeRev *next;
typedef struct PDBCONV_TypeRev PDBCONV_TypeRev;
struct PDBCONV_TypeRev
{
PDBCONV_TypeRev *next;
RADDBGIC_Type *owner_type; RADDBGIC_Type *owner_type;
CV_TypeId field_itype; CV_TypeId field_itype;
} PDBCONV_TypeRev; };
typedef struct PDBCONV_FrameProcData{ //- rjf: frame proc maps
typedef struct PDBCONV_FrameProcData PDBCONV_FrameProcData;
struct PDBCONV_FrameProcData
{
U32 frame_size; U32 frame_size;
CV_FrameprocFlags flags; CV_FrameprocFlags flags;
} PDBCONV_FrameProcData; };
typedef struct PDBCONV_FrameProcNode{ typedef struct PDBCONV_FrameProcNode PDBCONV_FrameProcNode;
struct PDBCONV_FrameProcNode *next; struct PDBCONV_FrameProcNode
{
PDBCONV_FrameProcNode *next;
RADDBGIC_Symbol *key; RADDBGIC_Symbol *key;
PDBCONV_FrameProcData data; PDBCONV_FrameProcData data;
} PDBCONV_FrameProcNode; };
typedef struct PDBCONV_FrameProcMap{ typedef struct PDBCONV_FrameProcMap PDBCONV_FrameProcMap;
struct PDBCONV_FrameProcMap
{
PDBCONV_FrameProcNode **buckets; PDBCONV_FrameProcNode **buckets;
U64 buckets_count; U64 buckets_count;
U64 bucket_collision_count; U64 bucket_collision_count;
U64 pair_count; U64 pair_count;
} PDBCONV_FrameProcMap; };
typedef struct PDBCONV_ScopeNode{ //- rjf: scopes
struct PDBCONV_ScopeNode *next;
typedef struct PDBCONV_ScopeNode PDBCONV_ScopeNode;
struct PDBCONV_ScopeNode
{
PDBCONV_ScopeNode *next;
RADDBGIC_Scope *scope; RADDBGIC_Scope *scope;
RADDBGIC_Symbol *symbol; RADDBGIC_Symbol *symbol;
} PDBCONV_ScopeNode; };
typedef struct PDBCONV_KnownGlobalNode{ //- rjf: known global map
struct PDBCONV_KnownGlobalNode *next;
typedef struct PDBCONV_KnownGlobalNode PDBCONV_KnownGlobalNode;
struct PDBCONV_KnownGlobalNode
{
PDBCONV_KnownGlobalNode *next;
String8 key_name; String8 key_name;
U64 key_voff; U64 key_voff;
U64 hash; U64 hash;
} PDBCONV_KnownGlobalNode; };
typedef struct PDBCONV_KnownGlobalSet{ typedef struct PDBCONV_KnownGlobalSet PDBCONV_KnownGlobalSet;
struct PDBCONV_KnownGlobalSet
{
PDBCONV_KnownGlobalNode **buckets; PDBCONV_KnownGlobalNode **buckets;
U64 buckets_count; U64 buckets_count;
U64 bucket_collision_count; U64 bucket_collision_count;
U64 global_count; U64 global_count;
} PDBCONV_KnownGlobalSet; };
typedef struct PDBCONV_CtxParams PDBCONV_CtxParams; typedef struct PDBCONV_CtxParams PDBCONV_CtxParams;
struct PDBCONV_CtxParams struct PDBCONV_CtxParams
@@ -117,26 +140,34 @@ struct PDBCONV_CtxParams
U64 link_name_map_bucket_count; U64 link_name_map_bucket_count;
}; };
typedef struct PDBCONV_TypesSymbolsParams{ typedef struct PDBCONV_TypesSymbolsParams PDBCONV_TypesSymbolsParams;
struct PDBCONV_TypesSymbolsParams
{
CV_SymParsed *sym; CV_SymParsed *sym;
CV_SymParsed **sym_for_unit; CV_SymParsed **sym_for_unit;
U64 unit_count; U64 unit_count;
} PDBCONV_TypesSymbolsParams; };
typedef struct PDBCONV_LinkNameNode{ typedef struct PDBCONV_LinkNameNode PDBCONV_LinkNameNode;
struct PDBCONV_LinkNameNode *next; struct PDBCONV_LinkNameNode
{
PDBCONV_LinkNameNode *next;
U64 voff; U64 voff;
String8 name; String8 name;
} PDBCONV_LinkNameNode; };
typedef struct PDBCONV_LinkNameMap{ typedef struct PDBCONV_LinkNameMap PDBCONV_LinkNameMap;
struct PDBCONV_LinkNameMap
{
PDBCONV_LinkNameNode **buckets; PDBCONV_LinkNameNode **buckets;
U64 buckets_count; U64 buckets_count;
U64 bucket_collision_count; U64 bucket_collision_count;
U64 link_name_count; U64 link_name_count;
} PDBCONV_LinkNameMap; };
typedef struct PDBCONV_Ctx{ typedef struct PDBCONV_Ctx PDBCONV_Ctx;
struct PDBCONV_Ctx
{
Arena *arena; Arena *arena;
// INPUT data // INPUT data
@@ -161,115 +192,7 @@ typedef struct PDBCONV_Ctx{
PDBCONV_ScopeNode *scope_node_free; PDBCONV_ScopeNode *scope_node_free;
PDBCONV_KnownGlobalSet known_globals; PDBCONV_KnownGlobalSet known_globals;
PDBCONV_LinkNameMap link_names; PDBCONV_LinkNameMap link_names;
} PDBCONV_Ctx; };
//- rjf: pdb conversion context creation
static PDBCONV_Ctx *pdbconv_ctx_alloc(PDBCONV_CtxParams *params, RADDBGIC_Root *out_root);
//- pdb types and symbols
static void pdbconv_types_and_symbols(PDBCONV_Ctx *pdb_ctx, PDBCONV_TypesSymbolsParams *params);
//- decoding helpers
static U32 pdbconv_u32_from_numeric(PDBCONV_Ctx *ctx, CV_NumericParsed *num);
static COFF_SectionHeader* pdbconv_sec_header_from_sec_num(PDBCONV_Ctx *ctx, U32 sec_num);
//- type info
// TODO(allen): explain the overarching pattern of PDB type info translation here
// 1. main passes (out of order necessity) & after
// 2. resolve forward
// 3. cons type info
// 4. "resolve itype"
// 5. equipping members & enumerates
// 6. equipping source coordinates
// type info construction passes
static void pdbconv_type_cons_main_passes(PDBCONV_Ctx *ctx);
static CV_TypeId pdbconv_type_resolve_fwd(PDBCONV_Ctx *ctx, CV_TypeId itype);
static RADDBGIC_Type* pdbconv_type_resolve_itype(PDBCONV_Ctx *ctx, CV_TypeId itype);
static void pdbconv_type_equip_members(PDBCONV_Ctx *ctx, RADDBGIC_Type *owern_type,
CV_TypeId field_itype);
static void pdbconv_type_equip_enumerates(PDBCONV_Ctx *ctx, RADDBGIC_Type *owner_type,
CV_TypeId field_itype);
// type info construction helpers
static RADDBGIC_Type* pdbconv_type_cons_basic(PDBCONV_Ctx *ctx, CV_TypeId itype);
static RADDBGIC_Type* pdbconv_type_cons_leaf_record(PDBCONV_Ctx *ctx, CV_TypeId itype);
static RADDBGIC_Type* pdbconv_type_resolve_and_check(PDBCONV_Ctx *ctx, CV_TypeId itype);
static void pdbconv_type_resolve_arglist(Arena *arena, RADDBGIC_TypeList *out,
PDBCONV_Ctx *ctx, CV_TypeId arglist_itype);
// type info resolution helpers
static RADDBGIC_Type* pdbconv_type_from_name(PDBCONV_Ctx *ctx, String8 name);
// type fwd map
static void pdbconv_type_fwd_map_set(Arena *arena, PDBCONV_FwdMap *map,
CV_TypeId key, CV_TypeId val);
static CV_TypeId pdbconv_type_fwd_map_get(PDBCONV_FwdMap *map, CV_TypeId key);
//- symbol info
// symbol info construction
static U64 pdbconv_hash_from_local_user_id(U64 sym_hash, U64 id);
static U64 pdbconv_hash_from_scope_user_id(U64 sym_hash, U64 id);
static U64 pdbconv_hash_from_symbol_user_id(U64 sym_hash, U64 id);
static void pdbconv_symbol_cons(PDBCONV_Ctx *ctx, CV_SymParsed *sym, U32 sym_unique_id);
static void pdbconv_gather_link_names(PDBCONV_Ctx *ctx, CV_SymParsed *sym);
// "frameproc" map
static void pdbconv_symbol_frame_proc_write(PDBCONV_Ctx *ctx,RADDBGIC_Symbol *key,
PDBCONV_FrameProcData *data);
static PDBCONV_FrameProcData* pdbconv_symbol_frame_proc_read(PDBCONV_Ctx *ctx, RADDBGIC_Symbol *key);
// scope stack
static void pdbconv_symbol_push_scope(PDBCONV_Ctx *ctx, RADDBGIC_Scope *scope, RADDBGIC_Symbol *symbol);
static void pdbconv_symbol_pop_scope(PDBCONV_Ctx *ctx);
static void pdbconv_symbol_clear_scope_stack(PDBCONV_Ctx *ctx);
#define pdbconv_symbol_current_scope(ctx) \
((ctx)->scope_stack == 0)?0:((ctx)->scope_stack->scope)
#define pdbconv_symbol_current_symbol(ctx) \
((ctx)->scope_stack == 0)?0:((ctx)->scope_stack->symbol)
// PDB/C++ name parsing helper
static U64 pdbconv_end_of_cplusplus_container_name(String8 str);
// global deduplication
static U64 pdbconv_known_global_hash(String8 name, U64 voff);
static B32 pdbconv_known_global_lookup(PDBCONV_KnownGlobalSet *set, String8 name, U64 voff);
static void pdbconv_known_global_insert(Arena *arena, PDBCONV_KnownGlobalSet *set,
String8 name, U64 voff);
// location info helpers
static RADDBGIC_Location* pdbconv_location_from_addr_reg_off(PDBCONV_Ctx *ctx,
RADDBGI_RegisterCode reg_code,
U32 reg_byte_size,
U32 reg_byte_pos,
S64 offset,
B32 extra_indirection);
static CV_EncodedFramePtrReg pdbconv_cv_encoded_fp_reg_from_proc(PDBCONV_Ctx *ctx,
RADDBGIC_Symbol *proc,
B32 param_base);
static RADDBGI_RegisterCode pdbconv_reg_code_from_arch_encoded_fp_reg(RADDBGI_Arch arch,
CV_EncodedFramePtrReg encoded_reg);
static void pdbconv_location_over_lvar_addr_range(PDBCONV_Ctx *ctx,
RADDBGIC_LocationSet *locset,
RADDBGIC_Location *location,
CV_LvarAddrRange *range,
CV_LvarAddrGap *gaps, U64 gap_count);
// link names
static void pdbconv_link_name_save(Arena *arena, PDBCONV_LinkNameMap *map,
U64 voff, String8 name);
static String8 pdbconv_link_name_find(PDBCONV_LinkNameMap *map, U64 voff);
//////////////////////////////// ////////////////////////////////
//~ Conversion Output Type //~ Conversion Output Type
@@ -284,8 +207,117 @@ struct PDBCONV_Out
}; };
//////////////////////////////// ////////////////////////////////
//~ Conversion Path //~ rjf: Command Line -> Conversion Parameters
static PDBCONV_Out *pdbconv_convert(Arena *arena, PDBCONV_Params *params); internal PDBCONV_Params *pdb_convert_params_from_cmd_line(Arena *arena, CmdLine *cmdline);
////////////////////////////////
//~ rjf: Conversion Implementation Helpers
//- rjf: pdb conversion context creation
internal PDBCONV_Ctx *pdbconv_ctx_alloc(PDBCONV_CtxParams *params, RADDBGIC_Root *out_root);
//- rjf: pdb types and symbols
internal void pdbconv_types_and_symbols(PDBCONV_Ctx *pdb_ctx, PDBCONV_TypesSymbolsParams *params);
//- rjf: decoding helpers
internal U32 pdbconv_u32_from_numeric(PDBCONV_Ctx *ctx, CV_NumericParsed *num);
internal COFF_SectionHeader* pdbconv_sec_header_from_sec_num(PDBCONV_Ctx *ctx, U32 sec_num);
//- rjf: type info
//
// TODO(allen): explain the overarching pattern of PDB type info translation here
// 1. main passes (out of order necessity) & after
// 2. resolve forward
// 3. cons type info
// 4. "resolve itype"
// 5. equipping members & enumerates
// 6. equipping source coordinates
// type info construction passes
internal void pdbconv_type_cons_main_passes(PDBCONV_Ctx *ctx);
internal CV_TypeId pdbconv_type_resolve_fwd(PDBCONV_Ctx *ctx, CV_TypeId itype);
internal RADDBGIC_Type* pdbconv_type_resolve_itype(PDBCONV_Ctx *ctx, CV_TypeId itype);
internal void pdbconv_type_equip_members(PDBCONV_Ctx *ctx, RADDBGIC_Type *owern_type, CV_TypeId field_itype);
internal void pdbconv_type_equip_enumerates(PDBCONV_Ctx *ctx, RADDBGIC_Type *owner_type, CV_TypeId field_itype);
// type info construction helpers
internal RADDBGIC_Type* pdbconv_type_cons_basic(PDBCONV_Ctx *ctx, CV_TypeId itype);
internal RADDBGIC_Type* pdbconv_type_cons_leaf_record(PDBCONV_Ctx *ctx, CV_TypeId itype);
internal RADDBGIC_Type* pdbconv_type_resolve_and_check(PDBCONV_Ctx *ctx, CV_TypeId itype);
internal void pdbconv_type_resolve_arglist(Arena *arena, RADDBGIC_TypeList *out,
PDBCONV_Ctx *ctx, CV_TypeId arglist_itype);
// type info resolution helpers
internal RADDBGIC_Type* pdbconv_type_from_name(PDBCONV_Ctx *ctx, String8 name);
// type fwd map
internal void pdbconv_type_fwd_map_set(Arena *arena, PDBCONV_FwdMap *map,
CV_TypeId key, CV_TypeId val);
internal CV_TypeId pdbconv_type_fwd_map_get(PDBCONV_FwdMap *map, CV_TypeId key);
//- rjf: symbol info
// symbol info construction
internal U64 pdbconv_hash_from_local_user_id(U64 sym_hash, U64 id);
internal U64 pdbconv_hash_from_scope_user_id(U64 sym_hash, U64 id);
internal U64 pdbconv_hash_from_symbol_user_id(U64 sym_hash, U64 id);
internal void pdbconv_symbol_cons(PDBCONV_Ctx *ctx, CV_SymParsed *sym, U32 sym_unique_id);
internal void pdbconv_gather_link_names(PDBCONV_Ctx *ctx, CV_SymParsed *sym);
// "frameproc" map
internal void pdbconv_symbol_frame_proc_write(PDBCONV_Ctx *ctx,RADDBGIC_Symbol *key,
PDBCONV_FrameProcData *data);
internal PDBCONV_FrameProcData* pdbconv_symbol_frame_proc_read(PDBCONV_Ctx *ctx, RADDBGIC_Symbol *key);
// scope stack
internal void pdbconv_symbol_push_scope(PDBCONV_Ctx *ctx, RADDBGIC_Scope *scope, RADDBGIC_Symbol *symbol);
internal void pdbconv_symbol_pop_scope(PDBCONV_Ctx *ctx);
internal void pdbconv_symbol_clear_scope_stack(PDBCONV_Ctx *ctx);
#define pdbconv_symbol_current_scope(ctx) ((ctx)->scope_stack == 0)?0:((ctx)->scope_stack->scope)
#define pdbconv_symbol_current_symbol(ctx) ((ctx)->scope_stack == 0)?0:((ctx)->scope_stack->symbol)
// PDB/C++ name parsing helper
internal U64 pdbconv_end_of_cplusplus_container_name(String8 str);
// global deduplication
internal U64 pdbconv_known_global_hash(String8 name, U64 voff);
internal B32 pdbconv_known_global_lookup(PDBCONV_KnownGlobalSet *set, String8 name, U64 voff);
internal void pdbconv_known_global_insert(Arena *arena, PDBCONV_KnownGlobalSet *set,
String8 name, U64 voff);
// location info helpers
internal RADDBGIC_Location* pdbconv_location_from_addr_reg_off(PDBCONV_Ctx *ctx,
RADDBGI_RegisterCode reg_code,
U32 reg_byte_size,
U32 reg_byte_pos,
S64 offset,
B32 extra_indirection);
internal CV_EncodedFramePtrReg pdbconv_cv_encoded_fp_reg_from_proc(PDBCONV_Ctx *ctx,
RADDBGIC_Symbol *proc,
B32 param_base);
internal RADDBGI_RegisterCode pdbconv_reg_code_from_arch_encoded_fp_reg(RADDBGI_Arch arch,
CV_EncodedFramePtrReg encoded_reg);
internal void pdbconv_location_over_lvar_addr_range(PDBCONV_Ctx *ctx,
RADDBGIC_LocationSet *locset,
RADDBGIC_Location *location,
CV_LvarAddrRange *range,
CV_LvarAddrGap *gaps, U64 gap_count);
// link names
internal void pdbconv_link_name_save(Arena *arena, PDBCONV_LinkNameMap *map,
U64 voff, String8 name);
internal String8 pdbconv_link_name_find(PDBCONV_LinkNameMap *map, U64 voff);
////////////////////////////////
//~ rjf: Top-Level Conversion Entry Point
internal PDBCONV_Out *pdbconv_convert(Arena *arena, PDBCONV_Params *params);
#endif // RADDBGI_FROM_PDB_H #endif // RADDBGI_FROM_PDB_H
+4 -4
View File
@@ -85,7 +85,7 @@ REGS_RegCodeX64_ymm12,
REGS_RegCodeX64_ymm13, REGS_RegCodeX64_ymm13,
REGS_RegCodeX64_ymm14, REGS_RegCodeX64_ymm14,
REGS_RegCodeX64_ymm15, REGS_RegCodeX64_ymm15,
REGS_RegCodeX64_COUNT REGS_RegCodeX64_COUNT,
} REGS_RegCodeX64; } REGS_RegCodeX64;
typedef enum REGS_AliasCodeX64 typedef enum REGS_AliasCodeX64
@@ -170,7 +170,7 @@ REGS_AliasCodeX64_mm4,
REGS_AliasCodeX64_mm5, REGS_AliasCodeX64_mm5,
REGS_AliasCodeX64_mm6, REGS_AliasCodeX64_mm6,
REGS_AliasCodeX64_mm7, REGS_AliasCodeX64_mm7,
REGS_AliasCodeX64_COUNT REGS_AliasCodeX64_COUNT,
} REGS_AliasCodeX64; } REGS_AliasCodeX64;
typedef enum REGS_RegCodeX86 typedef enum REGS_RegCodeX86
@@ -236,7 +236,7 @@ REGS_RegCodeX86_ymm4,
REGS_RegCodeX86_ymm5, REGS_RegCodeX86_ymm5,
REGS_RegCodeX86_ymm6, REGS_RegCodeX86_ymm6,
REGS_RegCodeX86_ymm7, REGS_RegCodeX86_ymm7,
REGS_RegCodeX86_COUNT REGS_RegCodeX86_COUNT,
} REGS_RegCodeX86; } REGS_RegCodeX86;
typedef enum REGS_AliasCodeX86 typedef enum REGS_AliasCodeX86
@@ -277,7 +277,7 @@ REGS_AliasCodeX86_mm4,
REGS_AliasCodeX86_mm5, REGS_AliasCodeX86_mm5,
REGS_AliasCodeX86_mm6, REGS_AliasCodeX86_mm6,
REGS_AliasCodeX86_mm7, REGS_AliasCodeX86_mm7,
REGS_AliasCodeX86_COUNT REGS_AliasCodeX86_COUNT,
} REGS_AliasCodeX86; } REGS_AliasCodeX86;
typedef struct REGS_RegBlockX64 REGS_RegBlockX64; typedef struct REGS_RegBlockX64 REGS_RegBlockX64;
+16 -16
View File
@@ -299,18 +299,18 @@ REGS_ArchTable:
//////////////////////////////// ////////////////////////////////
//~ rjf: X64 Generators //~ rjf: X64 Generators
@table_gen_enum REGS_RegCodeX64: @enum REGS_RegCodeX64:
{ {
`REGS_RegCodeX64_NULL,`; NULL,
@expand(REGS_RegTableX64 a) `REGS_RegCodeX64_$(a.name),`; @expand(REGS_RegTableX64 a) `$(a.name)`,
`REGS_RegCodeX64_COUNT`; COUNT,
} }
@table_gen_enum REGS_AliasCodeX64: @enum REGS_AliasCodeX64:
{ {
`REGS_AliasCodeX64_NULL,`; NULL,
@expand(REGS_AliasTableX64 a) `REGS_AliasCodeX64_$(a.name),`; @expand(REGS_AliasTableX64 a) `$(a.name)`,
`REGS_AliasCodeX64_COUNT`; COUNT,
} }
@table_gen_struct @table_gen_struct
@@ -364,18 +364,18 @@ regs_g_alias_code_x64_slice_table:
//////////////////////////////// ////////////////////////////////
//~ rjf: X86 Generators //~ rjf: X86 Generators
@table_gen_enum REGS_RegCodeX86: @enum REGS_RegCodeX86:
{ {
`REGS_RegCodeX86_NULL,`; NULL,
@expand(REGS_RegTableX86 a) `REGS_RegCodeX86_$(a.name),`; @expand(REGS_RegTableX86 a) `$(a.name)`,
`REGS_RegCodeX86_COUNT`; COUNT,
} }
@table_gen_enum REGS_AliasCodeX86: @enum REGS_AliasCodeX86:
{ {
`REGS_AliasCodeX86_NULL,`; NULL,
@expand(REGS_AliasTableX86 a) `REGS_AliasCodeX86_$(a.name),`; @expand(REGS_AliasTableX86 a) `$(a.name)`,
`REGS_AliasCodeX86_COUNT`; COUNT,
} }
@table_gen_struct @table_gen_struct
@@ -13,7 +13,7 @@ R_D3D11_VShadKind_Blur,
R_D3D11_VShadKind_Mesh, R_D3D11_VShadKind_Mesh,
R_D3D11_VShadKind_Geo3DComposite, R_D3D11_VShadKind_Geo3DComposite,
R_D3D11_VShadKind_Finalize, R_D3D11_VShadKind_Finalize,
R_D3D11_VShadKind_COUNT R_D3D11_VShadKind_COUNT,
} R_D3D11_VShadKind; } R_D3D11_VShadKind;
typedef enum R_D3D11_PShadKind typedef enum R_D3D11_PShadKind
@@ -23,7 +23,7 @@ R_D3D11_PShadKind_Blur,
R_D3D11_PShadKind_Mesh, R_D3D11_PShadKind_Mesh,
R_D3D11_PShadKind_Geo3DComposite, R_D3D11_PShadKind_Geo3DComposite,
R_D3D11_PShadKind_Finalize, R_D3D11_PShadKind_Finalize,
R_D3D11_PShadKind_COUNT R_D3D11_PShadKind_COUNT,
} R_D3D11_PShadKind; } R_D3D11_PShadKind;
typedef enum R_D3D11_UniformTypeKind typedef enum R_D3D11_UniformTypeKind
@@ -31,7 +31,7 @@ typedef enum R_D3D11_UniformTypeKind
R_D3D11_UniformTypeKind_Rect, R_D3D11_UniformTypeKind_Rect,
R_D3D11_UniformTypeKind_Blur, R_D3D11_UniformTypeKind_Blur,
R_D3D11_UniformTypeKind_Mesh, R_D3D11_UniformTypeKind_Mesh,
R_D3D11_UniformTypeKind_COUNT R_D3D11_UniformTypeKind_COUNT,
} R_D3D11_UniformTypeKind; } R_D3D11_UniformTypeKind;
read_only global String8 r_d3d11_g_rect_shader_src = read_only global String8 r_d3d11_g_rect_shader_src =
+9 -12
View File
@@ -462,25 +462,22 @@ ps_main(Vertex2Pixel v2p) : SV_TARGET
//////////////////////////////// ////////////////////////////////
//~ rjf: Table Generators //~ rjf: Table Generators
@table_gen_enum @enum R_D3D11_VShadKind:
R_D3D11_VShadKind:
{ {
@expand(R_D3D11_VShadTable a) `R_D3D11_VShadKind_$(a.name),`; @expand(R_D3D11_VShadTable a) `$(a.name)`,
`R_D3D11_VShadKind_COUNT`; COUNT,
} }
@table_gen_enum @enum R_D3D11_PShadKind:
R_D3D11_PShadKind:
{ {
@expand(R_D3D11_PShadTable a) `R_D3D11_PShadKind_$(a.name),`; @expand(R_D3D11_PShadTable a) `$(a.name)`,
`R_D3D11_PShadKind_COUNT`; COUNT,
} }
@table_gen_enum @enum R_D3D11_UniformTypeKind:
R_D3D11_UniformTypeKind:
{ {
@expand(R_D3D11_UniformTypeTable a) `R_D3D11_UniformTypeKind_$(a.name),`; @expand(R_D3D11_UniformTypeTable a) `$(a.name)`,
`R_D3D11_UniformTypeKind_COUNT`; COUNT,
} }
@c_file @table_gen_data(type:String8, fallback:`{0}`) @c_file @table_gen_data(type:String8, fallback:`{0}`)
+6 -6
View File
@@ -17,21 +17,21 @@ R_Tex2DFormat_RGBA16,
R_Tex2DFormat_R32, R_Tex2DFormat_R32,
R_Tex2DFormat_RG32, R_Tex2DFormat_RG32,
R_Tex2DFormat_RGBA32, R_Tex2DFormat_RGBA32,
R_Tex2DFormat_COUNT R_Tex2DFormat_COUNT,
} R_Tex2DFormat; } R_Tex2DFormat;
typedef enum R_Tex2DKind typedef enum R_Tex2DKind
{ {
R_Tex2DKind_Static, R_Tex2DKind_Static,
R_Tex2DKind_Dynamic, R_Tex2DKind_Dynamic,
R_Tex2DKind_COUNT R_Tex2DKind_COUNT,
} R_Tex2DKind; } R_Tex2DKind;
typedef enum R_Tex2DSampleKind typedef enum R_Tex2DSampleKind
{ {
R_Tex2DSampleKind_Nearest, R_Tex2DSampleKind_Nearest,
R_Tex2DSampleKind_Linear, R_Tex2DSampleKind_Linear,
R_Tex2DSampleKind_COUNT R_Tex2DSampleKind_COUNT,
} R_Tex2DSampleKind; } R_Tex2DSampleKind;
typedef enum R_GeoTopologyKind typedef enum R_GeoTopologyKind
@@ -40,14 +40,14 @@ R_GeoTopologyKind_Lines,
R_GeoTopologyKind_LineStrip, R_GeoTopologyKind_LineStrip,
R_GeoTopologyKind_Triangles, R_GeoTopologyKind_Triangles,
R_GeoTopologyKind_TriangleStrip, R_GeoTopologyKind_TriangleStrip,
R_GeoTopologyKind_COUNT R_GeoTopologyKind_COUNT,
} R_GeoTopologyKind; } R_GeoTopologyKind;
typedef enum R_BufferKind typedef enum R_BufferKind
{ {
R_BufferKind_Static, R_BufferKind_Static,
R_BufferKind_Dynamic, R_BufferKind_Dynamic,
R_BufferKind_COUNT R_BufferKind_COUNT,
} R_BufferKind; } R_BufferKind;
typedef enum R_PassKind typedef enum R_PassKind
@@ -55,7 +55,7 @@ typedef enum R_PassKind
R_PassKind_UI, R_PassKind_UI,
R_PassKind_Blur, R_PassKind_Blur,
R_PassKind_Geo3D, R_PassKind_Geo3D,
R_PassKind_COUNT R_PassKind_COUNT,
} R_PassKind; } R_PassKind;
String8 r_tex2d_format_display_string_table[] = String8 r_tex2d_format_display_string_table[] =
+18 -18
View File
@@ -59,40 +59,40 @@ R_PassKindTable:
//////////////////////////////// ////////////////////////////////
//~ rjf: Generators //~ rjf: Generators
@table_gen_enum R_Tex2DFormat: @enum R_Tex2DFormat:
{ {
@expand(R_Tex2DFormatTable a) `R_Tex2DFormat_$(a.name),`; @expand(R_Tex2DFormatTable a) `$(a.name)`,
`R_Tex2DFormat_COUNT`; COUNT,
} }
@table_gen_enum R_Tex2DKind: @enum R_Tex2DKind:
{ {
@expand(R_Tex2DKindTable a) `R_Tex2DKind_$(a.name),`; @expand(R_Tex2DKindTable a) `$(a.name)`,
`R_Tex2DKind_COUNT`; COUNT,
} }
@table_gen_enum R_Tex2DSampleKind: @enum R_Tex2DSampleKind:
{ {
@expand(R_Tex2DSampleKindTable a) `R_Tex2DSampleKind_$(a.name),`; @expand(R_Tex2DSampleKindTable a) `$(a.name)`,
`R_Tex2DSampleKind_COUNT`; COUNT,
} }
@table_gen_enum R_GeoTopologyKind: @enum R_GeoTopologyKind:
{ {
@expand(R_GeoTopologyKindTable a) `R_GeoTopologyKind_$(a.name),`; @expand(R_GeoTopologyKindTable a) `$(a.name)`,
`R_GeoTopologyKind_COUNT`; COUNT,
} }
@table_gen_enum R_BufferKind: @enum R_BufferKind:
{ {
@expand(R_BufferKindTable a) `R_BufferKind_$(a.name),`; @expand(R_BufferKindTable a) `$(a.name)`,
`R_BufferKind_COUNT`; COUNT,
} }
@table_gen_enum R_PassKind: @enum R_PassKind:
{ {
@expand(R_PassKindTable a) `R_PassKind_$(a.name),`; @expand(R_PassKindTable a) `$(a.name)`,
`R_PassKind_COUNT`; COUNT,
} }
@table_gen_data(type:String8) r_tex2d_format_display_string_table: @table_gen_data(type:String8) r_tex2d_format_display_string_table:
+8 -8
View File
@@ -63,14 +63,14 @@ TG_Kind_IncompleteEnum,
TG_Kind_Bitfield, TG_Kind_Bitfield,
TG_Kind_Variadic, TG_Kind_Variadic,
TG_Kind_COUNT, TG_Kind_COUNT,
TG_Kind_FirstBasic = TG_Kind_Void, TG_Kind_FirstBasic = TG_Kind_Void,
TG_Kind_LastBasic = TG_Kind_ComplexF128, TG_Kind_LastBasic = TG_Kind_ComplexF128,
TG_Kind_FirstInteger = TG_Kind_Char8, TG_Kind_FirstInteger = TG_Kind_Char8,
TG_Kind_LastInteger = TG_Kind_S512, TG_Kind_LastInteger = TG_Kind_S512,
TG_Kind_FirstSigned1 = TG_Kind_Char8, TG_Kind_FirstSigned1 = TG_Kind_Char8,
TG_Kind_LastSigned1 = TG_Kind_Char32, TG_Kind_LastSigned1 = TG_Kind_Char32,
TG_Kind_FirstSigned2 = TG_Kind_S8, TG_Kind_FirstSigned2 = TG_Kind_S8,
TG_Kind_LastSigned2 = TG_Kind_S512, TG_Kind_LastSigned2 = TG_Kind_S512,
TG_Kind_FirstIncomplete = TG_Kind_IncompleteStruct, TG_Kind_FirstIncomplete = TG_Kind_IncompleteStruct,
TG_Kind_LastIncomplete = TG_Kind_IncompleteEnum, TG_Kind_LastIncomplete = TG_Kind_IncompleteEnum,
} TG_Kind; } TG_Kind;
+13 -14
View File
@@ -67,21 +67,20 @@ TG_KindTable:
//////////////////////////////// ////////////////////////////////
//~ rjf: Generators //~ rjf: Generators
@table_gen_enum @enum TG_Kind:
TG_Kind:
{ {
@expand(TG_KindTable a) `TG_Kind_$(a.name),`; @expand(TG_KindTable a) `$(a.name)`,
`TG_Kind_COUNT,`; COUNT,
`TG_Kind_FirstBasic = TG_Kind_Void,`; `FirstBasic = TG_Kind_Void`,
`TG_Kind_LastBasic = TG_Kind_ComplexF128,`; `LastBasic = TG_Kind_ComplexF128`,
`TG_Kind_FirstInteger = TG_Kind_Char8,`; `FirstInteger = TG_Kind_Char8`,
`TG_Kind_LastInteger = TG_Kind_S512,`; `LastInteger = TG_Kind_S512`,
`TG_Kind_FirstSigned1 = TG_Kind_Char8,`; `FirstSigned1 = TG_Kind_Char8`,
`TG_Kind_LastSigned1 = TG_Kind_Char32,`; `LastSigned1 = TG_Kind_Char32`,
`TG_Kind_FirstSigned2 = TG_Kind_S8,`; `FirstSigned2 = TG_Kind_S8`,
`TG_Kind_LastSigned2 = TG_Kind_S512,`; `LastSigned2 = TG_Kind_S512`,
`TG_Kind_FirstIncomplete = TG_Kind_IncompleteStruct,`; `FirstIncomplete = TG_Kind_IncompleteStruct`,
`TG_Kind_LastIncomplete = TG_Kind_IncompleteEnum,`; `LastIncomplete = TG_Kind_IncompleteEnum`,
} }
@table_gen_data(type:U8, fallback:0) @table_gen_data(type:U8, fallback:0)