Fix issue with vk::StructureChain::assign: use auto, instead of void *, to also support structures with const void * as type for pNext. (#1799)

This commit is contained in:
Andreas Süßenbach 2024-02-08 12:32:57 +01:00 committed by GitHub
parent c74c22fb77
commit 7a048a0cc7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 14 deletions

View File

@ -122,7 +122,7 @@
StructureChain & assign( const T & rhs ) VULKAN_HPP_NOEXCEPT StructureChain & assign( const T & rhs ) VULKAN_HPP_NOEXCEPT
{ {
T & lhs = get<T, Which>(); T & lhs = get<T, Which>();
void * pNext = lhs.pNext; auto pNext = lhs.pNext;
lhs = rhs; lhs = rhs;
lhs.pNext = pNext; lhs.pNext = pNext;
return *this; return *this;

View File

@ -77,6 +77,9 @@ int main( int /*argc*/, char ** /*argv*/ )
sc7.assign<vk::PhysicalDeviceIDProperties>( {} ); sc7.assign<vk::PhysicalDeviceIDProperties>( {} );
assert( pNext == sc7.get<vk::PhysicalDeviceIDProperties>().pNext ); assert( pNext == sc7.get<vk::PhysicalDeviceIDProperties>().pNext );
vk::StructureChain<vk::DeviceQueueCreateInfo, vk::DeviceQueueGlobalPriorityCreateInfoKHR> sc8;
sc8.assign<vk::DeviceQueueGlobalPriorityCreateInfoKHR>( {} );
#if !defined( NDEBUG ) #if !defined( NDEBUG )
void * pNext1 = sc7.get<vk::PhysicalDeviceMaintenance3Properties>().pNext; void * pNext1 = sc7.get<vk::PhysicalDeviceMaintenance3Properties>().pNext;
#endif #endif

View File

@ -724,7 +724,7 @@ namespace VULKAN_HPP_NAMESPACE
StructureChain & assign( const T & rhs ) VULKAN_HPP_NOEXCEPT StructureChain & assign( const T & rhs ) VULKAN_HPP_NOEXCEPT
{ {
T & lhs = get<T, Which>(); T & lhs = get<T, Which>();
void * pNext = lhs.pNext; auto pNext = lhs.pNext;
lhs = rhs; lhs = rhs;
lhs.pNext = pNext; lhs.pNext = pNext;
return *this; return *this;

View File

@ -724,7 +724,7 @@ namespace VULKAN_HPP_NAMESPACE
StructureChain & assign( const T & rhs ) VULKAN_HPP_NOEXCEPT StructureChain & assign( const T & rhs ) VULKAN_HPP_NOEXCEPT
{ {
T & lhs = get<T, Which>(); T & lhs = get<T, Which>();
void * pNext = lhs.pNext; auto pNext = lhs.pNext;
lhs = rhs; lhs = rhs;
lhs.pNext = pNext; lhs.pNext = pNext;
return *this; return *this;