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

@ -121,10 +121,10 @@
template <typename T = typename std::tuple_element<0, std::tuple<ChainElements...>>::type, size_t Which = 0>
StructureChain & assign( const T & rhs ) VULKAN_HPP_NOEXCEPT
{
T & lhs = get<T, Which>();
void * pNext = lhs.pNext;
lhs = rhs;
lhs.pNext = pNext;
T & lhs = get<T, Which>();
auto pNext = lhs.pNext;
lhs = rhs;
lhs.pNext = pNext;
return *this;
}

View File

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

View File

@ -723,10 +723,10 @@ namespace VULKAN_HPP_NAMESPACE
template <typename T = typename std::tuple_element<0, std::tuple<ChainElements...>>::type, size_t Which = 0>
StructureChain & assign( const T & rhs ) VULKAN_HPP_NOEXCEPT
{
T & lhs = get<T, Which>();
void * pNext = lhs.pNext;
lhs = rhs;
lhs.pNext = pNext;
T & lhs = get<T, Which>();
auto pNext = lhs.pNext;
lhs = rhs;
lhs.pNext = pNext;
return *this;
}
@ -16589,7 +16589,7 @@ namespace VULKAN_HPP_NAMESPACE
m_library = dlopen( "libvulkan.1.dylib", RTLD_NOW | RTLD_LOCAL );
}
# elif defined( _WIN32 )
m_library = ::LoadLibraryA( "vulkan-1.dll" );
m_library = ::LoadLibraryA( "vulkan-1.dll" );
# else
# error unsupported platform
# endif

View File

@ -723,10 +723,10 @@ namespace VULKAN_HPP_NAMESPACE
template <typename T = typename std::tuple_element<0, std::tuple<ChainElements...>>::type, size_t Which = 0>
StructureChain & assign( const T & rhs ) VULKAN_HPP_NOEXCEPT
{
T & lhs = get<T, Which>();
void * pNext = lhs.pNext;
lhs = rhs;
lhs.pNext = pNext;
T & lhs = get<T, Which>();
auto pNext = lhs.pNext;
lhs = rhs;
lhs.pNext = pNext;
return *this;
}
@ -6950,7 +6950,7 @@ namespace VULKAN_HPP_NAMESPACE
m_library = dlopen( "libvulkan.1.dylib", RTLD_NOW | RTLD_LOCAL );
}
# elif defined( _WIN32 )
m_library = ::LoadLibraryA( "vulkan-1.dll" );
m_library = ::LoadLibraryA( "vulkan-1.dll" );
# else
# error unsupported platform
# endif