Merge pull request #1413 from asuessenbach/getImages

Fix inconsistency with return type of vk::raii::SwapchainKHR::getImages()
This commit is contained in:
Andreas Süßenbach 2022-09-21 11:54:11 +02:00 committed by GitHub
commit fc63beb596
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 103 additions and 126 deletions

View File

@ -146,14 +146,14 @@ int main( int /*argc*/, char ** /*argv*/ )
} }
vk::raii::SwapchainKHR swapChain( device, swapChainCreateInfo ); vk::raii::SwapchainKHR swapChain( device, swapChainCreateInfo );
std::vector<VkImage> swapChainImages = swapChain.getImages(); std::vector<vk::Image> swapChainImages = swapChain.getImages();
std::vector<vk::raii::ImageView> imageViews; std::vector<vk::raii::ImageView> imageViews;
imageViews.reserve( swapChainImages.size() ); imageViews.reserve( swapChainImages.size() );
vk::ImageViewCreateInfo imageViewCreateInfo( {}, {}, vk::ImageViewType::e2D, format, {}, { vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 } ); vk::ImageViewCreateInfo imageViewCreateInfo( {}, {}, vk::ImageViewType::e2D, format, {}, { vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 } );
for ( auto image : swapChainImages ) for ( auto image : swapChainImages )
{ {
imageViewCreateInfo.image = static_cast<vk::Image>( image ); imageViewCreateInfo.image = image;
imageViews.push_back( { device, imageViewCreateInfo } ); imageViews.push_back( { device, imageViewCreateInfo } );
} }

View File

@ -26,9 +26,9 @@
#endif #endif
#include "../../samples/utils/utils.hpp" #include "../../samples/utils/utils.hpp"
#include <vulkan/vulkan_raii.hpp>
#include <numeric> #include <numeric>
#include <vulkan/vulkan_raii.hpp>
namespace vk namespace vk
{ {
@ -398,14 +398,14 @@ namespace vk
vk::ImageViewCreateInfo imageViewCreateInfo( {}, {}, vk::ImageViewType::e2D, colorFormat, {}, { vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 } ); vk::ImageViewCreateInfo imageViewCreateInfo( {}, {}, vk::ImageViewType::e2D, colorFormat, {}, { vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 } );
for ( auto image : images ) for ( auto image : images )
{ {
imageViewCreateInfo.image = static_cast<vk::Image>( image ); imageViewCreateInfo.image = image;
imageViews.emplace_back( device, imageViewCreateInfo ); imageViews.emplace_back( device, imageViewCreateInfo );
} }
} }
vk::Format colorFormat; vk::Format colorFormat;
vk::raii::SwapchainKHR swapChain = nullptr; vk::raii::SwapchainKHR swapChain = nullptr;
std::vector<VkImage> images; std::vector<vk::Image> images;
std::vector<vk::raii::ImageView> imageViews; std::vector<vk::raii::ImageView> imageViews;
}; };

View File

@ -30,6 +30,8 @@ void checkElements( int
std::set<std::string> const & optional = {} ); std::set<std::string> const & optional = {} );
void checkForError( bool condition, int line, std::string const & message ); void checkForError( bool condition, int line, std::string const & message );
void checkForWarning( bool condition, int line, std::string const & message ); void checkForWarning( bool condition, int line, std::string const & message );
template <class InputIt, class UnaryPredicate>
std::vector<InputIt> findAll( InputIt first, InputIt last, UnaryPredicate p );
std::string findTag( std::set<std::string> const & tags, std::string const & name, std::string const & postfix = "" ); std::string findTag( std::set<std::string> const & tags, std::string const & name, std::string const & postfix = "" );
std::string generateCArraySizes( std::vector<std::string> const & sizes ); std::string generateCArraySizes( std::vector<std::string> const & sizes );
std::pair<std::string, std::string> generateEnumSuffixes( std::string const & name, bool bitmask, std::set<std::string> const & tags ); std::pair<std::string, std::string> generateEnumSuffixes( std::string const & name, bool bitmask, std::set<std::string> const & tags );
@ -44,7 +46,6 @@ template <typename ElementContainer>
std::vector<tinyxml2::XMLElement const *> getChildElements( ElementContainer const * element ); std::vector<tinyxml2::XMLElement const *> getChildElements( ElementContainer const * element );
std::pair<std::vector<std::string>, std::string> readModifiers( tinyxml2::XMLNode const * node ); std::pair<std::vector<std::string>, std::string> readModifiers( tinyxml2::XMLNode const * node );
std::string readSnippet( std::string const & snippetFile ); std::string readSnippet( std::string const & snippetFile );
void replaceAll( std::string & str, std::string const & from, std::string const & to );
std::string replaceWithMap( std::string const & input, std::map<std::string, std::string> replacements ); std::string replaceWithMap( std::string const & input, std::map<std::string, std::string> replacements );
std::string startLowerCase( std::string const & input ); std::string startLowerCase( std::string const & input );
std::string startUpperCase( std::string const & input ); std::string startUpperCase( std::string const & input );
@ -54,29 +55,12 @@ std::string stripPrefix( std::string const
std::string toCamelCase( std::string const & value ); std::string toCamelCase( std::string const & value );
std::string toUpperCase( std::string const & name ); std::string toUpperCase( std::string const & name );
std::vector<std::string> tokenize( std::string const & tokenString, std::string const & separator ); std::vector<std::string> tokenize( std::string const & tokenString, std::string const & separator );
template <typename StringContainer>
std::string toString( StringContainer const & strings );
std::string toString( tinyxml2::XMLError error ); std::string toString( tinyxml2::XMLError error );
std::string trim( std::string const & input ); std::string trim( std::string const & input );
std::string trimEnd( std::string const & input ); std::string trimEnd( std::string const & input );
std::string trimStars( std::string const & input ); std::string trimStars( std::string const & input );
void writeToFile( std::string const & str, std::string const & fileName ); void writeToFile( std::string const & str, std::string const & fileName );
template <class InputIt, class UnaryPredicate>
std::vector<InputIt> findAll( InputIt first, InputIt last, UnaryPredicate p )
{
std::vector<InputIt> result;
while ( first != last )
{
if ( p( *first ) )
{
result.push_back( first );
}
++first;
}
return result;
}
const std::set<std::string> altLens = { "2*VK_UUID_SIZE", "codeSize / 4", "(rasterizationSamples + 31) / 32", "(samples + 31) / 32" }; const std::set<std::string> altLens = { "2*VK_UUID_SIZE", "codeSize / 4", "(rasterizationSamples + 31) / 32", "(samples + 31) / 32" };
const std::set<std::string> specialPointerTypes = { "Display", "IDirectFB", "wl_display", "xcb_connection_t", "_screen_window" }; const std::set<std::string> specialPointerTypes = { "Display", "IDirectFB", "wl_display", "xcb_connection_t", "_screen_window" };
@ -102,15 +86,15 @@ VulkanHppGenerator::VulkanHppGenerator( tinyxml2::XMLDocument const & document )
{ {
addMissingFlagBits( feature.second.requireData, feature.first ); addMissingFlagBits( feature.second.requireData, feature.first );
} }
for ( auto & ext : m_extensions ) for ( auto & extension : m_extensions )
{ {
addMissingFlagBits( ext.second.requireData, ext.first ); addMissingFlagBits( extension.second.requireData, extension.first );
} }
// determine the extensionsByNumber map // determine the extensionsByNumber map
for ( auto extensionIt = m_extensions.begin(); extensionIt != m_extensions.end(); ++extensionIt ) for ( auto extensionIt = m_extensions.begin(); extensionIt != m_extensions.end(); ++extensionIt )
{ {
int number = atoi( extensionIt->second.number.c_str() ); int number = stoi( extensionIt->second.number );
assert( m_extensionsByNumber.find( number ) == m_extensionsByNumber.end() ); assert( m_extensionsByNumber.find( number ) == m_extensionsByNumber.end() );
m_extensionsByNumber[number] = extensionIt; m_extensionsByNumber[number] = extensionIt;
} }
@ -459,17 +443,8 @@ ${staticAssertions}
#endif #endif
)"; )";
std::string staticAssertions; std::string str =
for ( auto const & feature : m_features ) replaceWithMap( vulkanHandlesHppTemplate, { { "licenseHeader", m_vulkanLicenseHeader }, { "staticAssertions", generateStaticAssertions() } } );
{
staticAssertions += generateStaticAssertions( feature.second.requireData, feature.first );
}
for ( auto const & extIt : m_extensionsByNumber )
{
staticAssertions += generateStaticAssertions( extIt.second->second.requireData, extIt.second->first );
}
std::string str = replaceWithMap( vulkanHandlesHppTemplate, { { "licenseHeader", m_vulkanLicenseHeader }, { "staticAssertions", staticAssertions } } );
writeToFile( str, static_assertions_hpp ); writeToFile( str, static_assertions_hpp );
} }
@ -533,17 +508,15 @@ void VulkanHppGenerator::prepareRAIIHandles()
{ {
// filter out functions that are not usefull on this level of abstraction (like vkGetInstanceProcAddr) // filter out functions that are not usefull on this level of abstraction (like vkGetInstanceProcAddr)
// and all the construction and destruction functions, as they are used differently // and all the construction and destruction functions, as they are used differently
for ( auto & handle : m_handles ) assert( m_handles.begin()->first.empty() );
for ( auto handleIt = std::next( m_handles.begin() ); handleIt != m_handles.end(); ++handleIt )
{ {
if ( !handle.first.empty() ) handleIt->second.destructorIt = determineRAIIHandleDestructor( handleIt->first );
if ( handleIt->second.destructorIt != m_commands.end() )
{ {
handle.second.destructorIt = determineRAIIHandleDestructor( handle.first ); m_RAIISpecialFunctions.insert( handleIt->second.destructorIt->first );
if ( handle.second.destructorIt != m_commands.end() )
{
m_RAIISpecialFunctions.insert( handle.second.destructorIt->first );
}
handle.second.constructorIts = determineRAIIHandleConstructors( handle.first, handle.second.destructorIt );
} }
handleIt->second.constructorIts = determineRAIIHandleConstructors( handleIt->first, handleIt->second.destructorIt );
} }
distributeSecondLevelCommands( m_RAIISpecialFunctions ); distributeSecondLevelCommands( m_RAIISpecialFunctions );
@ -575,7 +548,7 @@ void VulkanHppGenerator::addCommand( std::string const & name, CommandData & com
{ {
handleIt = m_handles.find( "" ); handleIt = m_handles.find( "" );
} }
checkForError( handleIt != m_handles.end(), commandData.xmlLine, "could not find a handle to hold command <" + name + ">" ); assert( handleIt != m_handles.end() );
commandData.handle = handleIt->first; commandData.handle = handleIt->first;
// add this command to the list of commands // add this command to the list of commands
@ -597,7 +570,7 @@ void VulkanHppGenerator::addMissingFlagBits( std::vector<RequireData> & requireD
auto bitmaskIt = m_bitmasks.find( type ); auto bitmaskIt = m_bitmasks.find( type );
if ( ( bitmaskIt != m_bitmasks.end() ) && bitmaskIt->second.requirements.empty() ) if ( ( bitmaskIt != m_bitmasks.end() ) && bitmaskIt->second.requirements.empty() )
{ {
// generate the flagBits enum name out of the bitmask name // generate the flagBits enum name out of the bitmask name: VkFooFlagsXXX -> VkFooFlagBitsXXX
size_t pos = bitmaskIt->first.find( "Flags" ); size_t pos = bitmaskIt->first.find( "Flags" );
assert( pos != std::string::npos ); assert( pos != std::string::npos );
std::string flagBits = bitmaskIt->first.substr( 0, pos + 4 ) + "Bit" + bitmaskIt->first.substr( pos + 4 ); std::string flagBits = bitmaskIt->first.substr( 0, pos + 4 ) + "Bit" + bitmaskIt->first.substr( pos + 4 );
@ -609,7 +582,7 @@ void VulkanHppGenerator::addMissingFlagBits( std::vector<RequireData> & requireD
bitmaskIt->second.requirements = flagBits; bitmaskIt->second.requirements = flagBits;
// some flagsBits are specified but never listed as required for any flags! // some flagsBits are specified but never listed as required for any flags!
// so, even if this bitmask has not enum listed as required, it might still already exist in the enums list // so, even if this bitmask has no enum listed as required, it might still already exist in the enums list
if ( m_enums.find( flagBits ) == m_enums.end() ) if ( m_enums.find( flagBits ) == m_enums.end() )
{ {
m_enums.insert( std::make_pair( flagBits, EnumData( 0, true ) ) ); m_enums.insert( std::make_pair( flagBits, EnumData( 0, true ) ) );
@ -648,6 +621,7 @@ std::string VulkanHppGenerator::addTitleAndProtection( std::string const & title
bool VulkanHppGenerator::allVectorSizesSupported( std::vector<ParamData> const & params, std::map<size_t, VectorParamData> const & vectorParams ) const bool VulkanHppGenerator::allVectorSizesSupported( std::vector<ParamData> const & params, std::map<size_t, VectorParamData> const & vectorParams ) const
{ {
// check if all vector sizes are by value and their type is one of "uint32_t", "VkDeviceSize", or "VkSampleCountFlagBits"
return std::find_if_not( vectorParams.begin(), return std::find_if_not( vectorParams.begin(),
vectorParams.end(), vectorParams.end(),
[&params]( auto const & vpi ) [&params]( auto const & vpi )
@ -1440,8 +1414,7 @@ std::vector<size_t> VulkanHppGenerator::determineConstPointerParams( std::vector
std::vector<std::string> VulkanHppGenerator::determineDataTypes( std::vector<VulkanHppGenerator::ParamData> const & params, std::vector<std::string> VulkanHppGenerator::determineDataTypes( std::vector<VulkanHppGenerator::ParamData> const & params,
std::map<size_t, VectorParamData> const & vectorParams, std::map<size_t, VectorParamData> const & vectorParams,
std::vector<size_t> const & returnParams, std::vector<size_t> const & returnParams,
std::set<size_t> const & templatedParams, std::set<size_t> const & templatedParams ) const
bool raii ) const
{ {
std::vector<std::string> dataTypes; std::vector<std::string> dataTypes;
for ( auto rp : returnParams ) for ( auto rp : returnParams )
@ -1459,10 +1432,6 @@ std::vector<std::string> VulkanHppGenerator::determineDataTypes( std::vector<Vul
dataTypes.push_back( ( stripPrefix( params[rp].name, "p" ) + "Type" ) ); dataTypes.push_back( ( stripPrefix( params[rp].name, "p" ) + "Type" ) );
} }
} }
else if ( raii && isHandleType( params[rp].type.type ) )
{
dataTypes.push_back( params[rp].type.type );
}
else else
{ {
dataTypes.push_back( trimEnd( stripPostfix( params[rp].type.compose( "VULKAN_HPP_NAMESPACE" ), "*" ) ) ); dataTypes.push_back( trimEnd( stripPostfix( params[rp].type.compose( "VULKAN_HPP_NAMESPACE" ), "*" ) ) );
@ -2407,7 +2376,7 @@ std::string VulkanHppGenerator::generateCallArgumentsEnhanced( CommandData const
{ {
arguments += ", "; arguments += ", ";
} }
arguments += generateCallArgumentEnhanced( commandData.params, i, nonConstPointerAsNullptr, singularParams, templatedParams, raiiHandleMemberFunction ); arguments += generateCallArgumentEnhanced( commandData.params, i, nonConstPointerAsNullptr, singularParams, templatedParams );
encounteredArgument = true; encounteredArgument = true;
} }
return arguments; return arguments;
@ -2492,8 +2461,7 @@ std::string VulkanHppGenerator::generateCallArgumentEnhanced( std::vector<ParamD
size_t paramIndex, size_t paramIndex,
bool nonConstPointerAsNullptr, bool nonConstPointerAsNullptr,
std::set<size_t> const & singularParams, std::set<size_t> const & singularParams,
std::set<size_t> const & templatedParams, std::set<size_t> const & templatedParams ) const
bool raiiHandleMemberFunction ) const
{ {
std::string argument; std::string argument;
ParamData const & param = params[paramIndex]; ParamData const & param = params[paramIndex];
@ -2505,7 +2473,7 @@ std::string VulkanHppGenerator::generateCallArgumentEnhanced( std::vector<ParamD
else if ( param.type.isNonConstPointer() && ( specialPointerTypes.find( param.type.type ) == specialPointerTypes.end() ) ) else if ( param.type.isNonConstPointer() && ( specialPointerTypes.find( param.type.type ) == specialPointerTypes.end() ) )
{ {
// parameter is a non-const pointer and none of the special pointer types, that are considered const-pointers // parameter is a non-const pointer and none of the special pointer types, that are considered const-pointers
argument = generateCallArgumentEnhancedNonConstPointer( param, paramIndex, nonConstPointerAsNullptr, singularParams, raiiHandleMemberFunction ); argument = generateCallArgumentEnhancedNonConstPointer( param, paramIndex, nonConstPointerAsNullptr, singularParams );
} }
else else
{ {
@ -2587,8 +2555,10 @@ std::string VulkanHppGenerator::generateCallArgumentEnhancedConstPointer( ParamD
return argument; return argument;
} }
std::string VulkanHppGenerator::generateCallArgumentEnhancedNonConstPointer( std::string VulkanHppGenerator::generateCallArgumentEnhancedNonConstPointer( ParamData const & param,
ParamData const & param, size_t paramIndex, bool nonConstPointerAsNullptr, std::set<size_t> const & singularParams, bool raiiHandleMemberFunction ) const size_t paramIndex,
bool nonConstPointerAsNullptr,
std::set<size_t> const & singularParams ) const
{ {
std::string argument; std::string argument;
std::string name = startLowerCase( stripPrefix( param.name, "p" ) ); std::string name = startLowerCase( stripPrefix( param.name, "p" ) );
@ -2624,7 +2594,7 @@ std::string VulkanHppGenerator::generateCallArgumentEnhancedNonConstPointer(
// get the data of the array, which also covers no data -> no need to look at param.optional // get the data of the array, which also covers no data -> no need to look at param.optional
argument = name + ".data()"; argument = name + ".data()";
} }
if ( ( param.type.type.starts_with( "Vk" ) || ( param.type.type == "void" ) ) && ( !raiiHandleMemberFunction || !isHandleType( param.type.type ) ) ) if ( param.type.type.starts_with( "Vk" ) || ( param.type.type == "void" ) )
{ {
argument = "reinterpret_cast<" + param.type.compose( "" ) + ">( " + argument + " )"; argument = "reinterpret_cast<" + param.type.compose( "" ) + ">( " + argument + " )";
} }
@ -3053,7 +3023,7 @@ std::string VulkanHppGenerator::generateCommandEnhanced( std::string const &
needsVectorSizeCheck( commandData.params, vectorParams, returnParams, singularParams ); needsVectorSizeCheck( commandData.params, vectorParams, returnParams, singularParams );
bool enumerating = determineEnumeration( vectorParams, returnParams ); bool enumerating = determineEnumeration( vectorParams, returnParams );
std::vector<std::string> dataTypes = determineDataTypes( commandData.params, vectorParams, returnParams, templatedParams, false ); std::vector<std::string> dataTypes = determineDataTypes( commandData.params, vectorParams, returnParams, templatedParams );
std::string dataType = combineDataTypes( vectorParams, returnParams, singular, enumerating, dataTypes, unique, false ); std::string dataType = combineDataTypes( vectorParams, returnParams, singular, enumerating, dataTypes, unique, false );
std::string argumentTemplates = generateArgumentTemplates( commandData.params, returnParams, vectorParams, templatedParams, chained, false ); std::string argumentTemplates = generateArgumentTemplates( commandData.params, returnParams, vectorParams, templatedParams, chained, false );
@ -6630,7 +6600,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandEnhanced( std::map<std:
( commandIt->first == "vkGetMemoryHostPointerPropertiesEXT" ) ? std::set<size_t>() : determineVoidPointerParams( commandIt->second.params ); ( commandIt->first == "vkGetMemoryHostPointerPropertiesEXT" ) ? std::set<size_t>() : determineVoidPointerParams( commandIt->second.params );
bool enumerating = determineEnumeration( vectorParams, returnParams ); bool enumerating = determineEnumeration( vectorParams, returnParams );
std::vector<std::string> dataTypes = determineDataTypes( commandIt->second.params, vectorParams, returnParams, templatedParams, true ); std::vector<std::string> dataTypes = determineDataTypes( commandIt->second.params, vectorParams, returnParams, templatedParams );
std::string dataType = combineDataTypes( vectorParams, returnParams, singular, enumerating, dataTypes, false, true ); std::string dataType = combineDataTypes( vectorParams, returnParams, singular, enumerating, dataTypes, false, true );
std::string argumentTemplates = generateArgumentTemplates( commandIt->second.params, returnParams, vectorParams, templatedParams, chained, true ); std::string argumentTemplates = generateArgumentTemplates( commandIt->second.params, returnParams, vectorParams, templatedParams, chained, true );
@ -7543,7 +7513,7 @@ std::string
else else
{ {
assert( !param.optional ); assert( !param.optional );
arguments += generateCallArgumentEnhanced( constructorIt->second.params, i, nonConstPointerAsNullptr, singularParams, {}, true ); arguments += generateCallArgumentEnhanced( constructorIt->second.params, i, nonConstPointerAsNullptr, singularParams, {} );
} }
encounteredArgument = true; encounteredArgument = true;
} }
@ -8043,7 +8013,7 @@ std::string
std::string initializationList = generateRAIIHandleConstructorInitializationList( handle, constructorIt, handle.second.destructorIt, false ); std::string initializationList = generateRAIIHandleConstructorInitializationList( handle, constructorIt, handle.second.destructorIt, false );
assert( !initializationList.empty() ); assert( !initializationList.empty() );
std::string failureCheck = generateFailureCheck( constructorIt->second.successCodes ); std::string failureCheck = generateFailureCheck( constructorIt->second.successCodes );
replaceAll( failureCheck, "result", "m_constructorSuccessCode" ); failureCheck = std::regex_replace( failureCheck, std::regex( "result" ), "m_constructorSuccessCode" );
const std::string singularConstructorTemplate = const std::string singularConstructorTemplate =
R"( R"(
@ -8965,6 +8935,20 @@ std::string VulkanHppGenerator::generateSizeCheck( std::vector<std::vector<Membe
return sizeCheck; return sizeCheck;
} }
std::string VulkanHppGenerator::generateStaticAssertions() const
{
std::string staticAssertions;
for ( auto const & feature : m_features )
{
staticAssertions += generateStaticAssertions( feature.second.requireData, feature.first );
}
for ( auto const & extIt : m_extensionsByNumber )
{
staticAssertions += generateStaticAssertions( extIt.second->second.requireData, extIt.second->first );
}
return staticAssertions;
}
std::string VulkanHppGenerator::generateStaticAssertions( std::vector<RequireData> const & requireData, std::string const & title ) const std::string VulkanHppGenerator::generateStaticAssertions( std::vector<RequireData> const & requireData, std::string const & title ) const
{ {
std::string str; std::string str;
@ -13248,6 +13232,21 @@ void checkForWarning( bool condition, int line, std::string const & message )
} }
} }
template <class InputIt, class UnaryPredicate>
std::vector<InputIt> findAll( InputIt first, InputIt last, UnaryPredicate p )
{
std::vector<InputIt> result;
while ( first != last )
{
if ( p( *first ) )
{
result.push_back( first );
}
++first;
}
return result;
}
std::string findTag( std::set<std::string> const & tags, std::string const & name, std::string const & postfix ) std::string findTag( std::set<std::string> const & tags, std::string const & name, std::string const & postfix )
{ {
auto tagIt = std::find_if( tags.begin(), tags.end(), [&name, &postfix]( std::string const & t ) { return name.ends_with( t + postfix ); } ); auto tagIt = std::find_if( tags.begin(), tags.end(), [&name, &postfix]( std::string const & t ) { return name.ends_with( t + postfix ); } );
@ -13441,16 +13440,6 @@ std::string readSnippet( std::string const & snippetFile )
return oss.str(); return oss.str();
} }
void replaceAll( std::string & str, std::string const & from, std::string const & to )
{
size_t pos = 0;
while ( ( pos = str.find( from, pos ) ) != std::string::npos )
{
str.replace( pos, from.length(), to );
pos += to.length(); // Handles case where 'to' is a substring of 'from'
}
}
std::string replaceWithMap( std::string const & input, std::map<std::string, std::string> replacements ) std::string replaceWithMap( std::string const & input, std::map<std::string, std::string> replacements )
{ {
// This will match ${someVariable} and contain someVariable in match group 1 // This will match ${someVariable} and contain someVariable in match group 1
@ -13504,12 +13493,14 @@ std::string replaceWithMap( std::string const & input, std::map<std::string, std
std::string startLowerCase( std::string const & input ) std::string startLowerCase( std::string const & input )
{ {
return input.empty() ? "" : static_cast<char>( tolower( input[0] ) ) + input.substr( 1 ); assert( !input.empty() );
return static_cast<char>( tolower( input[0] ) ) + input.substr( 1 );
} }
std::string startUpperCase( std::string const & input ) std::string startUpperCase( std::string const & input )
{ {
return input.empty() ? "" : static_cast<char>( toupper( input[0] ) ) + input.substr( 1 ); assert( !input.empty() );
return static_cast<char>( toupper( input[0] ) ) + input.substr( 1 );
} }
std::string stripPostfix( std::string const & value, std::string const & postfix ) std::string stripPostfix( std::string const & value, std::string const & postfix )
@ -13617,23 +13608,6 @@ std::vector<std::string> tokenize( std::string const & tokenString, std::string
return tokens; return tokens;
} }
template <typename StringContainer>
std::string toString( StringContainer const & strings )
{
std::string str;
bool encounteredMember = false;
for ( auto s : strings )
{
if ( encounteredMember )
{
str += ", ";
}
str += s;
encounteredMember = true;
}
return str;
}
std::string trim( std::string const & input ) std::string trim( std::string const & input )
{ {
std::string result = input; std::string result = input;

View File

@ -409,8 +409,7 @@ private:
std::vector<std::string> determineDataTypes( std::vector<VulkanHppGenerator::ParamData> const & params, std::vector<std::string> determineDataTypes( std::vector<VulkanHppGenerator::ParamData> const & params,
std::map<size_t, VectorParamData> const & vectorParams, std::map<size_t, VectorParamData> const & vectorParams,
std::vector<size_t> const & returnParams, std::vector<size_t> const & returnParams,
std::set<size_t> const & templatedParams, std::set<size_t> const & templatedParams ) const;
bool raii ) const;
size_t determineDefaultStartIndex( std::vector<ParamData> const & params, std::set<size_t> const & skippedParams ) const; size_t determineDefaultStartIndex( std::vector<ParamData> const & params, std::set<size_t> const & skippedParams ) const;
bool determineEnumeration( std::map<size_t, VectorParamData> const & vectorParams, std::vector<size_t> const & returnParams ) const; bool determineEnumeration( std::map<size_t, VectorParamData> const & vectorParams, std::vector<size_t> const & returnParams ) const;
size_t determineInitialSkipCount( std::string const & command ) const; size_t determineInitialSkipCount( std::string const & command ) const;
@ -477,14 +476,15 @@ private:
size_t paramIndex, size_t paramIndex,
bool nonConstPointerAsNullptr, bool nonConstPointerAsNullptr,
std::set<size_t> const & singularParams, std::set<size_t> const & singularParams,
std::set<size_t> const & templatedParams, std::set<size_t> const & templatedParams ) const;
bool raiiHandleMemberFunction ) const;
std::string generateCallArgumentEnhancedConstPointer( ParamData const & param, std::string generateCallArgumentEnhancedConstPointer( ParamData const & param,
size_t paramIndex, size_t paramIndex,
std::set<size_t> const & singularParams, std::set<size_t> const & singularParams,
std::set<size_t> const & templatedParams ) const; std::set<size_t> const & templatedParams ) const;
std::string generateCallArgumentEnhancedNonConstPointer( std::string generateCallArgumentEnhancedNonConstPointer( ParamData const & param,
ParamData const & param, size_t paramIndex, bool nonConstPointerAsNullptr, std::set<size_t> const & singularParams, bool raiiHandleMemberFunction ) const; size_t paramIndex,
bool nonConstPointerAsNullptr,
std::set<size_t> const & singularParams ) const;
std::string generateCallArgumentEnhancedValue( std::vector<ParamData> const & params, size_t paramIndex, std::set<size_t> const & singularParams ) const; std::string generateCallArgumentEnhancedValue( std::vector<ParamData> const & params, size_t paramIndex, std::set<size_t> const & singularParams ) const;
std::string generateCallSequence( std::string const & name, std::string generateCallSequence( std::string const & name,
CommandData const & commandData, CommandData const & commandData,
@ -886,6 +886,7 @@ private:
bool singular ) const; bool singular ) const;
std::string std::string
generateSizeCheck( std::vector<std::vector<MemberData>::const_iterator> const & arrayIts, std::string const & structName, bool mutualExclusiveLens ) const; generateSizeCheck( std::vector<std::vector<MemberData>::const_iterator> const & arrayIts, std::string const & structName, bool mutualExclusiveLens ) const;
std::string generateStaticAssertions() const;
std::string generateStaticAssertions( std::vector<RequireData> const & requireData, std::string const & title ) const; std::string generateStaticAssertions( std::vector<RequireData> const & requireData, std::string const & title ) const;
std::string generateStruct( std::pair<std::string, StructureData> const & structure, std::set<std::string> & listedStructs ) const; std::string generateStruct( std::pair<std::string, StructureData> const & structure, std::set<std::string> & listedStructs ) const;
std::string generateStructAssignmentOperators( std::pair<std::string, StructureData> const & structure ) const; std::string generateStructAssignmentOperators( std::pair<std::string, StructureData> const & structure ) const;

View File

@ -9794,7 +9794,7 @@ namespace VULKAN_HPP_NAMESPACE
//=== VK_KHR_swapchain === //=== VK_KHR_swapchain ===
VULKAN_HPP_NODISCARD std::vector<VkImage> getImages() const; VULKAN_HPP_NODISCARD std::vector<VULKAN_HPP_NAMESPACE::Image> getImages() const;
VULKAN_HPP_NODISCARD std::pair<VULKAN_HPP_NAMESPACE::Result, uint32_t> VULKAN_HPP_NODISCARD std::pair<VULKAN_HPP_NAMESPACE::Result, uint32_t>
acquireNextImage( uint64_t timeout, acquireNextImage( uint64_t timeout,
@ -12390,11 +12390,11 @@ namespace VULKAN_HPP_NAMESPACE
return VULKAN_HPP_RAII_NAMESPACE::SwapchainKHR( *this, createInfo, allocator ); return VULKAN_HPP_RAII_NAMESPACE::SwapchainKHR( *this, createInfo, allocator );
} }
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<VkImage> SwapchainKHR::getImages() const VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<VULKAN_HPP_NAMESPACE::Image> SwapchainKHR::getImages() const
{ {
VULKAN_HPP_ASSERT( getDispatcher()->vkGetSwapchainImagesKHR && "Function <vkGetSwapchainImagesKHR> needs extension <VK_KHR_swapchain> enabled!" ); VULKAN_HPP_ASSERT( getDispatcher()->vkGetSwapchainImagesKHR && "Function <vkGetSwapchainImagesKHR> needs extension <VK_KHR_swapchain> enabled!" );
std::vector<VkImage> swapchainImages; std::vector<VULKAN_HPP_NAMESPACE::Image> swapchainImages;
uint32_t swapchainImageCount; uint32_t swapchainImageCount;
VkResult result; VkResult result;
do do
@ -12404,8 +12404,10 @@ namespace VULKAN_HPP_NAMESPACE
if ( ( result == VK_SUCCESS ) && swapchainImageCount ) if ( ( result == VK_SUCCESS ) && swapchainImageCount )
{ {
swapchainImages.resize( swapchainImageCount ); swapchainImages.resize( swapchainImageCount );
result = getDispatcher()->vkGetSwapchainImagesKHR( result = getDispatcher()->vkGetSwapchainImagesKHR( static_cast<VkDevice>( m_device ),
static_cast<VkDevice>( m_device ), static_cast<VkSwapchainKHR>( m_swapchain ), &swapchainImageCount, swapchainImages.data() ); static_cast<VkSwapchainKHR>( m_swapchain ),
&swapchainImageCount,
reinterpret_cast<VkImage *>( swapchainImages.data() ) );
} }
} while ( result == VK_INCOMPLETE ); } while ( result == VK_INCOMPLETE );
resultCheck( static_cast<VULKAN_HPP_NAMESPACE::Result>( result ), VULKAN_HPP_NAMESPACE_STRING "::SwapchainKHR::getImages" ); resultCheck( static_cast<VULKAN_HPP_NAMESPACE::Result>( result ), VULKAN_HPP_NAMESPACE_STRING "::SwapchainKHR::getImages" );