From c73e4efcb75a05ecee6d7ab7c10b001db495cc04 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 4 Dec 2021 09:29:38 +0900 Subject: [PATCH] [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). --- libs/video/renderer/vulkan/vkgen/vkfieldcustom.r | 5 +++++ libs/video/renderer/vulkan/vkgen/vkfielddef.h | 1 + libs/video/renderer/vulkan/vkgen/vkfielddef.r | 5 +++++ libs/video/renderer/vulkan/vkgen/vkstruct.r | 11 +++++++++++ 4 files changed, 22 insertions(+) diff --git a/libs/video/renderer/vulkan/vkgen/vkfieldcustom.r b/libs/video/renderer/vulkan/vkgen/vkfieldcustom.r index 611cd7a9b..57d8fa54e 100644 --- a/libs/video/renderer/vulkan/vkgen/vkfieldcustom.r +++ b/libs/video/renderer/vulkan/vkgen/vkfieldcustom.r @@ -65,4 +65,9 @@ return self; } +-(int) searchType +{ + return 0; +} + @end diff --git a/libs/video/renderer/vulkan/vkgen/vkfielddef.h b/libs/video/renderer/vulkan/vkgen/vkfielddef.h index 0363a9e7f..747df01e6 100644 --- a/libs/video/renderer/vulkan/vkgen/vkfielddef.h +++ b/libs/video/renderer/vulkan/vkgen/vkfielddef.h @@ -23,6 +23,7 @@ -writeField; -writeSymbol; -(string) name; +-(int) searchType; @end #endif//__renderer_vulkan_vkgen_vkfielddef_h diff --git a/libs/video/renderer/vulkan/vkgen/vkfielddef.r b/libs/video/renderer/vulkan/vkgen/vkfielddef.r index 6aba1df05..b3c81096f 100644 --- a/libs/video/renderer/vulkan/vkgen/vkfielddef.r +++ b/libs/video/renderer/vulkan/vkgen/vkfielddef.r @@ -95,4 +95,9 @@ return field_name; } +-(int) searchType +{ + return 1; +} + @end diff --git a/libs/video/renderer/vulkan/vkgen/vkstruct.r b/libs/video/renderer/vulkan/vkgen/vkstruct.r index 4d94ac8a5..500659bc0 100644 --- a/libs/video/renderer/vulkan/vkgen/vkstruct.r +++ b/libs/video/renderer/vulkan/vkgen/vkstruct.r @@ -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]; }