From f5be57e498a2ad191e5071a08b6353e34416b447 Mon Sep 17 00:00:00 2001 From: asuessenbach Date: Tue, 4 Oct 2022 11:34:04 +0200 Subject: [PATCH] Corrected handling of mutual exclusive arrays in constructors of structures VkAccelerationStructureTrianglesOpacityMicromapEXT and VkMicromapBuildInfoEXT --- VulkanHppGenerator.cpp | 8 +++++--- vulkan/vulkan_structs.hpp | 36 +++++++++++++++++------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 15caab4..a7d5f78 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -12765,8 +12765,10 @@ void VulkanHppGenerator::readTypesTypeStruct( tinyxml2::XMLElement const * eleme // Note: even though the arrays are not marked as optional, they still might be mutually exclusive (like in // VkWriteDescriptorSet)! That is, there's not enough information available in vk.xml to decide on that, so we // need this external knowledge! - static std::set mutualExclusiveStructs = { "VkAccelerationStructureBuildGeometryInfoKHR", "VkWriteDescriptorSet" }; - static std::set multipleLenStructs = { "VkImageConstraintsInfoFUCHSIA", + static std::set mutualExclusiveStructs = { + "VkAccelerationStructureBuildGeometryInfoKHR", "VkAccelerationStructureTrianglesOpacityMicromapEXT", "VkMicromapBuildInfoEXT", "VkWriteDescriptorSet" + }; + static std::set multipleLenStructs = { "VkImageConstraintsInfoFUCHSIA", "VkIndirectCommandsLayoutTokenNV", "VkPresentInfoKHR", "VkSemaphoreWaitInfo", @@ -12775,7 +12777,7 @@ void VulkanHppGenerator::readTypesTypeStruct( tinyxml2::XMLElement const * eleme "VkSubpassDescription2", "VkWin32KeyedMutexAcquireReleaseInfoKHR", "VkWin32KeyedMutexAcquireReleaseInfoNV" }; - bool warned = false; + bool warned = false; for ( auto m0It = it->second.members.begin(); !warned && ( m0It != it->second.members.end() ); ++m0It ) { if ( !m0It->len.empty() && ( m0It->len.front() != "null-terminated" ) ) diff --git a/vulkan/vulkan_structs.hpp b/vulkan/vulkan_structs.hpp index eb83a4e..f157225 100644 --- a/vulkan/vulkan_structs.hpp +++ b/vulkan/vulkan_structs.hpp @@ -2516,10 +2516,10 @@ namespace VULKAN_HPP_NAMESPACE public: VULKAN_HPP_NAMESPACE::TransformMatrixKHR transform = {}; - uint32_t instanceCustomIndex : 24; - uint32_t mask : 8; + uint32_t instanceCustomIndex : 24; + uint32_t mask : 8; uint32_t instanceShaderBindingTableRecordOffset : 24; - VkGeometryInstanceFlagsKHR flags : 8; + VkGeometryInstanceFlagsKHR flags : 8; uint64_t accelerationStructureReference = {}; }; using AccelerationStructureInstanceNV = AccelerationStructureInstanceKHR; @@ -2662,10 +2662,10 @@ namespace VULKAN_HPP_NAMESPACE public: VULKAN_HPP_NAMESPACE::TransformMatrixKHR transformT0 = {}; VULKAN_HPP_NAMESPACE::TransformMatrixKHR transformT1 = {}; - uint32_t instanceCustomIndex : 24; - uint32_t mask : 8; + uint32_t instanceCustomIndex : 24; + uint32_t mask : 8; uint32_t instanceShaderBindingTableRecordOffset : 24; - VkGeometryInstanceFlagsKHR flags : 8; + VkGeometryInstanceFlagsKHR flags : 8; uint64_t accelerationStructureReference = {}; }; @@ -3256,10 +3256,10 @@ namespace VULKAN_HPP_NAMESPACE public: VULKAN_HPP_NAMESPACE::SRTDataNV transformT0 = {}; VULKAN_HPP_NAMESPACE::SRTDataNV transformT1 = {}; - uint32_t instanceCustomIndex : 24; - uint32_t mask : 8; + uint32_t instanceCustomIndex : 24; + uint32_t mask : 8; uint32_t instanceShaderBindingTableRecordOffset : 24; - VkGeometryInstanceFlagsKHR flags : 8; + VkGeometryInstanceFlagsKHR flags : 8; uint64_t accelerationStructureReference = {}; }; @@ -3556,19 +3556,19 @@ namespace VULKAN_HPP_NAMESPACE , indexBuffer( indexBuffer_ ) , indexStride( indexStride_ ) , baseTriangle( baseTriangle_ ) - , usageCountsCount( static_cast( usageCounts_.size() ) ) + , usageCountsCount( static_cast( !usageCounts_.empty() ? usageCounts_.size() : pUsageCounts_.size() ) ) , pUsageCounts( usageCounts_.data() ) , ppUsageCounts( pUsageCounts_.data() ) , micromap( micromap_ ) { # ifdef VULKAN_HPP_NO_EXCEPTIONS - VULKAN_HPP_ASSERT( usageCounts_.empty() || pUsageCounts_.empty() || ( usageCounts_.size() == pUsageCounts_.size() ) ); + VULKAN_HPP_ASSERT( ( !usageCounts_.empty() + !pUsageCounts_.empty() ) <= 1 ); # else - if ( !usageCounts_.empty() && !pUsageCounts_.empty() && ( usageCounts_.size() != pUsageCounts_.size() ) ) + if ( 1 < ( !usageCounts_.empty() + !pUsageCounts_.empty() ) ) { throw LogicError( VULKAN_HPP_NAMESPACE_STRING - "::AccelerationStructureTrianglesOpacityMicromapEXT::AccelerationStructureTrianglesOpacityMicromapEXT: !usageCounts_.empty() && !pUsageCounts_.empty() && ( usageCounts_.size() != pUsageCounts_.size() )" ); + "::AccelerationStructureTrianglesOpacityMicromapEXT::AccelerationStructureTrianglesOpacityMicromapEXT: 1 < ( !usageCounts_.empty() + !pUsageCounts_.empty() )" ); } # endif /*VULKAN_HPP_NO_EXCEPTIONS*/ } @@ -45136,7 +45136,7 @@ namespace VULKAN_HPP_NAMESPACE , flags( flags_ ) , mode( mode_ ) , dstMicromap( dstMicromap_ ) - , usageCountsCount( static_cast( usageCounts_.size() ) ) + , usageCountsCount( static_cast( !usageCounts_.empty() ? usageCounts_.size() : pUsageCounts_.size() ) ) , pUsageCounts( usageCounts_.data() ) , ppUsageCounts( pUsageCounts_.data() ) , data( data_ ) @@ -45145,13 +45145,11 @@ namespace VULKAN_HPP_NAMESPACE , triangleArrayStride( triangleArrayStride_ ) { # ifdef VULKAN_HPP_NO_EXCEPTIONS - VULKAN_HPP_ASSERT( usageCounts_.empty() || pUsageCounts_.empty() || ( usageCounts_.size() == pUsageCounts_.size() ) ); + VULKAN_HPP_ASSERT( ( !usageCounts_.empty() + !pUsageCounts_.empty() ) <= 1 ); # else - if ( !usageCounts_.empty() && !pUsageCounts_.empty() && ( usageCounts_.size() != pUsageCounts_.size() ) ) + if ( 1 < ( !usageCounts_.empty() + !pUsageCounts_.empty() ) ) { - throw LogicError( - VULKAN_HPP_NAMESPACE_STRING - "::MicromapBuildInfoEXT::MicromapBuildInfoEXT: !usageCounts_.empty() && !pUsageCounts_.empty() && ( usageCounts_.size() != pUsageCounts_.size() )" ); + throw LogicError( VULKAN_HPP_NAMESPACE_STRING "::MicromapBuildInfoEXT::MicromapBuildInfoEXT: 1 < ( !usageCounts_.empty() + !pUsageCounts_.empty() )" ); } # endif /*VULKAN_HPP_NO_EXCEPTIONS*/ }