Merge pull request #794 from asuessenbach/refactor

Refactor commands that enumerate handles (no unique versions)
This commit is contained in:
Andreas Süßenbach 2020-10-21 13:35:13 +02:00 committed by GitHub
commit ede635596c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 158 additions and 139 deletions

View File

@ -1161,85 +1161,93 @@ void VulkanHppGenerator::appendCommand( std::string & str,
break; break;
case 1: case 1:
// one return parameter // one return parameter
if ( isHandleType( commandData.params[nonConstPointerParamIndices[0]].type.type ) )
{ {
// get handle(s)
auto returnVectorParamIt = vectorParamIndices.find( nonConstPointerParamIndices[0] ); auto returnVectorParamIt = vectorParamIndices.find( nonConstPointerParamIndices[0] );
if ( returnVectorParamIt == vectorParamIndices.end() ) if ( returnVectorParamIt == vectorParamIndices.end() )
{ {
// the return parameter is not a vector // the return parameter is not a vector -> get just one handle
if ( isHandleType( commandData.params[nonConstPointerParamIndices[0]].type.type ) )
{
if ( commandData.returnType == "VkResult" ) if ( commandData.returnType == "VkResult" )
{ {
// provide standard, enhanced, and unique call // provide standard, enhanced, and unique call
appendCommandUnique( str, name, commandData, nonConstPointerParamIndices[0], definition ); appendCommandUnique( str, name, commandData, nonConstPointerParamIndices[0], definition );
appendedFunction = true; appendedFunction = true;
} }
else if ( commandData.returnType == "void" ) else if ( ( commandData.returnType == "void" ) && beginsWith( name, "vkGet" ) )
{ {
// it's a handle type, but without construction and destruction function; it's just get // it's a handle type, but without construction and destruction function; it's just get
assert( beginsWith( name, "vkGet" ) );
appendCommandStandardAndEnhanced( appendCommandStandardAndEnhanced(
str, name, commandData, definition, vectorParamIndices, nonConstPointerParamIndices ); str, name, commandData, definition, vectorParamIndices, nonConstPointerParamIndices );
appendedFunction = true; appendedFunction = true;
} }
} }
else
{
// get a vector of handles
if ( ( commandData.params[returnVectorParamIt->second].type.isValue() ) )
{
if ( ( vectorParamIndices.size() == 2 ) &&
( vectorParamIndices.begin()->second == std::next( vectorParamIndices.begin() )->second ) )
{
// provide standard, enhanced, vector, singular, and unique (and the combinations!) calls
appendCommandVectorSingularUnique(
str, name, commandData, vectorParamIndices, nonConstPointerParamIndices[0], definition );
appendedFunction = true;
}
}
else if ( ( ( isParamIndirect( commandData.params[returnVectorParamIt->first].len,
commandData.params[returnVectorParamIt->second] ) ) ) &&
( vectorParamIndices.size() == 1 ) )
{
// provide standard, enhanced, vector, and unique (and the combinations!) calls
appendCommandVectorUnique(
str, name, commandData, vectorParamIndices, nonConstPointerParamIndices[0], definition );
appendedFunction = true;
}
}
}
else if ( isStructureChainAnchor( commandData.params[nonConstPointerParamIndices[0]].type.type ) ) else if ( isStructureChainAnchor( commandData.params[nonConstPointerParamIndices[0]].type.type ) )
{
auto returnVectorParamIt = vectorParamIndices.find( nonConstPointerParamIndices[0] );
if ( returnVectorParamIt == vectorParamIndices.end() )
{ {
// provide standard, enhanced, and chained call // provide standard, enhanced, and chained call
appendCommandChained( str, name, commandData, nonConstPointerParamIndices[0], definition ); appendCommandChained( str, name, commandData, nonConstPointerParamIndices[0], definition );
appendedFunction = true; appendedFunction = true;
} }
else if ( ( commandData.returnType == "VkResult" ) || ( commandData.returnType == "void" ) ) }
else
{
auto returnVectorParamIt = vectorParamIndices.find( nonConstPointerParamIndices[0] );
if ( returnVectorParamIt == vectorParamIndices.end() )
{
if ( ( commandData.returnType == "VkResult" ) || ( commandData.returnType == "void" ) )
{ {
appendCommandStandardAndEnhanced( appendCommandStandardAndEnhanced(
str, name, commandData, definition, vectorParamIndices, nonConstPointerParamIndices ); str, name, commandData, definition, vectorParamIndices, nonConstPointerParamIndices );
appendedFunction = true; appendedFunction = true;
} }
} }
else else if ( ( vectorParamIndices.size() == 1 ) &&
( commandData.params[returnVectorParamIt->first].type.type == "void" ) &&
( commandData.params[returnVectorParamIt->second].type.isValue() ) )
{ {
// the return parameter is a vector
if ( isHandleType( commandData.params[returnVectorParamIt->first].type.type ) )
{
if ( ( commandData.params[returnVectorParamIt->second].type.isValue() ) )
{
assert( vectorParamIndices.size() == 2 );
assert( vectorParamIndices.begin()->second == std::next( vectorParamIndices.begin() )->second );
// provide standard, enhanced, vector, singular, and unique (and the combinations!) calls
appendCommandVectorSingularUnique(
str, name, commandData, vectorParamIndices, nonConstPointerParamIndices[0], definition );
}
else
{
assert( ( isParamIndirect( commandData.params[returnVectorParamIt->first].len,
commandData.params[returnVectorParamIt->second] ) ) );
assert( vectorParamIndices.size() == 1 );
// provide standard, enhanced, vector, and unique (and the combinations!) calls
appendCommandVectorUnique(
str, name, commandData, vectorParamIndices, nonConstPointerParamIndices[0], definition );
}
appendedFunction = true;
}
else if ( vectorParamIndices.size() == 1 )
{
assert( commandData.params[returnVectorParamIt->first].type.type == "void" );
assert( commandData.params[returnVectorParamIt->second].type.isValue() );
// provide standard, enhanced, and singular calls // provide standard, enhanced, and singular calls
appendCommandSingular( appendCommandSingular(
str, name, commandData, vectorParamIndices, nonConstPointerParamIndices[0], definition ); str, name, commandData, vectorParamIndices, nonConstPointerParamIndices[0], definition );
appendedFunction = true; appendedFunction = true;
} }
} }
}
break; break;
case 2: case 2:
// two return parameters // two return parameters
if ( !isHandleType( commandData.params[nonConstPointerParamIndices[0]].type.type ) && if ( !isHandleType( commandData.params[nonConstPointerParamIndices[0]].type.type ) &&
!isHandleType( commandData.params[nonConstPointerParamIndices[1]].type.type ) &&
!isStructureChainAnchor( commandData.params[nonConstPointerParamIndices[0]].type.type ) && !isStructureChainAnchor( commandData.params[nonConstPointerParamIndices[0]].type.type ) &&
!isStructureChainAnchor( commandData.params[nonConstPointerParamIndices[1]].type.type ) ) !isStructureChainAnchor( commandData.params[nonConstPointerParamIndices[1]].type.type ) )
{ {
// non of the return parameters is a handle or a StructureChain // non of the return parameters is a StructureChain
// Note: if the vector returned holds handles, the function does not create them, but just gets them
switch ( vectorParamIndices.size() ) switch ( vectorParamIndices.size() )
{ {
case 1: case 1:
@ -1264,14 +1272,16 @@ void VulkanHppGenerator::appendCommand( std::string & str,
{ {
// two returns and two vectors! But one input vector, one output vector of the same size, and one output // two returns and two vectors! But one input vector, one output vector of the same size, and one output
// value // value
assert( vectorParamIndices.find( nonConstPointerParamIndices[0] ) != vectorParamIndices.end() ); if ( ( vectorParamIndices.find( nonConstPointerParamIndices[0] ) != vectorParamIndices.end() ) &&
assert( vectorParamIndices.find( nonConstPointerParamIndices[1] ) == vectorParamIndices.end() ); ( vectorParamIndices.find( nonConstPointerParamIndices[1] ) == vectorParamIndices.end() ) &&
assert( commandData.returnType == "VkResult" ); ( commandData.returnType == "VkResult" ) )
{
// provide standard, enhanced deprecated, enhanced, and enhanced with allocator calls // provide standard, enhanced deprecated, enhanced, and enhanced with allocator calls
appendCommandStandardEnhancedDeprecatedAllocator( appendCommandStandardEnhancedDeprecatedAllocator(
str, name, commandData, definition, vectorParamIndices, nonConstPointerParamIndices ); str, name, commandData, definition, vectorParamIndices, nonConstPointerParamIndices );
appendedFunction = true; appendedFunction = true;
} }
}
break; break;
default: break; default: break;
} }
@ -1279,10 +1289,10 @@ void VulkanHppGenerator::appendCommand( std::string & str,
break; break;
case 3: case 3:
// three return parameters // three return parameters
assert( ( vectorParamIndices.size() == 2 ) && if ( ( vectorParamIndices.size() == 2 ) &&
( vectorParamIndices.begin()->second == nonConstPointerParamIndices[0] ) && ( vectorParamIndices.begin()->second == nonConstPointerParamIndices[0] ) &&
( vectorParamIndices.begin()->first == nonConstPointerParamIndices[1] ) && ( vectorParamIndices.begin()->first == nonConstPointerParamIndices[1] ) &&
( std::next( vectorParamIndices.begin() )->first == nonConstPointerParamIndices[2] ) ); ( std::next( vectorParamIndices.begin() )->first == nonConstPointerParamIndices[2] ) )
{ {
// two vector parameters // two vector parameters
auto firstVectorParam = vectorParamIndices.begin(); auto firstVectorParam = vectorParamIndices.begin();

View File

@ -55481,20 +55481,20 @@ namespace VULKAN_HPP_NAMESPACE
VULKAN_HPP_NODISCARD Result VULKAN_HPP_NODISCARD Result
getSwapchainImagesKHR( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, getSwapchainImagesKHR( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain,
uint32_t * pSwapchainImageCount, uint32_t * pSwapchainImageCount,
VULKAN_HPP_NAMESPACE::Image * pSwapchainImages, VULKAN_HPP_NAMESPACE::Image * pSwapchainImages VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT; Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Allocator = std::allocator<Image>, typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> template <typename ImageAllocator = std::allocator<Image>, typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
VULKAN_HPP_NODISCARD typename ResultValueType<std::vector<Image, Allocator>>::type VULKAN_HPP_NODISCARD typename ResultValueType<std::vector<Image, ImageAllocator>>::type
getSwapchainImagesKHR( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, getSwapchainImagesKHR( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
template <typename Allocator = std::allocator<Image>, template <typename ImageAllocator = std::allocator<Image>,
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE, typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE,
typename B = Allocator, typename B = ImageAllocator,
typename std::enable_if<std::is_same<typename B::value_type, Image>::value, int>::type = 0> typename std::enable_if<std::is_same<typename B::value_type, Image>::value, int>::type = 0>
VULKAN_HPP_NODISCARD typename ResultValueType<std::vector<Image, Allocator>>::type VULKAN_HPP_NODISCARD typename ResultValueType<std::vector<Image, ImageAllocator>>::type
getSwapchainImagesKHR( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, getSwapchainImagesKHR( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain,
Allocator const & vectorAllocator, ImageAllocator & imageAllocator,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
@ -60894,20 +60894,21 @@ namespace VULKAN_HPP_NAMESPACE
VULKAN_HPP_NODISCARD Result getDisplayPlaneSupportedDisplaysKHR( VULKAN_HPP_NODISCARD Result getDisplayPlaneSupportedDisplaysKHR(
uint32_t planeIndex, uint32_t planeIndex,
uint32_t * pDisplayCount, uint32_t * pDisplayCount,
VULKAN_HPP_NAMESPACE::DisplayKHR * pDisplays, VULKAN_HPP_NAMESPACE::DisplayKHR * pDisplays VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT; Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Allocator = std::allocator<DisplayKHR>, typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> template <typename DisplayKHRAllocator = std::allocator<DisplayKHR>,
VULKAN_HPP_NODISCARD typename ResultValueType<std::vector<DisplayKHR, Allocator>>::type typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
VULKAN_HPP_NODISCARD typename ResultValueType<std::vector<DisplayKHR, DisplayKHRAllocator>>::type
getDisplayPlaneSupportedDisplaysKHR( uint32_t planeIndex, getDisplayPlaneSupportedDisplaysKHR( uint32_t planeIndex,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
template <typename Allocator = std::allocator<DisplayKHR>, template <typename DisplayKHRAllocator = std::allocator<DisplayKHR>,
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE, typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE,
typename B = Allocator, typename B = DisplayKHRAllocator,
typename std::enable_if<std::is_same<typename B::value_type, DisplayKHR>::value, int>::type = 0> typename std::enable_if<std::is_same<typename B::value_type, DisplayKHR>::value, int>::type = 0>
VULKAN_HPP_NODISCARD typename ResultValueType<std::vector<DisplayKHR, Allocator>>::type VULKAN_HPP_NODISCARD typename ResultValueType<std::vector<DisplayKHR, DisplayKHRAllocator>>::type
getDisplayPlaneSupportedDisplaysKHR( uint32_t planeIndex, getDisplayPlaneSupportedDisplaysKHR( uint32_t planeIndex,
Allocator const & vectorAllocator, DisplayKHRAllocator & displayKHRAllocator,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
@ -90179,21 +90180,21 @@ namespace VULKAN_HPP_NAMESPACE
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
VULKAN_HPP_NODISCARD Result VULKAN_HPP_NODISCARD Result enumeratePhysicalDevices(
enumeratePhysicalDevices( uint32_t * pPhysicalDeviceCount, uint32_t * pPhysicalDeviceCount,
VULKAN_HPP_NAMESPACE::PhysicalDevice * pPhysicalDevices, VULKAN_HPP_NAMESPACE::PhysicalDevice * pPhysicalDevices VULKAN_HPP_DEFAULT_ARGUMENT_ASSIGNMENT,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT; Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Allocator = std::allocator<PhysicalDevice>, template <typename PhysicalDeviceAllocator = std::allocator<PhysicalDevice>,
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE> typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
VULKAN_HPP_NODISCARD typename ResultValueType<std::vector<PhysicalDevice, Allocator>>::type VULKAN_HPP_NODISCARD typename ResultValueType<std::vector<PhysicalDevice, PhysicalDeviceAllocator>>::type
enumeratePhysicalDevices( Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; enumeratePhysicalDevices( Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
template <typename Allocator = std::allocator<PhysicalDevice>, template <typename PhysicalDeviceAllocator = std::allocator<PhysicalDevice>,
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE, typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE,
typename B = Allocator, typename B = PhysicalDeviceAllocator,
typename std::enable_if<std::is_same<typename B::value_type, PhysicalDevice>::value, int>::type = 0> typename std::enable_if<std::is_same<typename B::value_type, PhysicalDevice>::value, int>::type = 0>
VULKAN_HPP_NODISCARD typename ResultValueType<std::vector<PhysicalDevice, Allocator>>::type VULKAN_HPP_NODISCARD typename ResultValueType<std::vector<PhysicalDevice, PhysicalDeviceAllocator>>::type
enumeratePhysicalDevices( Allocator const & vectorAllocator, enumeratePhysicalDevices( PhysicalDeviceAllocator & physicalDeviceAllocator,
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
@ -100780,12 +100781,13 @@ namespace VULKAN_HPP_NAMESPACE
pSwapchainImageCount, pSwapchainImageCount,
reinterpret_cast<VkImage *>( pSwapchainImages ) ) ); reinterpret_cast<VkImage *>( pSwapchainImages ) ) );
} }
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Allocator, typename Dispatch> template <typename ImageAllocator, typename Dispatch>
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE typename ResultValueType<std::vector<Image, Allocator>>::type VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE typename ResultValueType<std::vector<Image, ImageAllocator>>::type
Device::getSwapchainImagesKHR( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, Dispatch const & d ) const Device::getSwapchainImagesKHR( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, Dispatch const & d ) const
{ {
std::vector<Image, Allocator> swapchainImages; std::vector<Image, ImageAllocator> swapchainImages;
uint32_t swapchainImageCount; uint32_t swapchainImageCount;
Result result; Result result;
do do
@ -100800,25 +100802,26 @@ namespace VULKAN_HPP_NAMESPACE
static_cast<VkSwapchainKHR>( swapchain ), static_cast<VkSwapchainKHR>( swapchain ),
&swapchainImageCount, &swapchainImageCount,
reinterpret_cast<VkImage *>( swapchainImages.data() ) ) ); reinterpret_cast<VkImage *>( swapchainImages.data() ) ) );
VULKAN_HPP_ASSERT( swapchainImageCount <= swapchainImages.size() );
} }
} while ( result == Result::eIncomplete ); } while ( result == Result::eIncomplete );
if ( result == Result::eSuccess ) if ( ( result == Result::eSuccess ) && ( swapchainImageCount < swapchainImages.size() ) )
{ {
VULKAN_HPP_ASSERT( swapchainImageCount <= swapchainImages.size() );
swapchainImages.resize( swapchainImageCount ); swapchainImages.resize( swapchainImageCount );
} }
return createResultValue( result, swapchainImages, VULKAN_HPP_NAMESPACE_STRING "::Device::getSwapchainImagesKHR" ); return createResultValue( result, swapchainImages, VULKAN_HPP_NAMESPACE_STRING "::Device::getSwapchainImagesKHR" );
} }
template <typename Allocator,
template <typename ImageAllocator,
typename Dispatch, typename Dispatch,
typename B, typename B,
typename std::enable_if<std::is_same<typename B::value_type, Image>::value, int>::type> typename std::enable_if<std::is_same<typename B::value_type, Image>::value, int>::type>
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE typename ResultValueType<std::vector<Image, Allocator>>::type VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE typename ResultValueType<std::vector<Image, ImageAllocator>>::type
Device::getSwapchainImagesKHR( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, Device::getSwapchainImagesKHR( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain,
Allocator const & vectorAllocator, ImageAllocator & imageAllocator,
Dispatch const & d ) const Dispatch const & d ) const
{ {
std::vector<Image, Allocator> swapchainImages( vectorAllocator ); std::vector<Image, ImageAllocator> swapchainImages( imageAllocator );
uint32_t swapchainImageCount; uint32_t swapchainImageCount;
Result result; Result result;
do do
@ -100833,11 +100836,11 @@ namespace VULKAN_HPP_NAMESPACE
static_cast<VkSwapchainKHR>( swapchain ), static_cast<VkSwapchainKHR>( swapchain ),
&swapchainImageCount, &swapchainImageCount,
reinterpret_cast<VkImage *>( swapchainImages.data() ) ) ); reinterpret_cast<VkImage *>( swapchainImages.data() ) ) );
VULKAN_HPP_ASSERT( swapchainImageCount <= swapchainImages.size() );
} }
} while ( result == Result::eIncomplete ); } while ( result == Result::eIncomplete );
if ( result == Result::eSuccess ) if ( ( result == Result::eSuccess ) && ( swapchainImageCount < swapchainImages.size() ) )
{ {
VULKAN_HPP_ASSERT( swapchainImageCount <= swapchainImages.size() );
swapchainImages.resize( swapchainImageCount ); swapchainImages.resize( swapchainImageCount );
} }
return createResultValue( result, swapchainImages, VULKAN_HPP_NAMESPACE_STRING "::Device::getSwapchainImagesKHR" ); return createResultValue( result, swapchainImages, VULKAN_HPP_NAMESPACE_STRING "::Device::getSwapchainImagesKHR" );
@ -103082,12 +103085,14 @@ namespace VULKAN_HPP_NAMESPACE
return static_cast<Result>( d.vkEnumeratePhysicalDevices( return static_cast<Result>( d.vkEnumeratePhysicalDevices(
m_instance, pPhysicalDeviceCount, reinterpret_cast<VkPhysicalDevice *>( pPhysicalDevices ) ) ); m_instance, pPhysicalDeviceCount, reinterpret_cast<VkPhysicalDevice *>( pPhysicalDevices ) ) );
} }
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Allocator, typename Dispatch> template <typename PhysicalDeviceAllocator, typename Dispatch>
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE typename ResultValueType<std::vector<PhysicalDevice, Allocator>>::type VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE
typename ResultValueType<std::vector<PhysicalDevice, PhysicalDeviceAllocator>>::type
Instance::enumeratePhysicalDevices( Dispatch const & d ) const Instance::enumeratePhysicalDevices( Dispatch const & d ) const
{ {
std::vector<PhysicalDevice, Allocator> physicalDevices; std::vector<PhysicalDevice, PhysicalDeviceAllocator> physicalDevices;
uint32_t physicalDeviceCount; uint32_t physicalDeviceCount;
Result result; Result result;
do do
@ -103098,24 +103103,26 @@ namespace VULKAN_HPP_NAMESPACE
physicalDevices.resize( physicalDeviceCount ); physicalDevices.resize( physicalDeviceCount );
result = static_cast<Result>( d.vkEnumeratePhysicalDevices( result = static_cast<Result>( d.vkEnumeratePhysicalDevices(
m_instance, &physicalDeviceCount, reinterpret_cast<VkPhysicalDevice *>( physicalDevices.data() ) ) ); m_instance, &physicalDeviceCount, reinterpret_cast<VkPhysicalDevice *>( physicalDevices.data() ) ) );
VULKAN_HPP_ASSERT( physicalDeviceCount <= physicalDevices.size() );
} }
} while ( result == Result::eIncomplete ); } while ( result == Result::eIncomplete );
if ( result == Result::eSuccess ) if ( ( result == Result::eSuccess ) && ( physicalDeviceCount < physicalDevices.size() ) )
{ {
VULKAN_HPP_ASSERT( physicalDeviceCount <= physicalDevices.size() );
physicalDevices.resize( physicalDeviceCount ); physicalDevices.resize( physicalDeviceCount );
} }
return createResultValue( return createResultValue(
result, physicalDevices, VULKAN_HPP_NAMESPACE_STRING "::Instance::enumeratePhysicalDevices" ); result, physicalDevices, VULKAN_HPP_NAMESPACE_STRING "::Instance::enumeratePhysicalDevices" );
} }
template <typename Allocator,
template <typename PhysicalDeviceAllocator,
typename Dispatch, typename Dispatch,
typename B, typename B,
typename std::enable_if<std::is_same<typename B::value_type, PhysicalDevice>::value, int>::type> typename std::enable_if<std::is_same<typename B::value_type, PhysicalDevice>::value, int>::type>
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE typename ResultValueType<std::vector<PhysicalDevice, Allocator>>::type VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE
Instance::enumeratePhysicalDevices( Allocator const & vectorAllocator, Dispatch const & d ) const typename ResultValueType<std::vector<PhysicalDevice, PhysicalDeviceAllocator>>::type
Instance::enumeratePhysicalDevices( PhysicalDeviceAllocator & physicalDeviceAllocator, Dispatch const & d ) const
{ {
std::vector<PhysicalDevice, Allocator> physicalDevices( vectorAllocator ); std::vector<PhysicalDevice, PhysicalDeviceAllocator> physicalDevices( physicalDeviceAllocator );
uint32_t physicalDeviceCount; uint32_t physicalDeviceCount;
Result result; Result result;
do do
@ -103126,11 +103133,11 @@ namespace VULKAN_HPP_NAMESPACE
physicalDevices.resize( physicalDeviceCount ); physicalDevices.resize( physicalDeviceCount );
result = static_cast<Result>( d.vkEnumeratePhysicalDevices( result = static_cast<Result>( d.vkEnumeratePhysicalDevices(
m_instance, &physicalDeviceCount, reinterpret_cast<VkPhysicalDevice *>( physicalDevices.data() ) ) ); m_instance, &physicalDeviceCount, reinterpret_cast<VkPhysicalDevice *>( physicalDevices.data() ) ) );
VULKAN_HPP_ASSERT( physicalDeviceCount <= physicalDevices.size() );
} }
} while ( result == Result::eIncomplete ); } while ( result == Result::eIncomplete );
if ( result == Result::eSuccess ) if ( ( result == Result::eSuccess ) && ( physicalDeviceCount < physicalDevices.size() ) )
{ {
VULKAN_HPP_ASSERT( physicalDeviceCount <= physicalDevices.size() );
physicalDevices.resize( physicalDeviceCount ); physicalDevices.resize( physicalDeviceCount );
} }
return createResultValue( return createResultValue(
@ -103912,12 +103919,13 @@ namespace VULKAN_HPP_NAMESPACE
return static_cast<Result>( d.vkGetDisplayPlaneSupportedDisplaysKHR( return static_cast<Result>( d.vkGetDisplayPlaneSupportedDisplaysKHR(
m_physicalDevice, planeIndex, pDisplayCount, reinterpret_cast<VkDisplayKHR *>( pDisplays ) ) ); m_physicalDevice, planeIndex, pDisplayCount, reinterpret_cast<VkDisplayKHR *>( pDisplays ) ) );
} }
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE #ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
template <typename Allocator, typename Dispatch> template <typename DisplayKHRAllocator, typename Dispatch>
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE typename ResultValueType<std::vector<DisplayKHR, Allocator>>::type VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE typename ResultValueType<std::vector<DisplayKHR, DisplayKHRAllocator>>::type
PhysicalDevice::getDisplayPlaneSupportedDisplaysKHR( uint32_t planeIndex, Dispatch const & d ) const PhysicalDevice::getDisplayPlaneSupportedDisplaysKHR( uint32_t planeIndex, Dispatch const & d ) const
{ {
std::vector<DisplayKHR, Allocator> displays; std::vector<DisplayKHR, DisplayKHRAllocator> displays;
uint32_t displayCount; uint32_t displayCount;
Result result; Result result;
do do
@ -103929,26 +103937,27 @@ namespace VULKAN_HPP_NAMESPACE
displays.resize( displayCount ); displays.resize( displayCount );
result = static_cast<Result>( d.vkGetDisplayPlaneSupportedDisplaysKHR( result = static_cast<Result>( d.vkGetDisplayPlaneSupportedDisplaysKHR(
m_physicalDevice, planeIndex, &displayCount, reinterpret_cast<VkDisplayKHR *>( displays.data() ) ) ); m_physicalDevice, planeIndex, &displayCount, reinterpret_cast<VkDisplayKHR *>( displays.data() ) ) );
VULKAN_HPP_ASSERT( displayCount <= displays.size() );
} }
} while ( result == Result::eIncomplete ); } while ( result == Result::eIncomplete );
if ( result == Result::eSuccess ) if ( ( result == Result::eSuccess ) && ( displayCount < displays.size() ) )
{ {
VULKAN_HPP_ASSERT( displayCount <= displays.size() );
displays.resize( displayCount ); displays.resize( displayCount );
} }
return createResultValue( return createResultValue(
result, displays, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::getDisplayPlaneSupportedDisplaysKHR" ); result, displays, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::getDisplayPlaneSupportedDisplaysKHR" );
} }
template <typename Allocator,
template <typename DisplayKHRAllocator,
typename Dispatch, typename Dispatch,
typename B, typename B,
typename std::enable_if<std::is_same<typename B::value_type, DisplayKHR>::value, int>::type> typename std::enable_if<std::is_same<typename B::value_type, DisplayKHR>::value, int>::type>
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE typename ResultValueType<std::vector<DisplayKHR, Allocator>>::type VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE typename ResultValueType<std::vector<DisplayKHR, DisplayKHRAllocator>>::type
PhysicalDevice::getDisplayPlaneSupportedDisplaysKHR( uint32_t planeIndex, PhysicalDevice::getDisplayPlaneSupportedDisplaysKHR( uint32_t planeIndex,
Allocator const & vectorAllocator, DisplayKHRAllocator & displayKHRAllocator,
Dispatch const & d ) const Dispatch const & d ) const
{ {
std::vector<DisplayKHR, Allocator> displays( vectorAllocator ); std::vector<DisplayKHR, DisplayKHRAllocator> displays( displayKHRAllocator );
uint32_t displayCount; uint32_t displayCount;
Result result; Result result;
do do
@ -103960,11 +103969,11 @@ namespace VULKAN_HPP_NAMESPACE
displays.resize( displayCount ); displays.resize( displayCount );
result = static_cast<Result>( d.vkGetDisplayPlaneSupportedDisplaysKHR( result = static_cast<Result>( d.vkGetDisplayPlaneSupportedDisplaysKHR(
m_physicalDevice, planeIndex, &displayCount, reinterpret_cast<VkDisplayKHR *>( displays.data() ) ) ); m_physicalDevice, planeIndex, &displayCount, reinterpret_cast<VkDisplayKHR *>( displays.data() ) ) );
VULKAN_HPP_ASSERT( displayCount <= displays.size() );
} }
} while ( result == Result::eIncomplete ); } while ( result == Result::eIncomplete );
if ( result == Result::eSuccess ) if ( ( result == Result::eSuccess ) && ( displayCount < displays.size() ) )
{ {
VULKAN_HPP_ASSERT( displayCount <= displays.size() );
displays.resize( displayCount ); displays.resize( displayCount );
} }
return createResultValue( return createResultValue(