mirror of
https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git
synced 2025-05-15 01:08:39 +00:00
safestruct: Add VkPipelineCreatInfoKHR workaround
Pipeline create info structs can appear in the VkPipelineCreatInfoKHR pNext chain even though they don't extend that structure in the traditional sense.
This commit is contained in:
parent
8f19d57274
commit
fbb4db92c6
2 changed files with 37 additions and 2 deletions
|
@ -82,6 +82,17 @@ class SafeStructOutputGenerator(BaseGenerator):
|
|||
', const bool is_host, const VkAccelerationStructureBuildRangeInfoKHR *build_range_info',
|
||||
}
|
||||
|
||||
def isInPnextChain(self, struct: Struct) -> bool:
|
||||
# Can appear in VkPipelineCreateInfoKHR::pNext even though it isn't listed in the xml structextends attribute
|
||||
# VUID-VkPipelineCreateInfoKHR-pNext-09604
|
||||
pipeline_create_infos = [
|
||||
'VkGraphicsPipelineCreateInfo',
|
||||
'VkExecutionGraphPipelineCreateInfoAMDX',
|
||||
'VkRayTracingPipelineCreateInfoKHR',
|
||||
'VkComputePipelineCreateInfo',
|
||||
]
|
||||
return struct.extends or struct.name in pipeline_create_infos
|
||||
|
||||
# Determine if a structure needs a safe_struct helper function
|
||||
# That is, it has an sType or one of its members is a pointer
|
||||
def needSafeStruct(self, struct: Struct) -> bool:
|
||||
|
@ -296,7 +307,7 @@ void *SafePnextCopy(const void *pNext, PNextCopyState* copy_state) {
|
|||
}
|
||||
''')
|
||||
guard_helper = PlatformGuardHelper()
|
||||
for struct in [x for x in self.vk.structs.values() if x.extends]:
|
||||
for struct in filter(self.isInPnextChain, self.vk.structs.values()):
|
||||
safe_name = self.convertName(struct.name)
|
||||
out.extend(guard_helper.add_guard(struct.protect))
|
||||
out.append(f' case {struct.sType}:\n')
|
||||
|
@ -352,7 +363,7 @@ void FreePnextChain(const void *pNext) {
|
|||
break;
|
||||
''')
|
||||
|
||||
for struct in [x for x in self.vk.structs.values() if x.extends]:
|
||||
for struct in filter(self.isInPnextChain, self.vk.structs.values()):
|
||||
safe_name = self.convertName(struct.name)
|
||||
out.extend(guard_helper.add_guard(struct.protect))
|
||||
out.append(f' case {struct.sType}:\n')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue