mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Merge pull request #1137 from asuessenbach/link
Fix wrong linking in copied StructureChains with unlinked elements
This commit is contained in:
commit
9b94931267
@ -16696,7 +16696,10 @@ int main( int argc, char ** argv )
|
||||
{
|
||||
static_assert( StructureChainValidation<sizeof...( ChainElements ) - 1, ChainElements...>::valid,
|
||||
"The structure chain is not valid!" );
|
||||
link<sizeof...( ChainElements ) - 1>();
|
||||
link( &std::get<0>( *this ),
|
||||
&std::get<0>( rhs ),
|
||||
reinterpret_cast<VkBaseOutStructure *>( &std::get<0>( *this ) ),
|
||||
reinterpret_cast<VkBaseInStructure const *>( &std::get<0>( rhs ) ) );
|
||||
}
|
||||
|
||||
StructureChain( StructureChain && rhs ) VULKAN_HPP_NOEXCEPT
|
||||
@ -16704,7 +16707,10 @@ int main( int argc, char ** argv )
|
||||
{
|
||||
static_assert( StructureChainValidation<sizeof...( ChainElements ) - 1, ChainElements...>::valid,
|
||||
"The structure chain is not valid!" );
|
||||
link<sizeof...( ChainElements ) - 1>();
|
||||
link( &std::get<0>( *this ),
|
||||
&std::get<0>( rhs ),
|
||||
reinterpret_cast<VkBaseOutStructure *>( &std::get<0>( *this ) ),
|
||||
reinterpret_cast<VkBaseInStructure const *>( &std::get<0>( rhs ) ) );
|
||||
}
|
||||
|
||||
StructureChain( ChainElements const &... elems ) VULKAN_HPP_NOEXCEPT : std::tuple<ChainElements...>( elems... )
|
||||
@ -16717,7 +16723,10 @@ int main( int argc, char ** argv )
|
||||
StructureChain & operator=( StructureChain const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
std::tuple<ChainElements...>::operator=( rhs );
|
||||
link<sizeof...( ChainElements ) - 1>();
|
||||
link( &std::get<0>( *this ),
|
||||
&std::get<0>( rhs ),
|
||||
reinterpret_cast<VkBaseOutStructure *>( &std::get<0>( *this ) ),
|
||||
reinterpret_cast<VkBaseInStructure const *>( &std::get<0>( rhs ) ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -16856,6 +16865,19 @@ int main( int argc, char ** argv )
|
||||
typename std::enable_if<Index == 0, void>::type link() VULKAN_HPP_NOEXCEPT
|
||||
{}
|
||||
|
||||
void link( void * dstBase, void const * srcBase, VkBaseOutStructure * dst, VkBaseInStructure const * src )
|
||||
{
|
||||
while ( src->pNext )
|
||||
{
|
||||
std::ptrdiff_t offset =
|
||||
reinterpret_cast<char const *>( src->pNext ) - reinterpret_cast<char const *>( srcBase );
|
||||
dst->pNext = reinterpret_cast<VkBaseOutStructure *>( reinterpret_cast<char *>( dstBase ) + offset );
|
||||
dst = dst->pNext;
|
||||
src = src->pNext;
|
||||
}
|
||||
dst->pNext = nullptr;
|
||||
}
|
||||
|
||||
void unlink( VkBaseOutStructure const * pNext ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
VkBaseOutStructure * elementPtr =
|
||||
|
@ -1076,7 +1076,10 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
static_assert( StructureChainValidation<sizeof...( ChainElements ) - 1, ChainElements...>::valid,
|
||||
"The structure chain is not valid!" );
|
||||
link<sizeof...( ChainElements ) - 1>();
|
||||
link( &std::get<0>( *this ),
|
||||
&std::get<0>( rhs ),
|
||||
reinterpret_cast<VkBaseOutStructure *>( &std::get<0>( *this ) ),
|
||||
reinterpret_cast<VkBaseInStructure const *>( &std::get<0>( rhs ) ) );
|
||||
}
|
||||
|
||||
StructureChain( StructureChain && rhs ) VULKAN_HPP_NOEXCEPT
|
||||
@ -1084,7 +1087,10 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
static_assert( StructureChainValidation<sizeof...( ChainElements ) - 1, ChainElements...>::valid,
|
||||
"The structure chain is not valid!" );
|
||||
link<sizeof...( ChainElements ) - 1>();
|
||||
link( &std::get<0>( *this ),
|
||||
&std::get<0>( rhs ),
|
||||
reinterpret_cast<VkBaseOutStructure *>( &std::get<0>( *this ) ),
|
||||
reinterpret_cast<VkBaseInStructure const *>( &std::get<0>( rhs ) ) );
|
||||
}
|
||||
|
||||
StructureChain( ChainElements const &... elems ) VULKAN_HPP_NOEXCEPT : std::tuple<ChainElements...>( elems... )
|
||||
@ -1097,7 +1103,10 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
StructureChain & operator=( StructureChain const & rhs ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
std::tuple<ChainElements...>::operator=( rhs );
|
||||
link<sizeof...( ChainElements ) - 1>();
|
||||
link( &std::get<0>( *this ),
|
||||
&std::get<0>( rhs ),
|
||||
reinterpret_cast<VkBaseOutStructure *>( &std::get<0>( *this ) ),
|
||||
reinterpret_cast<VkBaseInStructure const *>( &std::get<0>( rhs ) ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1238,6 +1247,19 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
typename std::enable_if<Index == 0, void>::type link() VULKAN_HPP_NOEXCEPT
|
||||
{}
|
||||
|
||||
void link( void * dstBase, void const * srcBase, VkBaseOutStructure * dst, VkBaseInStructure const * src )
|
||||
{
|
||||
while ( src->pNext )
|
||||
{
|
||||
std::ptrdiff_t offset =
|
||||
reinterpret_cast<char const *>( src->pNext ) - reinterpret_cast<char const *>( srcBase );
|
||||
dst->pNext = reinterpret_cast<VkBaseOutStructure *>( reinterpret_cast<char *>( dstBase ) + offset );
|
||||
dst = dst->pNext;
|
||||
src = src->pNext;
|
||||
}
|
||||
dst->pNext = nullptr;
|
||||
}
|
||||
|
||||
void unlink( VkBaseOutStructure const * pNext ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
VkBaseOutStructure * elementPtr =
|
||||
|
Loading…
Reference in New Issue
Block a user