diff --git a/include/vulkan/utility/vk_safe_struct.hpp b/include/vulkan/utility/vk_safe_struct.hpp index 4efcdcf..d8dcb9a 100644 --- a/include/vulkan/utility/vk_safe_struct.hpp +++ b/include/vulkan/utility/vk_safe_struct.hpp @@ -13494,33 +13494,11 @@ struct safe_VkDescriptorBufferBindingPushDescriptorBufferHandleEXT { return reinterpret_cast(this); } }; -union safe_VkDescriptorDataEXT { - const VkSampler* pSampler{}; - const VkDescriptorImageInfo* pCombinedImageSampler; - const VkDescriptorImageInfo* pInputAttachmentImage; - const VkDescriptorImageInfo* pSampledImage; - const VkDescriptorImageInfo* pStorageImage; - safe_VkDescriptorAddressInfoEXT* pUniformTexelBuffer; - safe_VkDescriptorAddressInfoEXT* pStorageTexelBuffer; - safe_VkDescriptorAddressInfoEXT* pUniformBuffer; - safe_VkDescriptorAddressInfoEXT* pStorageBuffer; - VkDeviceAddress accelerationStructure; - char type_at_end[sizeof(VkDescriptorDataEXT) + sizeof(VkDescriptorGetInfoEXT::type)]; - safe_VkDescriptorDataEXT(const VkDescriptorDataEXT* in_struct, const VkDescriptorType type, PNextCopyState* copy_state = {}); - safe_VkDescriptorDataEXT(const safe_VkDescriptorDataEXT& copy_src); - safe_VkDescriptorDataEXT& operator=(const safe_VkDescriptorDataEXT& copy_src); - safe_VkDescriptorDataEXT(); - ~safe_VkDescriptorDataEXT(); - void initialize(const VkDescriptorDataEXT* in_struct, const VkDescriptorType type, PNextCopyState* copy_state = {}); - void initialize(const safe_VkDescriptorDataEXT* copy_src, PNextCopyState* copy_state = {}); - VkDescriptorDataEXT* ptr() { return reinterpret_cast(this); } - VkDescriptorDataEXT const* ptr() const { return reinterpret_cast(this); } -}; struct safe_VkDescriptorGetInfoEXT { VkStructureType sType; const void* pNext{}; VkDescriptorType type; - safe_VkDescriptorDataEXT data; + VkDescriptorDataEXT data; safe_VkDescriptorGetInfoEXT(const VkDescriptorGetInfoEXT* in_struct, PNextCopyState* copy_state = {}, bool copy_pnext = true); safe_VkDescriptorGetInfoEXT(const safe_VkDescriptorGetInfoEXT& copy_src); diff --git a/scripts/generators/safe_struct_generator.py b/scripts/generators/safe_struct_generator.py index 8ce9a2a..b893877 100644 --- a/scripts/generators/safe_struct_generator.py +++ b/scripts/generators/safe_struct_generator.py @@ -80,9 +80,6 @@ def __init__(self): # vku::safe::AccelerationStructureGeometryKHR needs to know if we're doing a host or device build 'VkAccelerationStructureGeometryKHR' : ', const bool is_host, const VkAccelerationStructureBuildRangeInfoKHR *build_range_info', - # vku::safe::DescriptorDataEXT needs to know what field of union is intialized - 'VkDescriptorDataEXT' : - ', const VkDescriptorType type', } # Determine if a structure needs a safe_struct helper function @@ -90,6 +87,8 @@ def __init__(self): def needSafeStruct(self, struct: Struct) -> bool: if struct.name in self.no_autogen: return False + if struct.name in self.union_of_pointers: + return False if 'VkBase' in struct.name: return False # Ingore structs like VkBaseOutStructure if struct.sType is not None: @@ -192,9 +191,6 @@ def generateHeader(self): else: out.append(f'{member.cDeclaration}{initialize};\n') - if (struct.name == 'VkDescriptorDataEXT'): - out.append('char type_at_end[sizeof(VkDescriptorDataEXT)+sizeof(VkDescriptorGetInfoEXT::type)];') - constructParam = self.custom_construct_params.get(struct.name, '') out.append(f''' {safe_name}(const {struct.name}* in_struct{constructParam}, PNextCopyState* copy_state = {{}}{copy_pnext}); diff --git a/src/vulkan/vk_safe_struct_ext.cpp b/src/vulkan/vk_safe_struct_ext.cpp index 0f65c58..a399902 100644 --- a/src/vulkan/vk_safe_struct_ext.cpp +++ b/src/vulkan/vk_safe_struct_ext.cpp @@ -9179,19 +9179,19 @@ void safe_VkDescriptorBufferBindingPushDescriptorBufferHandleEXT::initialize( safe_VkDescriptorGetInfoEXT::safe_VkDescriptorGetInfoEXT(const VkDescriptorGetInfoEXT* in_struct, [[maybe_unused]] PNextCopyState* copy_state, bool copy_pnext) - : sType(in_struct->sType), type(in_struct->type), data(&in_struct->data, in_struct->type) { + : sType(in_struct->sType), type(in_struct->type), data(in_struct->data) { if (copy_pnext) { pNext = SafePnextCopy(in_struct->pNext, copy_state); } } safe_VkDescriptorGetInfoEXT::safe_VkDescriptorGetInfoEXT() - : sType(VK_STRUCTURE_TYPE_DESCRIPTOR_GET_INFO_EXT), pNext(nullptr), type() {} + : sType(VK_STRUCTURE_TYPE_DESCRIPTOR_GET_INFO_EXT), pNext(nullptr), type(), data() {} safe_VkDescriptorGetInfoEXT::safe_VkDescriptorGetInfoEXT(const safe_VkDescriptorGetInfoEXT& copy_src) { sType = copy_src.sType; type = copy_src.type; - data.initialize(©_src.data); + data = copy_src.data; pNext = SafePnextCopy(copy_src.pNext); } @@ -9202,7 +9202,7 @@ safe_VkDescriptorGetInfoEXT& safe_VkDescriptorGetInfoEXT::operator=(const safe_V sType = copy_src.sType; type = copy_src.type; - data.initialize(©_src.data); + data = copy_src.data; pNext = SafePnextCopy(copy_src.pNext); return *this; @@ -9214,7 +9214,7 @@ void safe_VkDescriptorGetInfoEXT::initialize(const VkDescriptorGetInfoEXT* in_st FreePnextChain(pNext); sType = in_struct->sType; type = in_struct->type; - data.initialize(&in_struct->data, in_struct->type); + data = in_struct->data; pNext = SafePnextCopy(in_struct->pNext, copy_state); } @@ -9222,7 +9222,7 @@ void safe_VkDescriptorGetInfoEXT::initialize(const safe_VkDescriptorGetInfoEXT* [[maybe_unused]] PNextCopyState* copy_state) { sType = copy_src->sType; type = copy_src->type; - data.initialize(©_src->data); + data = copy_src->data; pNext = SafePnextCopy(copy_src->pNext); } diff --git a/src/vulkan/vk_safe_struct_manual.cpp b/src/vulkan/vk_safe_struct_manual.cpp index 4e50f8a..e20dd9b 100644 --- a/src/vulkan/vk_safe_struct_manual.cpp +++ b/src/vulkan/vk_safe_struct_manual.cpp @@ -303,490 +303,6 @@ void safe_VkRayTracingPipelineCreateInfoCommon::initialize(const VkRayTracingPip safe_VkRayTracingPipelineCreateInfoKHR::initialize(pCreateInfo); } -safe_VkDescriptorDataEXT::safe_VkDescriptorDataEXT(const VkDescriptorDataEXT* in_struct, const VkDescriptorType type, - [[maybe_unused]] PNextCopyState* copy_state) { - VkDescriptorType* pType = (VkDescriptorType*)&type_at_end[sizeof(VkDescriptorDataEXT)]; - - switch (type) { - case VK_DESCRIPTOR_TYPE_MAX_ENUM: - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: - break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: - break; - case VK_DESCRIPTOR_TYPE_SAMPLER: - pSampler = new VkSampler(*in_struct->pSampler); - break; - case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: - pCombinedImageSampler = new VkDescriptorImageInfo(*in_struct->pCombinedImageSampler); - break; - case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: - pSampledImage = in_struct->pSampledImage ? new VkDescriptorImageInfo(*in_struct->pSampledImage) : nullptr; - break; - case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: - pStorageImage = in_struct->pStorageImage ? new VkDescriptorImageInfo(*in_struct->pStorageImage) : nullptr; - break; - case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: - pInputAttachmentImage = new VkDescriptorImageInfo(*in_struct->pInputAttachmentImage); - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER: - pUniformTexelBuffer = - in_struct->pUniformTexelBuffer ? new safe_VkDescriptorAddressInfoEXT(in_struct->pUniformTexelBuffer) : nullptr; - break; - case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: - pStorageTexelBuffer = - in_struct->pStorageTexelBuffer ? new safe_VkDescriptorAddressInfoEXT(in_struct->pStorageTexelBuffer) : nullptr; - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: - pUniformBuffer = in_struct->pUniformBuffer ? new safe_VkDescriptorAddressInfoEXT(in_struct->pUniformBuffer) : nullptr; - break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: - pStorageBuffer = in_struct->pStorageBuffer ? new safe_VkDescriptorAddressInfoEXT(in_struct->pStorageBuffer) : nullptr; - break; - case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR: - accelerationStructure = in_struct->accelerationStructure; - break; - case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV: - accelerationStructure = in_struct->accelerationStructure; - break; - default: - break; - } - - *pType = type; -} - -safe_VkDescriptorDataEXT::safe_VkDescriptorDataEXT() : type_at_end{0} { - VkDescriptorType* pType = (VkDescriptorType*)&type_at_end[sizeof(VkDescriptorDataEXT)]; - *pType = VK_DESCRIPTOR_TYPE_MAX_ENUM; -} - -safe_VkDescriptorDataEXT::safe_VkDescriptorDataEXT(const safe_VkDescriptorDataEXT& copy_src) { - pSampler = nullptr; - pCombinedImageSampler = nullptr; - pInputAttachmentImage = nullptr; - pSampledImage = nullptr; - pStorageImage = nullptr; - pUniformTexelBuffer = nullptr; - pStorageTexelBuffer = nullptr; - pUniformBuffer = nullptr; - pStorageBuffer = nullptr; - accelerationStructure = copy_src.accelerationStructure; - - VkDescriptorType* pType = (VkDescriptorType*)&type_at_end[sizeof(VkDescriptorDataEXT)]; - VkDescriptorType type = *(VkDescriptorType*)©_src.type_at_end[sizeof(VkDescriptorDataEXT)]; - - switch (type) { - case VK_DESCRIPTOR_TYPE_MAX_ENUM: - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: - break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: - break; - case VK_DESCRIPTOR_TYPE_SAMPLER: - pSampler = new VkSampler(*copy_src.pSampler); - break; - case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: - pCombinedImageSampler = new VkDescriptorImageInfo(*copy_src.pCombinedImageSampler); - break; - case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: - pSampledImage = new VkDescriptorImageInfo(*copy_src.pSampledImage); - break; - case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: - pStorageImage = new VkDescriptorImageInfo(*copy_src.pStorageImage); - break; - case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: - pInputAttachmentImage = new VkDescriptorImageInfo(*copy_src.pInputAttachmentImage); - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER: - pUniformTexelBuffer = new safe_VkDescriptorAddressInfoEXT(*copy_src.pUniformTexelBuffer); - break; - case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: - pStorageTexelBuffer = new safe_VkDescriptorAddressInfoEXT(*copy_src.pStorageTexelBuffer); - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: - pUniformBuffer = new safe_VkDescriptorAddressInfoEXT(*copy_src.pUniformBuffer); - break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: - pStorageBuffer = new safe_VkDescriptorAddressInfoEXT(*copy_src.pStorageBuffer); - break; - case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR: - accelerationStructure = copy_src.accelerationStructure; - break; - case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV: - accelerationStructure = copy_src.accelerationStructure; - break; - default: - break; - } - - *pType = type; -} - -safe_VkDescriptorDataEXT& safe_VkDescriptorDataEXT::operator=(const safe_VkDescriptorDataEXT& copy_src) { - if (©_src == this) return *this; - - VkDescriptorType& thisType = *(VkDescriptorType*)&type_at_end[sizeof(VkDescriptorDataEXT)]; - - switch (thisType) { - case VK_DESCRIPTOR_TYPE_MAX_ENUM: - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: - break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: - break; - case VK_DESCRIPTOR_TYPE_SAMPLER: - delete pSampler; - pSampler = nullptr; - break; - case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: - delete pCombinedImageSampler; - pCombinedImageSampler = nullptr; - break; - case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: - delete pSampledImage; - pSampledImage = nullptr; - break; - case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: - delete pStorageImage; - pStorageImage = nullptr; - break; - case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: - delete pInputAttachmentImage; - pInputAttachmentImage = nullptr; - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER: - delete pUniformTexelBuffer; - pUniformTexelBuffer = nullptr; - break; - case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: - delete pStorageTexelBuffer; - pStorageTexelBuffer = nullptr; - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: - delete pUniformBuffer; - pUniformBuffer = nullptr; - break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: - delete pStorageBuffer; - pStorageBuffer = nullptr; - break; - case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR: - accelerationStructure = 0ull; - break; - case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV: - accelerationStructure = 0ull; - break; - default: - break; - } - - thisType = VK_DESCRIPTOR_TYPE_MAX_ENUM; - - pSampler = nullptr; - pCombinedImageSampler = nullptr; - pInputAttachmentImage = nullptr; - pSampledImage = nullptr; - pStorageImage = nullptr; - pUniformTexelBuffer = nullptr; - pStorageTexelBuffer = nullptr; - pUniformBuffer = nullptr; - pStorageBuffer = nullptr; - accelerationStructure = copy_src.accelerationStructure; - - VkDescriptorType* pType = (VkDescriptorType*)&type_at_end[sizeof(VkDescriptorDataEXT)]; - VkDescriptorType type = *(VkDescriptorType*)©_src.type_at_end[sizeof(VkDescriptorDataEXT)]; - - switch (type) { - case VK_DESCRIPTOR_TYPE_MAX_ENUM: - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: - break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: - break; - case VK_DESCRIPTOR_TYPE_SAMPLER: - pSampler = new VkSampler(*copy_src.pSampler); - break; - case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: - pCombinedImageSampler = new VkDescriptorImageInfo(*copy_src.pCombinedImageSampler); - break; - case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: - pSampledImage = new VkDescriptorImageInfo(*copy_src.pSampledImage); - break; - case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: - pStorageImage = new VkDescriptorImageInfo(*copy_src.pStorageImage); - break; - case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: - pInputAttachmentImage = new VkDescriptorImageInfo(*copy_src.pInputAttachmentImage); - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER: - pUniformTexelBuffer = new safe_VkDescriptorAddressInfoEXT(*copy_src.pUniformTexelBuffer); - break; - case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: - pStorageTexelBuffer = new safe_VkDescriptorAddressInfoEXT(*copy_src.pStorageTexelBuffer); - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: - pUniformBuffer = new safe_VkDescriptorAddressInfoEXT(*copy_src.pUniformBuffer); - break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: - pStorageBuffer = new safe_VkDescriptorAddressInfoEXT(*copy_src.pStorageBuffer); - break; - case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR: - accelerationStructure = copy_src.accelerationStructure; - break; - case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV: - accelerationStructure = copy_src.accelerationStructure; - break; - default: - break; - } - - *pType = type; - - return *this; -} - -safe_VkDescriptorDataEXT::~safe_VkDescriptorDataEXT() { - VkDescriptorType& thisType = *(VkDescriptorType*)&type_at_end[sizeof(VkDescriptorDataEXT)]; - - switch (thisType) { - case VK_DESCRIPTOR_TYPE_MAX_ENUM: - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: - break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: - break; - case VK_DESCRIPTOR_TYPE_SAMPLER: - delete pSampler; - pSampler = nullptr; - break; - case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: - delete pCombinedImageSampler; - pCombinedImageSampler = nullptr; - break; - case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: - delete pSampledImage; - pSampledImage = nullptr; - break; - case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: - delete pStorageImage; - pStorageImage = nullptr; - break; - case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: - delete pInputAttachmentImage; - pInputAttachmentImage = nullptr; - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER: - delete pUniformTexelBuffer; - pUniformTexelBuffer = nullptr; - break; - case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: - delete pStorageTexelBuffer; - pStorageTexelBuffer = nullptr; - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: - delete pUniformBuffer; - pUniformBuffer = nullptr; - break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: - delete pStorageBuffer; - pStorageBuffer = nullptr; - break; - case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR: - accelerationStructure = 0ull; - break; - case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV: - accelerationStructure = 0ull; - break; - default: - break; - } - - thisType = VK_DESCRIPTOR_TYPE_MAX_ENUM; -} - -void safe_VkDescriptorDataEXT::initialize(const VkDescriptorDataEXT* in_struct, const VkDescriptorType type, - [[maybe_unused]] PNextCopyState* copy_state) { - VkDescriptorType& thisType = *(VkDescriptorType*)&type_at_end[sizeof(VkDescriptorDataEXT)]; - - switch (thisType) { - case VK_DESCRIPTOR_TYPE_MAX_ENUM: - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: - break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: - break; - case VK_DESCRIPTOR_TYPE_SAMPLER: - delete pSampler; - pSampler = nullptr; - break; - case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: - delete pCombinedImageSampler; - pCombinedImageSampler = nullptr; - break; - case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: - delete pSampledImage; - pSampledImage = nullptr; - break; - case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: - delete pStorageImage; - pStorageImage = nullptr; - break; - case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: - delete pInputAttachmentImage; - pInputAttachmentImage = nullptr; - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER: - delete pUniformTexelBuffer; - pUniformTexelBuffer = nullptr; - break; - case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: - delete pStorageTexelBuffer; - pStorageTexelBuffer = nullptr; - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: - delete pUniformBuffer; - pUniformBuffer = nullptr; - break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: - delete pStorageBuffer; - pStorageBuffer = nullptr; - break; - case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR: - accelerationStructure = 0ull; - break; - case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV: - accelerationStructure = 0ull; - break; - default: - break; - } - - thisType = VK_DESCRIPTOR_TYPE_MAX_ENUM; - pSampler = nullptr; - pCombinedImageSampler = nullptr; - pInputAttachmentImage = nullptr; - pSampledImage = nullptr; - pStorageImage = nullptr; - pUniformTexelBuffer = nullptr; - pStorageTexelBuffer = nullptr; - pUniformBuffer = nullptr; - pStorageBuffer = nullptr; - accelerationStructure = in_struct->accelerationStructure; - - VkDescriptorType* pType = (VkDescriptorType*)&type_at_end[sizeof(VkDescriptorDataEXT)]; - - switch (type) { - case VK_DESCRIPTOR_TYPE_MAX_ENUM: - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: - break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: - break; - case VK_DESCRIPTOR_TYPE_SAMPLER: - pSampler = new VkSampler(*in_struct->pSampler); - break; - case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: - pCombinedImageSampler = new VkDescriptorImageInfo(*in_struct->pCombinedImageSampler); - break; - case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: - pSampledImage = in_struct->pSampledImage ? new VkDescriptorImageInfo(*in_struct->pSampledImage) : nullptr; - break; - case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: - pStorageImage = in_struct->pStorageImage ? new VkDescriptorImageInfo(*in_struct->pStorageImage) : nullptr; - break; - case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: - pInputAttachmentImage = new VkDescriptorImageInfo(*in_struct->pInputAttachmentImage); - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER: - pUniformTexelBuffer = - in_struct->pUniformTexelBuffer ? new safe_VkDescriptorAddressInfoEXT(in_struct->pUniformTexelBuffer) : nullptr; - break; - case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: - pStorageTexelBuffer = - in_struct->pStorageTexelBuffer ? new safe_VkDescriptorAddressInfoEXT(in_struct->pStorageTexelBuffer) : nullptr; - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: - pUniformBuffer = in_struct->pUniformBuffer ? new safe_VkDescriptorAddressInfoEXT(in_struct->pUniformBuffer) : nullptr; - break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: - pStorageBuffer = in_struct->pStorageBuffer ? new safe_VkDescriptorAddressInfoEXT(in_struct->pStorageBuffer) : nullptr; - break; - case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR: - accelerationStructure = in_struct->accelerationStructure; - break; - case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV: - accelerationStructure = in_struct->accelerationStructure; - break; - default: - break; - } - - *pType = type; -} - -void safe_VkDescriptorDataEXT::initialize(const safe_VkDescriptorDataEXT* copy_src, [[maybe_unused]] PNextCopyState* copy_state) { - pSampler = nullptr; - pCombinedImageSampler = nullptr; - pInputAttachmentImage = nullptr; - pSampledImage = nullptr; - pStorageImage = nullptr; - pUniformTexelBuffer = nullptr; - pStorageTexelBuffer = nullptr; - pUniformBuffer = nullptr; - pStorageBuffer = nullptr; - accelerationStructure = copy_src->accelerationStructure; - - VkDescriptorType* pType = (VkDescriptorType*)&type_at_end[sizeof(VkDescriptorDataEXT)]; - VkDescriptorType type = *(VkDescriptorType*)©_src->type_at_end[sizeof(VkDescriptorDataEXT)]; - - switch (type) { - case VK_DESCRIPTOR_TYPE_MAX_ENUM: - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: - break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: - break; - case VK_DESCRIPTOR_TYPE_SAMPLER: - pSampler = new VkSampler(*copy_src->pSampler); - break; - case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: - pCombinedImageSampler = new VkDescriptorImageInfo(*copy_src->pCombinedImageSampler); - break; - case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: - pSampledImage = new VkDescriptorImageInfo(*copy_src->pSampledImage); - break; - case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: - pStorageImage = new VkDescriptorImageInfo(*copy_src->pStorageImage); - break; - case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: - pInputAttachmentImage = new VkDescriptorImageInfo(*copy_src->pInputAttachmentImage); - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER: - pUniformTexelBuffer = new safe_VkDescriptorAddressInfoEXT(*copy_src->pUniformTexelBuffer); - break; - case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: - pStorageTexelBuffer = new safe_VkDescriptorAddressInfoEXT(*copy_src->pStorageTexelBuffer); - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: - pUniformBuffer = new safe_VkDescriptorAddressInfoEXT(*copy_src->pUniformBuffer); - break; - case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: - pStorageBuffer = new safe_VkDescriptorAddressInfoEXT(*copy_src->pStorageBuffer); - break; - case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR: - accelerationStructure = copy_src->accelerationStructure; - break; - case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV: - accelerationStructure = copy_src->accelerationStructure; - break; - default: - break; - } - - *pType = type; -} - safe_VkGraphicsPipelineCreateInfo::safe_VkGraphicsPipelineCreateInfo(const VkGraphicsPipelineCreateInfo* in_struct, const bool uses_color_attachment, const bool uses_depthstencil_attachment,