Skip to content

Commit 4740447

Browse files
Use VulkanObject aliases in codegen
This information was missing in the initial VulkanObject rewrite, but has since been added.
1 parent d002f8e commit 4740447

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

loader/generated/vk_object_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ typedef enum VulkanObjectType {
9494
kVulkanObjectTypeIndirectCommandsLayoutEXT = 53,
9595
kVulkanObjectTypeMax = 54,
9696
// Aliases for backwards compatibilty of "promoted" types
97-
kVulkanObjectTypeDescriptorUpdateTemplateKHR = kVulkanObjectTypeDescriptorUpdateTemplate,
9897
kVulkanObjectTypeSamplerYcbcrConversionKHR = kVulkanObjectTypeSamplerYcbcrConversion,
98+
kVulkanObjectTypeDescriptorUpdateTemplateKHR = kVulkanObjectTypeDescriptorUpdateTemplate,
9999
kVulkanObjectTypePrivateDataSlotEXT = kVulkanObjectTypePrivateDataSlot,
100100
} VulkanObjectType;
101101

scripts/helper_file_generator.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ def generate(self):
118118

119119
# Create a list with the needed information so that when we print, we print in the exact same order, as we are printing arrays where external code may index into it
120120
object_types = []
121+
object_type_aliases = {}
121122
enum_num = 1 # start at one since the zero place is manually printed with the UNKNOWN value
122123
for handle in self.vk.handles.values():
123124
debug_report_object_name = self.convert_to_VK_DEBUG_REPORT_OBJECT_TYPE(handle.name)
@@ -126,7 +127,8 @@ def generate(self):
126127
else:
127128
object_types.append((f'{handle.name[2:]}', enum_num, 'VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT'))
128129
enum_num += 1
129-
130+
if len(handle.aliases) > 0:
131+
object_type_aliases[handle.name] = handle.aliases
130132

131133
out.append('// Object Type enum for validation layer internal object handling\n')
132134
out.append('typedef enum VulkanObjectType {\n')
@@ -135,11 +137,10 @@ def generate(self):
135137
out.append(f' kVulkanObjectType{name} = {number},\n')
136138
out.append(f' kVulkanObjectTypeMax = {enum_num},\n')
137139

138-
# Hardcode the alises as Vulkan Object lacks this information currently
139140
out.append(' // Aliases for backwards compatibilty of "promoted" types\n')
140-
out.append(' kVulkanObjectTypeDescriptorUpdateTemplateKHR = kVulkanObjectTypeDescriptorUpdateTemplate,\n')
141-
out.append(' kVulkanObjectTypeSamplerYcbcrConversionKHR = kVulkanObjectTypeSamplerYcbcrConversion,\n')
142-
out.append(' kVulkanObjectTypePrivateDataSlotEXT = kVulkanObjectTypePrivateDataSlot,\n')
141+
for name, aliases in object_type_aliases.items():
142+
for alias in aliases:
143+
out.append(f' kVulkanObjectType{alias[2:]} = kVulkanObjectType{name[2:]},\n')
143144

144145
out.append('} VulkanObjectType;\n')
145146
out.append('\n')

0 commit comments

Comments
 (0)