mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Add support for enumerating functions that originally take a struct with the vector information. (#1892)
This commit is contained in:
parent
6fb0c202be
commit
d507727fd7
@ -1718,6 +1718,14 @@ bool VulkanHppGenerator::containsUnion( std::string const & type ) const
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VulkanHppGenerator::describesVector( StructureData const & structure, std::string const & type ) const
|
||||||
|
{
|
||||||
|
return ( structure.members.size() == 4 ) && ( structure.members[0].name == "sType" ) && ( structure.members[1].name == "pNext" ) &&
|
||||||
|
structure.members[2].type.isValue() && ( structure.members[2].type.type == "uint32_t" ) &&
|
||||||
|
( type.empty() ? true : ( structure.members[3].type.type == type ) ) && structure.members[3].type.isNonConstPointer() &&
|
||||||
|
( structure.members[3].lenMembers.size() == 1 ) && ( structure.members[3].lenMembers[0].second == 2 );
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<size_t> VulkanHppGenerator::determineChainedReturnParams( std::vector<ParamData> const & params, std::vector<size_t> const & returnParams ) const
|
std::vector<size_t> VulkanHppGenerator::determineChainedReturnParams( std::vector<ParamData> const & params, std::vector<size_t> const & returnParams ) const
|
||||||
{
|
{
|
||||||
std::vector<size_t> chainedParams;
|
std::vector<size_t> chainedParams;
|
||||||
@ -1755,9 +1763,10 @@ std::vector<std::string> VulkanHppGenerator::determineDataTypes( std::vector<Vul
|
|||||||
std::vector<std::string> dataTypes;
|
std::vector<std::string> dataTypes;
|
||||||
for ( auto rp : returnParams )
|
for ( auto rp : returnParams )
|
||||||
{
|
{
|
||||||
|
auto vectorParamIt = vectorParams.find( rp );
|
||||||
if ( templatedParams.contains( rp ) )
|
if ( templatedParams.contains( rp ) )
|
||||||
{
|
{
|
||||||
auto vectorParamIt = vectorParams.find( rp );
|
assert( ( vectorParamIt == vectorParams.end() ) || !vectorParamIt->second.byStructure );
|
||||||
if ( ( vectorParamIt != vectorParams.end() ) &&
|
if ( ( vectorParamIt != vectorParams.end() ) &&
|
||||||
std::any_of( returnParams.begin(), returnParams.end(), [&vectorParamIt]( size_t rp ) noexcept { return rp == vectorParamIt->first; } ) &&
|
std::any_of( returnParams.begin(), returnParams.end(), [&vectorParamIt]( size_t rp ) noexcept { return rp == vectorParamIt->first; } ) &&
|
||||||
std::any_of( returnParams.begin(), returnParams.end(), [&vectorParamIt]( size_t rp ) noexcept { return rp == vectorParamIt->second.lenParam; } ) )
|
std::any_of( returnParams.begin(), returnParams.end(), [&vectorParamIt]( size_t rp ) noexcept { return rp == vectorParamIt->second.lenParam; } ) )
|
||||||
@ -1769,6 +1778,10 @@ 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 ( ( vectorParamIt != vectorParams.end() ) && vectorParamIt->second.byStructure )
|
||||||
|
{
|
||||||
|
dataTypes.push_back( trimEnd( stripPostfix( vectorMemberByStructure( params[rp].type.type ).type.compose( "VULKAN_HPP_NAMESPACE" ), "*" ) ) );
|
||||||
|
}
|
||||||
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" ), "*" ) ) );
|
||||||
@ -1790,13 +1803,15 @@ size_t VulkanHppGenerator::determineDefaultStartIndex( std::vector<ParamData> co
|
|||||||
|
|
||||||
bool VulkanHppGenerator::determineEnumeration( std::map<size_t, VectorParamData> const & vectorParams, std::vector<size_t> const & returnParams ) const
|
bool VulkanHppGenerator::determineEnumeration( std::map<size_t, VectorParamData> const & vectorParams, std::vector<size_t> const & returnParams ) const
|
||||||
{
|
{
|
||||||
// a command is considered to be enumerating some data, if for at least one vectorParam both, the data and the counter, are returnParams
|
// a command is considered to be enumerating some data, if for at least one vectorParam the data is a returnParam and either the vectorParams is specified by
|
||||||
|
// a structure or the lenParam is a returnParam as well
|
||||||
return std::any_of( vectorParams.begin(),
|
return std::any_of( vectorParams.begin(),
|
||||||
vectorParams.end(),
|
vectorParams.end(),
|
||||||
[&returnParams]( auto const & vp )
|
[&returnParams]( auto const & vp )
|
||||||
{
|
{
|
||||||
return std::any_of( returnParams.begin(), returnParams.end(), [&vp]( size_t rp ) { return rp == vp.first; } ) &&
|
return std::any_of( returnParams.begin(), returnParams.end(), [&vp]( size_t rp ) { return rp == vp.first; } ) &&
|
||||||
std::any_of( returnParams.begin(), returnParams.end(), [&vp]( size_t rp ) { return rp == vp.second.lenParam; } );
|
( vp.second.byStructure ||
|
||||||
|
std::any_of( returnParams.begin(), returnParams.end(), [&vp]( size_t rp ) { return rp == vp.second.lenParam; } ) );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1838,22 +1853,41 @@ std::vector<size_t> VulkanHppGenerator::determineReturnParams( std::vector<Param
|
|||||||
return nonConstPointerParamIndices;
|
return nonConstPointerParamIndices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VulkanHppGenerator::isConstructorCandidate( std::pair<std::string, VulkanHppGenerator::CommandData> const & command, std::string const & handleType ) const
|
||||||
|
{
|
||||||
|
return isSupported( command.second.requiredBy ) &&
|
||||||
|
std::any_of( command.second.params.begin(),
|
||||||
|
command.second.params.end(),
|
||||||
|
[this, &handleType]( ParamData const & pd ) { return isConstructorCandidate( pd, handleType ); } );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VulkanHppGenerator::isConstructorCandidate( ParamData const & paramData, std::string const & handleType ) const
|
||||||
|
{
|
||||||
|
if ( paramData.type.isNonConstPointer() )
|
||||||
|
{
|
||||||
|
if ( paramData.type.type == handleType )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto structIt = m_structs.find( paramData.type.type );
|
||||||
|
if ( structIt != m_structs.end() )
|
||||||
|
{
|
||||||
|
return describesVector( structIt->second, handleType );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::map<std::string, VulkanHppGenerator::CommandData>::const_iterator>
|
std::vector<std::map<std::string, VulkanHppGenerator::CommandData>::const_iterator>
|
||||||
VulkanHppGenerator::determineRAIIHandleConstructors( std::string const & handleType, std::map<std::string, CommandData>::const_iterator destructorIt ) const
|
VulkanHppGenerator::determineRAIIHandleConstructors( std::string const & handleType, std::map<std::string, CommandData>::const_iterator destructorIt ) const
|
||||||
{
|
{
|
||||||
std::vector<std::map<std::string, CommandData>::const_iterator> constructorIts;
|
std::vector<std::map<std::string, CommandData>::const_iterator> constructorIts;
|
||||||
auto isConstructorCandidate = [this, &handleType]( std::pair<std::string, CommandData> const & cd )
|
for ( auto commandIt = m_commands.begin(); commandIt != m_commands.end(); ++commandIt )
|
||||||
{
|
{
|
||||||
return isSupported( cd.second.requiredBy ) &&
|
if ( isConstructorCandidate( *commandIt, handleType ) )
|
||||||
std::any_of( cd.second.params.begin(),
|
|
||||||
cd.second.params.end(),
|
|
||||||
[&handleType]( ParamData const & pd ) { return ( pd.type.type == handleType ) && pd.type.isNonConstPointer(); } );
|
|
||||||
};
|
|
||||||
for ( auto commandIt = m_commands.begin(); commandIt != m_commands.end(); )
|
|
||||||
{
|
|
||||||
// find the commands that get a non-const pointer to the handleType, that is, return a handle type
|
|
||||||
commandIt = std::find_if( commandIt, m_commands.end(), isConstructorCandidate );
|
|
||||||
if ( commandIt != m_commands.end() )
|
|
||||||
{
|
{
|
||||||
// only commands that provide all information needed for the destructor can be considered a constructor!
|
// only commands that provide all information needed for the destructor can be considered a constructor!
|
||||||
bool valid = true;
|
bool valid = true;
|
||||||
@ -1895,7 +1929,6 @@ std::vector<std::map<std::string, VulkanHppGenerator::CommandData>::const_iterat
|
|||||||
{
|
{
|
||||||
constructorIts.push_back( commandIt );
|
constructorIts.push_back( commandIt );
|
||||||
}
|
}
|
||||||
++commandIt;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return constructorIts;
|
return constructorIts;
|
||||||
@ -1968,16 +2001,19 @@ std::set<size_t> VulkanHppGenerator::determineSkippedParams( std::vector<ParamDa
|
|||||||
// skip the size parameters (get derived from an array), and a stride parameter
|
// skip the size parameters (get derived from an array), and a stride parameter
|
||||||
for ( auto const & vpi : vectorParams )
|
for ( auto const & vpi : vectorParams )
|
||||||
{
|
{
|
||||||
assert( !params[vpi.first].lenExpression.empty() );
|
if ( !vpi.second.byStructure )
|
||||||
if ( ( std::none_of( returnParams.begin(), returnParams.end(), [&vpi]( size_t rpi ) { return vpi.first == rpi; } ) &&
|
|
||||||
isParam( params[vpi.first].lenExpression, params ) ) ||
|
|
||||||
( singular && params[vpi.second.lenParam].type.isValue() ) )
|
|
||||||
{
|
{
|
||||||
skippedParams.insert( vpi.second.lenParam );
|
assert( !params[vpi.first].lenExpression.empty() );
|
||||||
}
|
if ( ( std::none_of( returnParams.begin(), returnParams.end(), [&vpi]( size_t rpi ) { return vpi.first == rpi; } ) &&
|
||||||
if ( vpi.second.strideParam != INVALID_INDEX )
|
isParam( params[vpi.first].lenExpression, params ) ) ||
|
||||||
{
|
( singular && params[vpi.second.lenParam].type.isValue() ) )
|
||||||
skippedParams.insert( vpi.second.strideParam );
|
{
|
||||||
|
skippedParams.insert( vpi.second.lenParam );
|
||||||
|
}
|
||||||
|
if ( vpi.second.strideParam != INVALID_INDEX )
|
||||||
|
{
|
||||||
|
skippedParams.insert( vpi.second.strideParam );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2046,6 +2082,16 @@ std::map<size_t, VulkanHppGenerator::VectorParamData> VulkanHppGenerator::determ
|
|||||||
vpd.strideParam = params[i].strideParam.second;
|
vpd.strideParam = params[i].strideParam.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto structIt = m_structs.find( params[i].type.type );
|
||||||
|
if ( ( structIt != m_structs.end() ) && !isStructureChainAnchor( params[i].type.type ) && describesVector( structIt->second ) )
|
||||||
|
{
|
||||||
|
VectorParamData & vpd = vectorParams[i];
|
||||||
|
vpd.byStructure = true;
|
||||||
|
vpd.lenParam = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return vectorParams;
|
return vectorParams;
|
||||||
}
|
}
|
||||||
@ -2431,6 +2477,12 @@ std::string VulkanHppGenerator::generateArgumentListEnhanced( std::vector<ParamD
|
|||||||
}
|
}
|
||||||
arguments.push_back( type + "Allocator & " + startLowerCase( type ) + "Allocator" );
|
arguments.push_back( type + "Allocator & " + startLowerCase( type ) + "Allocator" );
|
||||||
}
|
}
|
||||||
|
else if ( vectorParams.contains( sp ) && vectorParams.find( sp )->second.byStructure )
|
||||||
|
{
|
||||||
|
std::string type = stripPrefix( vectorMemberByStructure( params[sp].type.type ).type.type, "Vk" );
|
||||||
|
assert( isupper( type[0] ) );
|
||||||
|
arguments.push_back( type + "Allocator & " + startLowerCase( type ) + "Allocator" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3045,34 +3097,85 @@ std::string VulkanHppGenerator::generateCallSequence( std::string const &
|
|||||||
{
|
{
|
||||||
std::string dispatcher = raii ? "getDispatcher()->" : "d.";
|
std::string dispatcher = raii ? "getDispatcher()->" : "d.";
|
||||||
|
|
||||||
// first a special handling on vkGetDeviceFaultInfoEXT!!
|
// first some special handling on vkCreatePipelineBinariesKHR and vkGetDeviceFaultInfoEXT!!
|
||||||
if ( name == "vkGetDeviceFaultInfoEXT" )
|
if ( name == "vkCreatePipelineBinariesKHR" )
|
||||||
|
{
|
||||||
|
#if !defined( NDEBUG )
|
||||||
|
auto paramIt = std::find_if( commandData.params.begin(), commandData.params.end(), []( ParamData const & pd ) { return pd.name == "pCreateInfo"; } );
|
||||||
|
assert( paramIt != commandData.params.end() && ( paramIt->type.type == "VkPipelineBinaryCreateInfoKHR" ) );
|
||||||
|
auto structIt = m_structs.find( "VkPipelineBinaryCreateInfoKHR" );
|
||||||
|
assert( ( structIt != m_structs.end() ) &&
|
||||||
|
std::any_of( structIt->second.members.begin(), structIt->second.members.end(), []( MemberData const & md ) { return md.name == "pipeline"; } ) &&
|
||||||
|
std::any_of(
|
||||||
|
structIt->second.members.begin(), structIt->second.members.end(), []( MemberData const & md ) { return md.name == "pPipelineCreateInfo"; } ) );
|
||||||
|
auto memberIt =
|
||||||
|
std::find_if( structIt->second.members.begin(), structIt->second.members.end(), []( MemberData const & md ) { return md.name == "pKeysAndDataInfo"; } );
|
||||||
|
assert( memberIt != structIt->second.members.end() && ( memberIt->type.type == "VkPipelineBinaryKeysAndDataKHR" ) );
|
||||||
|
structIt = m_structs.find( "VkPipelineBinaryKeysAndDataKHR" );
|
||||||
|
assert( ( structIt != m_structs.end() ) &&
|
||||||
|
std::any_of( structIt->second.members.begin(), structIt->second.members.end(), []( MemberData const & md ) { return md.name == "binaryCount"; } ) );
|
||||||
|
structIt = m_structs.find( "VkPipelineBinaryHandlesInfoKHR" );
|
||||||
|
assert(
|
||||||
|
( structIt != m_structs.end() ) &&
|
||||||
|
std::any_of(
|
||||||
|
structIt->second.members.begin(), structIt->second.members.end(), []( MemberData const & md ) { return md.name == "pipelineBinaryCount"; } ) &&
|
||||||
|
std::any_of( structIt->second.members.begin(), structIt->second.members.end(), []( MemberData const & md ) { return md.name == "pPipelineBinaries"; } ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const std::string callSequenceTemplate = R"( VULKAN_HPP_NAMESPACE::Result result;
|
||||||
|
if ( createInfo.pKeysAndDataInfo )
|
||||||
|
{
|
||||||
|
VULKAN_HPP_ASSERT( !createInfo.pipeline && !createInfo.pPipelineCreateInfo );
|
||||||
|
pipelineBinaries.resize( createInfo.pKeysAndDataInfo->binaryCount );
|
||||||
|
binaries.pipelineBinaryCount = createInfo.pKeysAndDataInfo->binaryCount;
|
||||||
|
binaries.pPipelineBinaries = pipelineBinaries.data();
|
||||||
|
result = static_cast<VULKAN_HPP_NAMESPACE::Result>( ${dispatcher}${vkCommand}( ${callArguments} ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VULKAN_HPP_ASSERT( !createInfo.pipeline ^ !createInfo.pPipelineCreateInfo );
|
||||||
|
result = static_cast<VULKAN_HPP_NAMESPACE::Result>( ${dispatcher}${vkCommand}( ${callArguments} ) );
|
||||||
|
if ( result == VULKAN_HPP_NAMESPACE::Result::eSuccess )
|
||||||
|
{
|
||||||
|
pipelineBinaries.resize( binaries.pipelineBinaryCount );
|
||||||
|
binaries.pPipelineBinaries = pipelineBinaries.data();
|
||||||
|
result = static_cast<VULKAN_HPP_NAMESPACE::Result>( ${dispatcher}${vkCommand}( ${callArguments} ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
|
||||||
|
std::string callArguments =
|
||||||
|
generateCallArgumentsEnhanced( commandData, initialSkipCount, false, singularParams, templatedParams, raii, raiiFactory, flavourFlags );
|
||||||
|
|
||||||
|
return replaceWithMap( callSequenceTemplate, { { "callArguments", callArguments }, { "dispatcher", dispatcher }, { "vkCommand", name } } );
|
||||||
|
}
|
||||||
|
else if ( name == "vkGetDeviceFaultInfoEXT" )
|
||||||
{
|
{
|
||||||
const std::string callSequenceTemplate =
|
const std::string callSequenceTemplate =
|
||||||
R"( VULKAN_HPP_NAMESPACE::Result result;
|
R"( VULKAN_HPP_NAMESPACE::Result result;
|
||||||
do
|
do
|
||||||
{
|
|
||||||
result = static_cast<VULKAN_HPP_NAMESPACE::Result>( ${dispatcher}vkGetDeviceFaultInfoEXT( m_device, reinterpret_cast<VkDeviceFaultCountsEXT *>( &faultCounts ), nullptr ) );
|
|
||||||
if ( result == VULKAN_HPP_NAMESPACE::Result::eSuccess )
|
|
||||||
{
|
{
|
||||||
std::free( faultInfo.pAddressInfos );
|
result = static_cast<VULKAN_HPP_NAMESPACE::Result>( ${dispatcher}vkGetDeviceFaultInfoEXT( m_device, reinterpret_cast<VkDeviceFaultCountsEXT *>( &faultCounts ), nullptr ) );
|
||||||
if ( faultCounts.addressInfoCount )
|
if ( result == VULKAN_HPP_NAMESPACE::Result::eSuccess )
|
||||||
{
|
{
|
||||||
faultInfo.pAddressInfos = reinterpret_cast<VULKAN_HPP_NAMESPACE::DeviceFaultAddressInfoEXT *>( std::malloc( faultCounts.addressInfoCount * sizeof( VULKAN_HPP_NAMESPACE::DeviceFaultAddressInfoEXT ) ) );
|
std::free( faultInfo.pAddressInfos );
|
||||||
|
if ( faultCounts.addressInfoCount )
|
||||||
|
{
|
||||||
|
faultInfo.pAddressInfos = reinterpret_cast<VULKAN_HPP_NAMESPACE::DeviceFaultAddressInfoEXT *>( std::malloc( faultCounts.addressInfoCount * sizeof( VULKAN_HPP_NAMESPACE::DeviceFaultAddressInfoEXT ) ) );
|
||||||
|
}
|
||||||
|
std::free( faultInfo.pVendorInfos );
|
||||||
|
if ( faultCounts.vendorInfoCount )
|
||||||
|
{
|
||||||
|
faultInfo.pVendorInfos = reinterpret_cast<VULKAN_HPP_NAMESPACE::DeviceFaultVendorInfoEXT *>( std::malloc( faultCounts.vendorInfoCount * sizeof( VULKAN_HPP_NAMESPACE::DeviceFaultVendorInfoEXT ) ) );
|
||||||
|
}
|
||||||
|
std::free( faultInfo.pVendorBinaryData );
|
||||||
|
if ( faultCounts.vendorBinarySize )
|
||||||
|
{
|
||||||
|
faultInfo.pVendorBinaryData = std::malloc( faultCounts.vendorBinarySize );
|
||||||
|
}
|
||||||
|
result = static_cast<VULKAN_HPP_NAMESPACE::Result>( ${dispatcher}vkGetDeviceFaultInfoEXT( m_device, reinterpret_cast<VkDeviceFaultCountsEXT *>( &faultCounts ), reinterpret_cast<VkDeviceFaultInfoEXT *>( &faultInfo ) ) );
|
||||||
}
|
}
|
||||||
std::free( faultInfo.pVendorInfos );
|
} while ( result == VULKAN_HPP_NAMESPACE::Result::eIncomplete );)";
|
||||||
if ( faultCounts.vendorInfoCount )
|
|
||||||
{
|
|
||||||
faultInfo.pVendorInfos = reinterpret_cast<VULKAN_HPP_NAMESPACE::DeviceFaultVendorInfoEXT *>( std::malloc( faultCounts.vendorInfoCount * sizeof( VULKAN_HPP_NAMESPACE::DeviceFaultVendorInfoEXT ) ) );
|
|
||||||
}
|
|
||||||
std::free( faultInfo.pVendorBinaryData );
|
|
||||||
if ( faultCounts.vendorBinarySize )
|
|
||||||
{
|
|
||||||
faultInfo.pVendorBinaryData = std::malloc( faultCounts.vendorBinarySize );
|
|
||||||
}
|
|
||||||
result = static_cast<VULKAN_HPP_NAMESPACE::Result>( ${dispatcher}vkGetDeviceFaultInfoEXT( m_device, reinterpret_cast<VkDeviceFaultCountsEXT *>( &faultCounts ), reinterpret_cast<VkDeviceFaultInfoEXT *>( &faultInfo ) ) );
|
|
||||||
}
|
|
||||||
} while ( result == VULKAN_HPP_NAMESPACE::Result::eIncomplete );)";
|
|
||||||
|
|
||||||
return replaceWithMap( callSequenceTemplate, { { "dispatcher", dispatcher } } );
|
return replaceWithMap( callSequenceTemplate, { { "dispatcher", dispatcher } } );
|
||||||
}
|
}
|
||||||
@ -3091,8 +3194,21 @@ std::string VulkanHppGenerator::generateCallSequence( std::string const &
|
|||||||
std::string firstCallArguments = generateCallArgumentsEnhanced( commandData, initialSkipCount, true, {}, templatedParams, raii, raiiFactory, flavourFlags );
|
std::string firstCallArguments = generateCallArgumentsEnhanced( commandData, initialSkipCount, true, {}, templatedParams, raii, raiiFactory, flavourFlags );
|
||||||
std::string secondCallArguments =
|
std::string secondCallArguments =
|
||||||
generateCallArgumentsEnhanced( commandData, initialSkipCount, false, {}, templatedParams, raii, raiiFactory, flavourFlags );
|
generateCallArgumentsEnhanced( commandData, initialSkipCount, false, {}, templatedParams, raii, raiiFactory, flavourFlags );
|
||||||
std::string vectorName = startLowerCase( stripPrefix( commandData.params[vectorParamIt->first].name, "p" ) );
|
std::string vectorName, vectorSize;
|
||||||
std::string vectorSize = startLowerCase( stripPrefix( commandData.params[vectorParamIt->second.lenParam].name, "p" ) );
|
if ( vectorParamIt->second.byStructure )
|
||||||
|
{
|
||||||
|
auto structIt = m_structs.find( commandData.params[vectorParamIt->first].type.type );
|
||||||
|
assert( structIt != m_structs.end() );
|
||||||
|
vectorName = structIt->second.members.back().name;
|
||||||
|
vectorSize = startLowerCase( stripPrefix( commandData.params[vectorParamIt->first].name, "p" ) ) + "." +
|
||||||
|
structIt->second.members[vectorParamIt->second.lenParam].name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vectorName = commandData.params[vectorParamIt->first].name;
|
||||||
|
vectorSize = startLowerCase( stripPrefix( commandData.params[vectorParamIt->second.lenParam].name, "p" ) );
|
||||||
|
}
|
||||||
|
vectorName = startLowerCase( stripPrefix( vectorName, "p" ) );
|
||||||
|
|
||||||
if ( ( flavourFlags & CommandFlavourFlagBits::chained ) && needsStructureChainResize( vectorParams, chainedReturnParams ) )
|
if ( ( flavourFlags & CommandFlavourFlagBits::chained ) && needsStructureChainResize( vectorParams, chainedReturnParams ) )
|
||||||
{
|
{
|
||||||
@ -3208,18 +3324,35 @@ std::string VulkanHppGenerator::generateCallSequence( std::string const &
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
std::string resizeInstructions;
|
||||||
|
if ( vectorParamIt->second.byStructure )
|
||||||
|
{
|
||||||
|
std::string const resizeInstructionTemplate = R"(${vectorName}.resize( ${vectorSize} );
|
||||||
|
${structName}.${pointerName} = ${vectorName}.data();)";
|
||||||
|
|
||||||
|
resizeInstructions = replaceWithMap( resizeInstructionTemplate,
|
||||||
|
{ { "pointerName", "p" + startUpperCase( vectorName ) },
|
||||||
|
{ "structName", startLowerCase( stripPrefix( commandData.params[vectorParamIt->first].name, "p" ) ) },
|
||||||
|
{ "vectorName", vectorName },
|
||||||
|
{ "vectorSize", vectorSize } } );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string const resizeInstructionTemplate = R"(${vectorName}.resize( ${vectorSize} );)";
|
||||||
|
resizeInstructions = replaceWithMap( resizeInstructionTemplate, { { "vectorName", vectorName }, { "vectorSize", vectorSize } } );
|
||||||
|
}
|
||||||
|
|
||||||
// no need to enumerate here, just two calls
|
// no need to enumerate here, just two calls
|
||||||
assert( commandData.returnType == "void" );
|
assert( commandData.returnType == "void" );
|
||||||
std::string const callSequenceTemplate = R"(${dispatcher}${vkCommand}( ${firstCallArguments} );
|
std::string const callSequenceTemplate = R"(${dispatcher}${vkCommand}( ${firstCallArguments} );
|
||||||
${vectorName}.resize( ${vectorSize} );
|
${resizeInstructions}
|
||||||
${dispatcher}${vkCommand}( ${secondCallArguments} );)";
|
${dispatcher}${vkCommand}( ${secondCallArguments} );)";
|
||||||
|
|
||||||
return replaceWithMap( callSequenceTemplate,
|
return replaceWithMap( callSequenceTemplate,
|
||||||
{ { "dispatcher", dispatcher },
|
{ { "dispatcher", dispatcher },
|
||||||
{ "firstCallArguments", firstCallArguments },
|
{ "firstCallArguments", firstCallArguments },
|
||||||
|
{ "resizeInstructions", resizeInstructions },
|
||||||
{ "secondCallArguments", secondCallArguments },
|
{ "secondCallArguments", secondCallArguments },
|
||||||
{ "vectorName", vectorName },
|
|
||||||
{ "vectorSize", vectorSize },
|
|
||||||
{ "vkCommand", name } } );
|
{ "vkCommand", name } } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3438,7 +3571,7 @@ std::string VulkanHppGenerator::generateCommandEnhanced( std::string const &
|
|||||||
std::string dataDeclarations = generateDataDeclarations(
|
std::string dataDeclarations = generateDataDeclarations(
|
||||||
commandData, returnParams, vectorParams, templatedParams, flavourFlags, false, dataTypes, dataType, returnType, returnVariable );
|
commandData, returnParams, vectorParams, templatedParams, flavourFlags, false, dataTypes, dataType, returnType, returnVariable );
|
||||||
std::string dataPreparation =
|
std::string dataPreparation =
|
||||||
generateDataPreparation( commandData, initialSkipCount, returnParams, vectorParams, templatedParams, flavourFlags, enumerating );
|
generateDataPreparation( commandData, initialSkipCount, returnParams, vectorParams, templatedParams, flavourFlags, enumerating, dataTypes );
|
||||||
std::string dataSizeChecks = generateDataSizeChecks( commandData, returnParams, dataTypes, vectorParams, templatedParams, singular );
|
std::string dataSizeChecks = generateDataSizeChecks( commandData, returnParams, dataTypes, vectorParams, templatedParams, singular );
|
||||||
std::string callSequence = generateCallSequence(
|
std::string callSequence = generateCallSequence(
|
||||||
name, commandData, returnParams, vectorParams, initialSkipCount, singularParams, templatedParams, chainedReturnParams, flavourFlags, false, false );
|
name, commandData, returnParams, vectorParams, initialSkipCount, singularParams, templatedParams, chainedReturnParams, flavourFlags, false, false );
|
||||||
@ -3688,6 +3821,28 @@ std::string VulkanHppGenerator::generateCommandResultMultiSuccessWithErrors1Retu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( isStructureChainAnchor( commandData.params[returnParam].type.type ) )
|
||||||
|
{
|
||||||
|
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandData.params );
|
||||||
|
if ( vectorParams.empty() )
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
// needs to be verified ...
|
||||||
|
return generateCommandSetInclusive( name,
|
||||||
|
commandData,
|
||||||
|
initialSkipCount,
|
||||||
|
definition,
|
||||||
|
{ returnParam },
|
||||||
|
vectorParams,
|
||||||
|
false,
|
||||||
|
{ CommandFlavourFlagBits::enhanced, CommandFlavourFlagBits::chained },
|
||||||
|
raii,
|
||||||
|
false,
|
||||||
|
{ CommandFlavourFlagBits::enhanced, CommandFlavourFlagBits::chained } );
|
||||||
|
#endif
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
else if ( isHandleType( commandData.params[returnParam].type.type ) )
|
else if ( isHandleType( commandData.params[returnParam].type.type ) )
|
||||||
{
|
{
|
||||||
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandData.params );
|
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandData.params );
|
||||||
@ -3719,25 +3874,22 @@ std::string VulkanHppGenerator::generateCommandResultMultiSuccessWithErrors1Retu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( isStructureChainAnchor( commandData.params[returnParam].type.type ) )
|
else if ( isHandleTypeByStructure( commandData.params[returnParam].type.type ) )
|
||||||
{
|
{
|
||||||
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandData.params );
|
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( commandData.params );
|
||||||
if ( vectorParams.empty() )
|
if ( vectorParams.size() == 1 )
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
// needs to be verified ...
|
|
||||||
return generateCommandSetInclusive( name,
|
return generateCommandSetInclusive( name,
|
||||||
commandData,
|
commandData,
|
||||||
initialSkipCount,
|
initialSkipCount,
|
||||||
definition,
|
definition,
|
||||||
{ returnParam },
|
{ returnParam },
|
||||||
vectorParams,
|
vectorParams,
|
||||||
false,
|
true,
|
||||||
{ CommandFlavourFlagBits::enhanced, CommandFlavourFlagBits::chained },
|
{ CommandFlavourFlagBits::enhanced, CommandFlavourFlagBits::withAllocator },
|
||||||
raii, false,
|
raii,
|
||||||
{ CommandFlavourFlagBits::enhanced, CommandFlavourFlagBits::chained } );
|
true,
|
||||||
#endif
|
{ CommandFlavourFlagBits::enhanced } );
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -4009,7 +4161,7 @@ std::string VulkanHppGenerator::generateCommandResultSingleSuccessNoErrors(
|
|||||||
{
|
{
|
||||||
return generateCommandSet( definition,
|
return generateCommandSet( definition,
|
||||||
generateCommandStandard( name, commandData, initialSkipCount, definition ),
|
generateCommandStandard( name, commandData, initialSkipCount, definition ),
|
||||||
{ generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, {} ) } );
|
{ generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, {}, {} ) } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4462,7 +4614,7 @@ std::string VulkanHppGenerator::generateCommandSetExclusive(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
return generateCommandSet( generateCommandStandard( name, commandData, initialSkipCount, definition ),
|
return generateCommandSet( generateCommandStandard( name, commandData, initialSkipCount, definition ),
|
||||||
generateCommandEnhanced( name, commandData, initialSkipCount, definition, {}, {} ) );
|
generateCommandEnhanced( name, commandData, initialSkipCount, definition, {}, {}, {} ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4618,7 +4770,7 @@ std::string VulkanHppGenerator::generateCommandValue(
|
|||||||
{
|
{
|
||||||
return generateCommandSet( definition,
|
return generateCommandSet( definition,
|
||||||
generateCommandStandard( name, commandData, initialSkipCount, definition ),
|
generateCommandStandard( name, commandData, initialSkipCount, definition ),
|
||||||
{ generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, returnParams ) } );
|
{ generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, returnParams, {} ) } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4745,16 +4897,18 @@ std::string VulkanHppGenerator::generateCommandVoid1Return(
|
|||||||
case 1:
|
case 1:
|
||||||
if ( returnParam == vectorParams.begin()->first )
|
if ( returnParam == vectorParams.begin()->first )
|
||||||
{
|
{
|
||||||
if ( !raii )
|
// you get a vector of stuff, with the size being one of the parameters
|
||||||
{
|
return generateCommandSetInclusive( name,
|
||||||
// you get a vector of stuff, with the size being one of the parameters
|
commandData,
|
||||||
return generateCommandSet(
|
initialSkipCount,
|
||||||
definition,
|
definition,
|
||||||
generateCommandStandard( name, commandData, initialSkipCount, definition ),
|
{ returnParam },
|
||||||
{ generateCommandEnhanced( name, commandData, initialSkipCount, definition, vectorParams, { returnParam } ),
|
vectorParams,
|
||||||
generateCommandEnhanced(
|
false,
|
||||||
name, commandData, initialSkipCount, definition, vectorParams, { returnParam }, CommandFlavourFlagBits::withAllocator ) } );
|
{ CommandFlavourFlagBits::enhanced, CommandFlavourFlagBits::withAllocator },
|
||||||
}
|
raii,
|
||||||
|
false,
|
||||||
|
{ CommandFlavourFlagBits::enhanced } );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -5795,17 +5949,36 @@ std::string VulkanHppGenerator::generateDataDeclarations1Return( CommandData con
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string allocator = stripPrefix( dataTypes[0], "VULKAN_HPP_NAMESPACE::" ) + "Allocator";
|
std::string allocator = stripPrefix( dataTypes[0], "VULKAN_HPP_NAMESPACE::" ) + "Allocator";
|
||||||
std::string vectorAllocator = ( ( flavourFlags & CommandFlavourFlagBits::withAllocator ) && !( flavourFlags & CommandFlavourFlagBits::unique ) )
|
if ( vectorParamIt->second.byStructure )
|
||||||
? ( ", " + startLowerCase( allocator ) )
|
{
|
||||||
: "";
|
std::string vectorAllocator = ( ( flavourFlags & CommandFlavourFlagBits::withAllocator ) && !( flavourFlags & CommandFlavourFlagBits::unique ) )
|
||||||
std::string vectorSize = getVectorSize( commandData.params, vectorParams, returnParams[0], dataTypes[0], templatedParams );
|
? ( "( " + startLowerCase( allocator ) + " )" )
|
||||||
|
: "";
|
||||||
|
|
||||||
std::string const dataDeclarationsTemplate = R"(${dataType} ${returnVariable}( ${vectorSize}${vectorAllocator} );)";
|
std::string const dataDeclarationTemplate = R"(${dataType} ${returnVariable}${vectorAllocator};
|
||||||
|
${structType} ${structVariable};)";
|
||||||
|
|
||||||
return replaceWithMap(
|
return replaceWithMap( dataDeclarationTemplate,
|
||||||
dataDeclarationsTemplate,
|
{ { "dataType", dataType },
|
||||||
{ { "dataType", dataType }, { "returnVariable", returnVariable }, { "vectorAllocator", vectorAllocator }, { "vectorSize", vectorSize } } );
|
{ "returnVariable", returnVariable },
|
||||||
|
{ "structType", stripPostfix( commandData.params[vectorParamIt->first].type.compose( "VULKAN_HPP_NAMESPACE" ), "*" ) },
|
||||||
|
{ "structVariable", startLowerCase( stripPrefix( commandData.params[vectorParamIt->first].name, "p" ) ) },
|
||||||
|
{ "vectorAllocator", stripPrefix( vectorAllocator, "," ) } } );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string vectorAllocator = ( ( flavourFlags & CommandFlavourFlagBits::withAllocator ) && !( flavourFlags & CommandFlavourFlagBits::unique ) )
|
||||||
|
? ( ", " + startLowerCase( allocator ) )
|
||||||
|
: "";
|
||||||
|
std::string vectorSize = getVectorSize( commandData.params, vectorParams, returnParams[0], dataTypes[0], templatedParams );
|
||||||
|
|
||||||
|
std::string const dataDeclarationsTemplate = R"(${dataType} ${returnVariable}( ${vectorSize}${vectorAllocator} );)";
|
||||||
|
|
||||||
|
return replaceWithMap(
|
||||||
|
dataDeclarationsTemplate,
|
||||||
|
{ { "dataType", dataType }, { "returnVariable", returnVariable }, { "vectorAllocator", vectorAllocator }, { "vectorSize", vectorSize } } );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -6044,7 +6217,8 @@ std::string VulkanHppGenerator::generateDataPreparation( CommandData const &
|
|||||||
std::map<size_t, VectorParamData> const & vectorParams,
|
std::map<size_t, VectorParamData> const & vectorParams,
|
||||||
std::set<size_t> const & templatedParams,
|
std::set<size_t> const & templatedParams,
|
||||||
CommandFlavourFlags flavourFlags,
|
CommandFlavourFlags flavourFlags,
|
||||||
bool enumerating ) const
|
bool enumerating,
|
||||||
|
std::vector<std::string> const & dataTypes ) const
|
||||||
{
|
{
|
||||||
const bool chained = flavourFlags & CommandFlavourFlagBits::chained;
|
const bool chained = flavourFlags & CommandFlavourFlagBits::chained;
|
||||||
const bool singular = flavourFlags & CommandFlavourFlagBits::singular;
|
const bool singular = flavourFlags & CommandFlavourFlagBits::singular;
|
||||||
@ -6134,34 +6308,45 @@ std::string VulkanHppGenerator::generateDataPreparation( CommandData const &
|
|||||||
}
|
}
|
||||||
else if ( unique && !singular && ( returnParams.size() == 1 ) && vectorParams.contains( returnParams[0] ) )
|
else if ( unique && !singular && ( returnParams.size() == 1 ) && vectorParams.contains( returnParams[0] ) )
|
||||||
{
|
{
|
||||||
assert( !enumerating );
|
std::string className = initialSkipCount ? stripPrefix( commandData.params[initialSkipCount - 1].type.type, "Vk" ) : "";
|
||||||
std::string className = initialSkipCount ? stripPrefix( commandData.params[initialSkipCount - 1].type.type, "Vk" ) : "";
|
std::string deleterDefinition, vectorName, vectorSize;
|
||||||
std::string deleterDefinition;
|
vectorParamIt = vectorParams.find( returnParams[0] );
|
||||||
std::vector<std::string> lenParts = tokenize( commandData.params[returnParams[0]].lenExpression, "->" );
|
if ( vectorParamIt != vectorParams.end() && vectorParamIt->second.byStructure )
|
||||||
switch ( lenParts.size() )
|
|
||||||
{
|
{
|
||||||
case 1: deleterDefinition = "ObjectDestroy<" + className + ", Dispatch> deleter( *this, allocator, d )"; break;
|
deleterDefinition = "ObjectDestroy<" + className + ", Dispatch> deleter( *this, allocator, d )";
|
||||||
case 2:
|
auto structIt = m_structs.find( commandData.params[returnParams[0]].type.type );
|
||||||
{
|
assert( structIt != m_structs.end() );
|
||||||
auto vpiIt = vectorParams.find( returnParams[0] );
|
vectorName = startLowerCase( stripPrefix( structIt->second.members.back().name, "p" ) );
|
||||||
assert( vpiIt != vectorParams.end() );
|
vectorSize = vectorName + ".size()";
|
||||||
std::string poolType, poolName;
|
}
|
||||||
std::tie( poolType, poolName ) = getPoolTypeAndName( commandData.params[vpiIt->second.lenParam].type.type );
|
else
|
||||||
assert( !poolType.empty() );
|
{
|
||||||
poolType = stripPrefix( poolType, "Vk" );
|
std::vector<std::string> lenParts = tokenize( commandData.params[returnParams[0]].lenExpression, "->" );
|
||||||
poolName = startLowerCase( stripPrefix( lenParts[0], "p" ) ) + "." + poolName;
|
switch ( lenParts.size() )
|
||||||
deleterDefinition = "PoolFree<" + className + ", " + poolType + ", Dispatch> deleter( *this, " + poolName + ", d )";
|
{
|
||||||
}
|
case 1: deleterDefinition = "ObjectDestroy<" + className + ", Dispatch> deleter( *this, allocator, d )"; break;
|
||||||
break;
|
case 2:
|
||||||
default: assert( false ); break;
|
{
|
||||||
|
auto vpiIt = vectorParams.find( returnParams[0] );
|
||||||
|
assert( vpiIt != vectorParams.end() );
|
||||||
|
std::string poolType, poolName;
|
||||||
|
std::tie( poolType, poolName ) = getPoolTypeAndName( commandData.params[vpiIt->second.lenParam].type.type );
|
||||||
|
assert( !poolType.empty() );
|
||||||
|
poolType = stripPrefix( poolType, "Vk" );
|
||||||
|
poolName = startLowerCase( stripPrefix( lenParts[0], "p" ) ) + "." + poolName;
|
||||||
|
deleterDefinition = "PoolFree<" + className + ", " + poolType + ", Dispatch> deleter( *this, " + poolName + ", d )";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: assert( false ); break;
|
||||||
|
}
|
||||||
|
vectorName = startLowerCase( stripPrefix( commandData.params[returnParams[0]].name, "p" ) );
|
||||||
|
vectorSize = getVectorSize( commandData.params, vectorParams, returnParams[0], commandData.params[returnParams[0]].type.type, templatedParams );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string handleType = stripPrefix( commandData.params[returnParams[0]].type.type, "Vk" );
|
std::string handleType = stripPrefix( dataTypes[0], "VULKAN_HPP_NAMESPACE::" );
|
||||||
std::string uniqueVectorName = "unique" + stripPrefix( commandData.params[returnParams[0]].name, "p" );
|
|
||||||
std::string vectorAllocator = ( flavourFlags & CommandFlavourFlagBits::withAllocator ) ? ( "( " + startLowerCase( handleType ) + "Allocator )" ) : "";
|
std::string vectorAllocator = ( flavourFlags & CommandFlavourFlagBits::withAllocator ) ? ( "( " + startLowerCase( handleType ) + "Allocator )" ) : "";
|
||||||
std::string vectorName = startLowerCase( stripPrefix( commandData.params[returnParams[0]].name, "p" ) );
|
|
||||||
std::string elementName = stripPluralS( vectorName );
|
std::string elementName = stripPluralS( vectorName );
|
||||||
std::string vectorSize = getVectorSize( commandData.params, vectorParams, returnParams[0], commandData.params[returnParams[0]].type.type, templatedParams );
|
std::string uniqueVectorName = "unique" + startUpperCase( vectorName );
|
||||||
|
|
||||||
std::string const dataPreparationTemplate =
|
std::string const dataPreparationTemplate =
|
||||||
R"(std::vector<UniqueHandle<VULKAN_HPP_NAMESPACE::${handleType}, Dispatch>, ${handleType}Allocator> ${uniqueVectorName}${vectorAllocator};
|
R"(std::vector<UniqueHandle<VULKAN_HPP_NAMESPACE::${handleType}, Dispatch>, ${handleType}Allocator> ${uniqueVectorName}${vectorAllocator};
|
||||||
@ -8250,7 +8435,9 @@ std::string VulkanHppGenerator::generateRAIIFactoryReturnStatements( std::vector
|
|||||||
std::string successCodePassToElement = ( enumerating ? ( successCodes.size() <= 2 ) : ( successCodes.size() <= 1 ) ) ? "" : ", result";
|
std::string successCodePassToElement = ( enumerating ? ( successCodes.size() <= 2 ) : ( successCodes.size() <= 1 ) ) ? "" : ", result";
|
||||||
if ( returnType.starts_with( "std::vector" ) )
|
if ( returnType.starts_with( "std::vector" ) )
|
||||||
{
|
{
|
||||||
std::string const & returnTemplate = R"(${returnType} ${returnVariable}RAII;
|
assert( !successCodes.empty() );
|
||||||
|
|
||||||
|
std::string const & returnTemplate = R"(${returnType} ${returnVariable}RAII;
|
||||||
${returnVariable}RAII.reserve( ${returnVariable}.size() );
|
${returnVariable}RAII.reserve( ${returnVariable}.size() );
|
||||||
for ( auto & ${element} : ${returnVariable} )
|
for ( auto & ${element} : ${returnVariable} )
|
||||||
{
|
{
|
||||||
@ -8258,10 +8445,9 @@ std::string VulkanHppGenerator::generateRAIIFactoryReturnStatements( std::vector
|
|||||||
}
|
}
|
||||||
return ${returnVariable}RAII;
|
return ${returnVariable}RAII;
|
||||||
)";
|
)";
|
||||||
std::string element = stripPluralS( returnVariable );
|
|
||||||
std::string handleConstructorArguments = generateRAIIHandleSingularConstructorArguments( *handleIt, params, true );
|
|
||||||
|
|
||||||
assert( !successCodes.empty() );
|
std::string element = stripPluralS( returnVariable );
|
||||||
|
std::string handleConstructorArguments = generateRAIIHandleSingularConstructorArguments( *handleIt, params, vkType, element );
|
||||||
|
|
||||||
return replaceWithMap( returnTemplate,
|
return replaceWithMap( returnTemplate,
|
||||||
{ { "element", element },
|
{ { "element", element },
|
||||||
@ -8274,7 +8460,8 @@ std::string VulkanHppGenerator::generateRAIIFactoryReturnStatements( std::vector
|
|||||||
{
|
{
|
||||||
std::string const & returnTemplate = "return ${returnType}( *this, ${handleConstructorArguments}${successCodePassToElement} );";
|
std::string const & returnTemplate = "return ${returnType}( *this, ${handleConstructorArguments}${successCodePassToElement} );";
|
||||||
|
|
||||||
std::string handleConstructorArguments = generateRAIIHandleSingularConstructorArguments( *handleIt, params, singular );
|
std::string handleConstructorArguments =
|
||||||
|
generateRAIIHandleSingularConstructorArguments( *handleIt, params, vkType, singular ? stripPluralS( returnVariable ) : returnVariable );
|
||||||
|
|
||||||
return replaceWithMap( returnTemplate,
|
return replaceWithMap( returnTemplate,
|
||||||
{ { "returnType", returnType },
|
{ { "returnType", returnType },
|
||||||
@ -8654,7 +8841,7 @@ ${vectorSizeCheck}
|
|||||||
std::string dataDeclarations =
|
std::string dataDeclarations =
|
||||||
generateDataDeclarations( commandData, returnParams, vectorParams, templatedParams, flavourFlags, true, dataTypes, dataType, returnType, returnVariable );
|
generateDataDeclarations( commandData, returnParams, vectorParams, templatedParams, flavourFlags, true, dataTypes, dataType, returnType, returnVariable );
|
||||||
std::string dataPreparation =
|
std::string dataPreparation =
|
||||||
generateDataPreparation( commandData, initialSkipCount, returnParams, vectorParams, templatedParams, flavourFlags, enumerating );
|
generateDataPreparation( commandData, initialSkipCount, returnParams, vectorParams, templatedParams, flavourFlags, enumerating, dataTypes );
|
||||||
std::string dataSizeChecks = generateDataSizeChecks( commandData, returnParams, dataTypes, vectorParams, templatedParams, singular );
|
std::string dataSizeChecks = generateDataSizeChecks( commandData, returnParams, dataTypes, vectorParams, templatedParams, singular );
|
||||||
std::string resultCheck = generateResultCheck( commandData, className, "::", commandName, enumerating );
|
std::string resultCheck = generateResultCheck( commandData, className, "::", commandName, enumerating );
|
||||||
std::string returnStatement = generateReturnStatement( name,
|
std::string returnStatement = generateReturnStatement( name,
|
||||||
@ -8714,7 +8901,9 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandFactory( std::string co
|
|||||||
bool definition,
|
bool definition,
|
||||||
CommandFlavourFlags flavourFlags ) const
|
CommandFlavourFlags flavourFlags ) const
|
||||||
{
|
{
|
||||||
assert( isHandleType( commandData.params[returnParams.back()].type.type ) );
|
assert( isHandleType( commandData.params[returnParams.back()].type.type ) ||
|
||||||
|
( vectorParams.contains( returnParams.back() ) && vectorParams.find( returnParams.back() )->second.byStructure &&
|
||||||
|
isHandleType( vectorMemberByStructure( commandData.params[returnParams.back()].type.type ).type.type ) ) );
|
||||||
assert( ( returnParams.size() == 1 ) ||
|
assert( ( returnParams.size() == 1 ) ||
|
||||||
( ( returnParams.size() == 2 ) && ( vectorParams.size() == 1 ) && ( returnParams[0] == vectorParams.begin()->second.lenParam ) &&
|
( ( returnParams.size() == 2 ) && ( vectorParams.size() == 1 ) && ( returnParams[0] == vectorParams.begin()->second.lenParam ) &&
|
||||||
( returnParams[1] == vectorParams.begin()->first ) ) );
|
( returnParams[1] == vectorParams.begin()->first ) ) );
|
||||||
@ -8726,9 +8915,20 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandFactory( std::string co
|
|||||||
std::set<size_t> singularParams = singular ? determineSingularParams( returnParams.back(), vectorParams ) : std::set<size_t>();
|
std::set<size_t> singularParams = singular ? determineSingularParams( returnParams.back(), vectorParams ) : std::set<size_t>();
|
||||||
std::string argumentList = generateRAIIHandleCommandFactoryArgumentList( commandData.params, skippedParams, definition, singular );
|
std::string argumentList = generateRAIIHandleCommandFactoryArgumentList( commandData.params, skippedParams, definition, singular );
|
||||||
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, flavourFlags );
|
std::string commandName = generateCommandName( name, commandData.params, initialSkipCount, flavourFlags );
|
||||||
std::string handleType = stripPostfix( commandData.params[returnParams.back()].type.compose( "VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE" ), " *" );
|
|
||||||
std::string noexceptString = enumerating ? "" : "VULKAN_HPP_RAII_CREATE_NOEXCEPT";
|
std::string handleType;
|
||||||
std::string returnType = handleType;
|
if ( ( vectorParams.size() == 1 ) && vectorParams.begin()->second.byStructure )
|
||||||
|
{
|
||||||
|
assert( vectorParams.begin()->first == returnParams.back() );
|
||||||
|
handleType = vectorMemberByStructure( commandData.params.back().type.type ).type.compose( "VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
handleType = commandData.params[returnParams.back()].type.compose( "VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE" );
|
||||||
|
}
|
||||||
|
handleType = stripPostfix( handleType, " *" );
|
||||||
|
std::string noexceptString = enumerating ? "" : "VULKAN_HPP_RAII_CREATE_NOEXCEPT";
|
||||||
|
std::string returnType = handleType;
|
||||||
if ( vectorParams.contains( returnParams.back() ) && !singular )
|
if ( vectorParams.contains( returnParams.back() ) && !singular )
|
||||||
{
|
{
|
||||||
noexceptString = "";
|
noexceptString = "";
|
||||||
@ -8740,12 +8940,22 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandFactory( std::string co
|
|||||||
{
|
{
|
||||||
std::string callSequence =
|
std::string callSequence =
|
||||||
generateCallSequence( name, commandData, returnParams, vectorParams, initialSkipCount, singularParams, {}, {}, flavourFlags, true, true );
|
generateCallSequence( name, commandData, returnParams, vectorParams, initialSkipCount, singularParams, {}, {}, flavourFlags, true, true );
|
||||||
std::string className = initialSkipCount ? stripPrefix( commandData.params[initialSkipCount - 1].type.type, "Vk" ) : "Context";
|
std::string className = initialSkipCount ? stripPrefix( commandData.params[initialSkipCount - 1].type.type, "Vk" ) : "Context";
|
||||||
std::vector<std::string> dataTypes = determineDataTypes( commandData.params, vectorParams, returnParams, {} );
|
std::vector<std::string> dataTypes = determineDataTypes( commandData.params, vectorParams, returnParams, {} );
|
||||||
std::string dataType = combineDataTypes( vectorParams, returnParams, enumerating, dataTypes, flavourFlags, true );
|
std::string dataType = combineDataTypes( vectorParams, returnParams, enumerating, dataTypes, flavourFlags, true );
|
||||||
std::string returnVariable = generateReturnVariable( commandData, returnParams, vectorParams, flavourFlags );
|
std::string returnVariable = generateReturnVariable( commandData, returnParams, vectorParams, flavourFlags );
|
||||||
std::string returnStatements = generateRAIIFactoryReturnStatements(
|
std::string vulkanType;
|
||||||
commandData.params, commandData.successCodes, commandData.params[returnParams.back()].type.type, enumerating, returnType, returnVariable, singular );
|
auto vectorParamIt = vectorParams.find( returnParams.back() );
|
||||||
|
if ( ( vectorParamIt != vectorParams.end() ) && vectorParamIt->second.byStructure )
|
||||||
|
{
|
||||||
|
vulkanType = vectorMemberByStructure( commandData.params[returnParams.back()].type.type ).type.type;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vulkanType = commandData.params[returnParams.back()].type.type;
|
||||||
|
}
|
||||||
|
std::string returnStatements =
|
||||||
|
generateRAIIFactoryReturnStatements( commandData.params, commandData.successCodes, vulkanType, enumerating, returnType, returnVariable, singular );
|
||||||
std::string dataDeclarations =
|
std::string dataDeclarations =
|
||||||
generateDataDeclarations( commandData, returnParams, vectorParams, {}, flavourFlags, true, dataTypes, dataType, returnType, returnVariable );
|
generateDataDeclarations( commandData, returnParams, vectorParams, {}, flavourFlags, true, dataTypes, dataType, returnType, returnVariable );
|
||||||
std::string vkType = commandData.params[returnParams.back()].type.type;
|
std::string vkType = commandData.params[returnParams.back()].type.type;
|
||||||
@ -8973,12 +9183,18 @@ std::string VulkanHppGenerator::generateRAIIHandleConstructorArguments( std::pai
|
|||||||
{
|
{
|
||||||
// this is supposed to be the returned size on an enumeration function!
|
// this is supposed to be the returned size on an enumeration function!
|
||||||
#if !defined( NDEBUG )
|
#if !defined( NDEBUG )
|
||||||
assert( ( param.type.type == "size_t" ) || ( param.type.type == "uint32_t" ) );
|
if ( ( param.type.type == "size_t" ) || ( param.type.type == "uint32_t" ) )
|
||||||
auto typeIt = std::find_if( constructorIt->second.params.begin(),
|
{
|
||||||
constructorIt->second.params.end(),
|
auto typeIt = std::find_if( constructorIt->second.params.begin(),
|
||||||
[&handle]( ParamData const & pd ) { return pd.type.type == handle.first; } );
|
constructorIt->second.params.end(),
|
||||||
assert( typeIt != constructorIt->second.params.end() );
|
[&handle]( ParamData const & pd ) { return pd.type.type == handle.first; } );
|
||||||
assert( typeIt->lenExpression == param.name );
|
assert( typeIt != constructorIt->second.params.end() );
|
||||||
|
assert( typeIt->lenExpression == param.name );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
assert( vectorMemberByStructure( param.type.type ).type.type == handle.first );
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -9176,12 +9392,19 @@ std::pair<std::string, std::string> VulkanHppGenerator::generateRAIIHandleConstr
|
|||||||
switch ( returnParams.size() )
|
switch ( returnParams.size() )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
assert( isHandleType( constructorIt->second.params[returnParams[0]].type.type ) );
|
|
||||||
{
|
{
|
||||||
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( constructorIt->second.params );
|
std::map<size_t, VectorParamData> vectorParams = determineVectorParams( constructorIt->second.params );
|
||||||
if ( vectorParams.size() == 2 )
|
if ( isHandleType( constructorIt->second.params[returnParams[0]].type.type ) )
|
||||||
{
|
{
|
||||||
return generateRAIIHandleConstructor1Return2Vector( handle, constructorIt, enter, leave, returnParams[0], vectorParams );
|
if ( vectorParams.size() == 2 )
|
||||||
|
{
|
||||||
|
return generateRAIIHandleConstructor1Return2Vector( handle, constructorIt, enter, leave, returnParams[0], vectorParams );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( ( vectorParams.size() == 1 ) && ( vectorParams.begin()->first == returnParams[0] ) && vectorParams.begin()->second.byStructure )
|
||||||
|
{
|
||||||
|
assert( isHandleTypeByStructure( constructorIt->second.params[returnParams[0]].type.type ) );
|
||||||
|
return std::make_pair( "", generateRAIIHandleConstructorByCall( handle, constructorIt, enter, leave, true, false ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -9282,7 +9505,8 @@ std::string VulkanHppGenerator::generateRAIIHandleConstructorByCall( std::pair<s
|
|||||||
{
|
{
|
||||||
createArguments = stripPostfix( createArguments, ", " );
|
createArguments = stripPostfix( createArguments, ", " );
|
||||||
}
|
}
|
||||||
assert( constructorIt->second.params.back().type.type == handle.first );
|
assert( ( constructorIt->second.params.back().type.type == handle.first ) ||
|
||||||
|
( vectorMemberByStructure( constructorIt->second.params.back().type.type ).type.type == handle.first ) );
|
||||||
|
|
||||||
const std::string constructorTemplate =
|
const std::string constructorTemplate =
|
||||||
R"(
|
R"(
|
||||||
@ -9703,15 +9927,10 @@ ${raiiHandles}
|
|||||||
|
|
||||||
std::string VulkanHppGenerator::generateRAIIHandleSingularConstructorArguments( std::pair<std::string, HandleData> const & handle,
|
std::string VulkanHppGenerator::generateRAIIHandleSingularConstructorArguments( std::pair<std::string, HandleData> const & handle,
|
||||||
std::vector<ParamData> const & params,
|
std::vector<ParamData> const & params,
|
||||||
bool singular ) const
|
std::string const & argumentType,
|
||||||
|
std::string const & argumentName ) const
|
||||||
{
|
{
|
||||||
std::string arguments = startLowerCase( stripPrefix( params.back().name, "p" ) );
|
std::string arguments = "*reinterpret_cast<" + argumentType + " *>( &" + argumentName + " )";
|
||||||
if ( singular )
|
|
||||||
{
|
|
||||||
arguments = stripPluralS( arguments );
|
|
||||||
}
|
|
||||||
assert( params.back().type.type.starts_with( "Vk" ) );
|
|
||||||
arguments = "*reinterpret_cast<" + params.back().type.type + " *>( &" + arguments + " )";
|
|
||||||
if ( handle.second.destructorIt != m_commands.end() )
|
if ( handle.second.destructorIt != m_commands.end() )
|
||||||
{
|
{
|
||||||
auto [parentType, parentName] = getParentTypeAndName( handle );
|
auto [parentType, parentName] = getParentTypeAndName( handle );
|
||||||
@ -10154,7 +10373,15 @@ std::string VulkanHppGenerator::generateReturnVariable( CommandData const &
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
returnVariable = startLowerCase( stripPrefix( commandData.params[returnParams[0]].name, "p" ) );
|
auto vectorParamIt = vectorParams.find( returnParams[0] );
|
||||||
|
if ( ( vectorParamIt != vectorParams.end() ) && vectorParamIt->second.byStructure )
|
||||||
|
{
|
||||||
|
returnVariable = startLowerCase( stripPrefix( vectorMemberByStructure( commandData.params[returnParams[0]].type.type ).name, "p" ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
returnVariable = startLowerCase( stripPrefix( commandData.params[returnParams[0]].name, "p" ) );
|
||||||
|
}
|
||||||
if ( singular )
|
if ( singular )
|
||||||
{
|
{
|
||||||
returnVariable = stripPluralS( returnVariable );
|
returnVariable = stripPluralS( returnVariable );
|
||||||
@ -11573,7 +11800,7 @@ std::string VulkanHppGenerator::generateSuccessCode( std::string const & code )
|
|||||||
std::string VulkanHppGenerator::generateSuccessCodeList( std::vector<std::string> const & successCodes, bool enumerating ) const
|
std::string VulkanHppGenerator::generateSuccessCodeList( std::vector<std::string> const & successCodes, bool enumerating ) const
|
||||||
{
|
{
|
||||||
std::string successCodeList;
|
std::string successCodeList;
|
||||||
size_t skipSize = enumerating ? 2 : 1;
|
size_t skipSize = ( enumerating && ( 1 < successCodes.size() ) && ( successCodes[1] == "VK_INCOMPLETE" ) ) ? 2 : 1;
|
||||||
if ( skipSize < successCodes.size() )
|
if ( skipSize < successCodes.size() )
|
||||||
{
|
{
|
||||||
successCodeList = ", { " + generateSuccessCode( successCodes[0] );
|
successCodeList = ", { " + generateSuccessCode( successCodes[0] );
|
||||||
@ -12232,41 +12459,52 @@ std::string VulkanHppGenerator::getVectorSize( std::vector<ParamData> const &
|
|||||||
std::string const & returnParamType,
|
std::string const & returnParamType,
|
||||||
std::set<size_t> const & templatedParams ) const
|
std::set<size_t> const & templatedParams ) const
|
||||||
{
|
{
|
||||||
std::string vectorSize;
|
std::string vectorSize;
|
||||||
std::vector<std::string> lenParts = tokenize( params[returnParam].lenExpression, "->" );
|
auto returnVectorIt = vectorParams.find( returnParam );
|
||||||
switch ( lenParts.size() )
|
assert( returnVectorIt != vectorParams.end() );
|
||||||
|
if ( returnVectorIt->second.byStructure )
|
||||||
{
|
{
|
||||||
case 1:
|
auto structIt = m_structs.find( params[returnParam].type.type );
|
||||||
{
|
assert( structIt != m_structs.end() );
|
||||||
std::string const & len = lenParts[0];
|
vectorSize = startLowerCase( stripPrefix( params[returnParam].name, "p" ) ) + "." + structIt->second.members[returnVectorIt->second.lenParam].name;
|
||||||
size_t lenIdx =
|
}
|
||||||
std::distance( params.begin(), std::find_if( params.begin(), params.end(), [&len]( ParamData const & pd ) { return pd.name == len; } ) );
|
else
|
||||||
assert( lenIdx < params.size() );
|
{
|
||||||
// look for the len, not being the len of the return param, but of an other vector param
|
std::vector<std::string> lenParts = tokenize( params[returnParam].lenExpression, "->" );
|
||||||
auto lenVectorParamIt =
|
switch ( lenParts.size() )
|
||||||
std::find_if( vectorParams.begin(),
|
{
|
||||||
vectorParams.end(),
|
case 1:
|
||||||
[&lenIdx, &returnParam]( auto const & vpi ) { return ( vpi.first != returnParam ) && ( vpi.second.lenParam == lenIdx ); } );
|
|
||||||
if ( lenVectorParamIt == vectorParams.end() )
|
|
||||||
{
|
{
|
||||||
vectorSize = lenParts[0];
|
std::string const & len = lenParts[0];
|
||||||
if ( templatedParams.contains( returnParam ) )
|
size_t lenIdx =
|
||||||
|
std::distance( params.begin(), std::find_if( params.begin(), params.end(), [&len]( ParamData const & pd ) { return pd.name == len; } ) );
|
||||||
|
assert( lenIdx < params.size() );
|
||||||
|
// look for the len, not being the len of the return param, but of an other vector param
|
||||||
|
auto lenVectorParamIt =
|
||||||
|
std::find_if( vectorParams.begin(),
|
||||||
|
vectorParams.end(),
|
||||||
|
[&lenIdx, &returnParam]( auto const & vpi ) { return ( vpi.first != returnParam ) && ( vpi.second.lenParam == lenIdx ); } );
|
||||||
|
if ( lenVectorParamIt == vectorParams.end() )
|
||||||
{
|
{
|
||||||
vectorSize += " / sizeof( " + returnParamType + " )";
|
vectorSize = lenParts[0];
|
||||||
|
if ( templatedParams.contains( returnParam ) )
|
||||||
|
{
|
||||||
|
vectorSize += " / sizeof( " + returnParamType + " )";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
assert( !templatedParams.contains( returnParam ) );
|
||||||
|
vectorSize = startLowerCase( stripPrefix( params[lenVectorParamIt->first].name, "p" ) ) + ".size()";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
break;
|
||||||
{
|
case 2:
|
||||||
assert( !templatedParams.contains( returnParam ) );
|
assert( vectorParams.contains( returnParam ) );
|
||||||
vectorSize = startLowerCase( stripPrefix( params[lenVectorParamIt->first].name, "p" ) ) + ".size()";
|
vectorSize = startLowerCase( stripPrefix( lenParts[0], "p" ) ) + "." + lenParts[1];
|
||||||
}
|
break;
|
||||||
}
|
default: assert( false ); break;
|
||||||
break;
|
}
|
||||||
case 2:
|
|
||||||
assert( vectorParams.contains( returnParam ) );
|
|
||||||
vectorSize = startLowerCase( stripPrefix( lenParts[0], "p" ) ) + "." + lenParts[1];
|
|
||||||
break;
|
|
||||||
default: assert( false ); break;
|
|
||||||
}
|
}
|
||||||
assert( !vectorSize.empty() );
|
assert( !vectorSize.empty() );
|
||||||
return vectorSize;
|
return vectorSize;
|
||||||
@ -12468,6 +12706,12 @@ bool VulkanHppGenerator::isHandleType( std::string const & type ) const
|
|||||||
return type.starts_with( "Vk" ) && ( findByNameOrAlias( m_handles, type ) != m_handles.end() );
|
return type.starts_with( "Vk" ) && ( findByNameOrAlias( m_handles, type ) != m_handles.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VulkanHppGenerator::isHandleTypeByStructure( std::string const & type ) const
|
||||||
|
{
|
||||||
|
auto structIt = m_structs.find( type );
|
||||||
|
return ( structIt != m_structs.end() ) && describesVector( structIt->second ) && isHandleType( structIt->second.members[3].type.type );
|
||||||
|
}
|
||||||
|
|
||||||
bool VulkanHppGenerator::isLenByStructMember( std::string const & name, std::vector<ParamData> const & params ) const
|
bool VulkanHppGenerator::isLenByStructMember( std::string const & name, std::vector<ParamData> const & params ) const
|
||||||
{
|
{
|
||||||
// check if name specifies a member of a struct
|
// check if name specifies a member of a struct
|
||||||
@ -15363,6 +15607,14 @@ std::string VulkanHppGenerator::toString( TypeCategory category )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VulkanHppGenerator::MemberData const & VulkanHppGenerator::vectorMemberByStructure( std::string const & structureType ) const
|
||||||
|
{
|
||||||
|
auto structIt = m_structs.find( structureType );
|
||||||
|
assert( structIt != m_structs.end() );
|
||||||
|
assert( describesVector( structIt->second ) );
|
||||||
|
return structIt->second.members.back();
|
||||||
|
}
|
||||||
|
|
||||||
void VulkanHppGenerator::EnumData::addEnumAlias( int line, std::string const & name, std::string const & alias, std::string const & protect, bool supported )
|
void VulkanHppGenerator::EnumData::addEnumAlias( int line, std::string const & name, std::string const & alias, std::string const & protect, bool supported )
|
||||||
{
|
{
|
||||||
auto aliasIt = findByName( valueAliases, name );
|
auto aliasIt = findByName( valueAliases, name );
|
||||||
|
@ -385,6 +385,7 @@ private:
|
|||||||
{
|
{
|
||||||
size_t lenParam = INVALID_INDEX;
|
size_t lenParam = INVALID_INDEX;
|
||||||
size_t strideParam = INVALID_INDEX;
|
size_t strideParam = INVALID_INDEX;
|
||||||
|
bool byStructure = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MacroVisitor final : tinyxml2::XMLVisitor
|
struct MacroVisitor final : tinyxml2::XMLVisitor
|
||||||
@ -450,6 +451,7 @@ private:
|
|||||||
bool containsFuncPointer( std::string const & type ) const;
|
bool containsFuncPointer( std::string const & type ) const;
|
||||||
bool containsFloatingPoints( std::vector<MemberData> const & members ) const;
|
bool containsFloatingPoints( std::vector<MemberData> const & members ) const;
|
||||||
bool containsUnion( std::string const & type ) const;
|
bool containsUnion( std::string const & type ) const;
|
||||||
|
bool describesVector( StructureData const & structure, std::string const & type = "" ) const;
|
||||||
std::vector<size_t> determineChainedReturnParams( std::vector<ParamData> const & params, std::vector<size_t> const & returnParams ) const;
|
std::vector<size_t> determineChainedReturnParams( std::vector<ParamData> const & params, std::vector<size_t> const & returnParams ) const;
|
||||||
std::vector<size_t> determineConstPointerParams( std::vector<ParamData> const & params ) const;
|
std::vector<size_t> determineConstPointerParams( std::vector<ParamData> const & params ) const;
|
||||||
std::vector<std::string> determineDataTypes( std::vector<VulkanHppGenerator::ParamData> const & params,
|
std::vector<std::string> determineDataTypes( std::vector<VulkanHppGenerator::ParamData> const & params,
|
||||||
@ -564,7 +566,7 @@ private:
|
|||||||
bool definition,
|
bool definition,
|
||||||
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,
|
||||||
CommandFlavourFlags flavourFlags = {} ) const;
|
CommandFlavourFlags flavourFlags ) const;
|
||||||
std::string generateCommandName( std::string const & vulkanCommandName,
|
std::string generateCommandName( std::string const & vulkanCommandName,
|
||||||
std::vector<ParamData> const & params,
|
std::vector<ParamData> const & params,
|
||||||
size_t initialSkipCount,
|
size_t initialSkipCount,
|
||||||
@ -695,7 +697,8 @@ private:
|
|||||||
std::map<size_t, VectorParamData> const & vectorParams,
|
std::map<size_t, VectorParamData> const & vectorParams,
|
||||||
std::set<size_t> const & templatedParams,
|
std::set<size_t> const & templatedParams,
|
||||||
CommandFlavourFlags flavourFlags,
|
CommandFlavourFlags flavourFlags,
|
||||||
bool enumerating ) const;
|
bool enumerating,
|
||||||
|
std::vector<std::string> const & dataTypes ) const;
|
||||||
std::string generateDataSizeChecks( CommandData const & commandData,
|
std::string generateDataSizeChecks( CommandData const & commandData,
|
||||||
std::vector<size_t> const & returnParams,
|
std::vector<size_t> const & returnParams,
|
||||||
std::vector<std::string> const & returnParamTypes,
|
std::vector<std::string> const & returnParamTypes,
|
||||||
@ -842,7 +845,8 @@ private:
|
|||||||
std::string generateRAIIHandles() const;
|
std::string generateRAIIHandles() const;
|
||||||
std::string generateRAIIHandleSingularConstructorArguments( std::pair<std::string, HandleData> const & handle,
|
std::string generateRAIIHandleSingularConstructorArguments( std::pair<std::string, HandleData> const & handle,
|
||||||
std::vector<ParamData> const & params,
|
std::vector<ParamData> const & params,
|
||||||
bool singular ) const;
|
std::string const & argumentType,
|
||||||
|
std::string const & argumentName ) const;
|
||||||
template <class Predicate, class Extraction>
|
template <class Predicate, class Extraction>
|
||||||
std::string generateReplacedExtensionsList( Predicate p, Extraction e ) const;
|
std::string generateReplacedExtensionsList( Predicate p, Extraction e ) const;
|
||||||
std::string generateResultAssignment( CommandData const & commandData ) const;
|
std::string generateResultAssignment( CommandData const & commandData ) const;
|
||||||
@ -938,12 +942,15 @@ private:
|
|||||||
bool handleRemovalType( std::string const & type, std::vector<RequireData> & requireData );
|
bool handleRemovalType( std::string const & type, std::vector<RequireData> & requireData );
|
||||||
bool hasLen( MemberData const & md, std::vector<MemberData> const & members ) const;
|
bool hasLen( MemberData const & md, std::vector<MemberData> const & members ) const;
|
||||||
bool hasParentHandle( std::string const & handle, std::string const & parent ) const;
|
bool hasParentHandle( std::string const & handle, std::string const & parent ) const;
|
||||||
bool isDeviceCommand( CommandData const & commandData ) const;
|
bool isConstructorCandidate( std::pair<std::string, VulkanHppGenerator::CommandData> const & command, std::string const & handleType ) const;
|
||||||
bool isExtension( std::string const & name ) const;
|
bool isConstructorCandidate( ParamData const & paramData, std::string const & handleType ) const;
|
||||||
bool isFeature( std::string const & name ) const;
|
bool isDeviceCommand( CommandData const & commandData ) const;
|
||||||
bool isHandleType( std::string const & type ) const;
|
bool isExtension( std::string const & name ) const;
|
||||||
bool isLenByStructMember( std::string const & name, std::vector<ParamData> const & params ) const;
|
bool isFeature( std::string const & name ) const;
|
||||||
bool isLenByStructMember( std::string const & name, ParamData const & param ) const;
|
bool isHandleType( std::string const & type ) const;
|
||||||
|
bool isHandleTypeByStructure( std::string const & type ) const;
|
||||||
|
bool isLenByStructMember( std::string const & name, std::vector<ParamData> const & params ) const;
|
||||||
|
bool isLenByStructMember( std::string const & name, ParamData const & param ) const;
|
||||||
bool isMultiSuccessCodeConstructor( std::vector<std::map<std::string, CommandData>::const_iterator> const & constructorIts ) const;
|
bool isMultiSuccessCodeConstructor( std::vector<std::map<std::string, CommandData>::const_iterator> const & constructorIts ) const;
|
||||||
bool isParam( std::string const & name, std::vector<ParamData> const & params ) const;
|
bool isParam( std::string const & name, std::vector<ParamData> const & params ) const;
|
||||||
bool isStructMember( std::string const & name, std::vector<MemberData> const & memberData ) const;
|
bool isStructMember( std::string const & name, std::vector<MemberData> const & memberData ) const;
|
||||||
@ -1033,6 +1040,7 @@ private:
|
|||||||
bool skipLeadingGrandParent( std::pair<std::string, HandleData> const & handle ) const;
|
bool skipLeadingGrandParent( std::pair<std::string, HandleData> const & handle ) const;
|
||||||
std::string stripPluralS( std::string const & name ) const;
|
std::string stripPluralS( std::string const & name ) const;
|
||||||
std::string toString( TypeCategory category );
|
std::string toString( TypeCategory category );
|
||||||
|
MemberData const & vectorMemberByStructure( std::string const & structureType ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_api;
|
std::string m_api;
|
||||||
|
@ -25908,19 +25908,48 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
#ifndef VULKAN_HPP_DISABLE_ENHANCED_MODE
|
||||||
template <typename Dispatch>
|
template <typename LatencyTimingsFrameReportNVAllocator, typename Dispatch>
|
||||||
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::GetLatencyMarkerInfoNV
|
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<VULKAN_HPP_NAMESPACE::LatencyTimingsFrameReportNV, LatencyTimingsFrameReportNVAllocator>
|
||||||
Device::getLatencyTimingsNV( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT
|
Device::getLatencyTimingsNV( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, Dispatch const & d ) const
|
||||||
{
|
{
|
||||||
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
|
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
|
||||||
# if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
|
# if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
|
||||||
VULKAN_HPP_ASSERT( d.vkGetLatencyTimingsNV && "Function <vkGetLatencyTimingsNV> requires <VK_NV_low_latency2>" );
|
VULKAN_HPP_ASSERT( d.vkGetLatencyTimingsNV && "Function <vkGetLatencyTimingsNV> requires <VK_NV_low_latency2>" );
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
VULKAN_HPP_NAMESPACE::GetLatencyMarkerInfoNV latencyMarkerInfo;
|
std::vector<VULKAN_HPP_NAMESPACE::LatencyTimingsFrameReportNV, LatencyTimingsFrameReportNVAllocator> timings;
|
||||||
|
VULKAN_HPP_NAMESPACE::GetLatencyMarkerInfoNV latencyMarkerInfo;
|
||||||
|
d.vkGetLatencyTimingsNV( m_device, static_cast<VkSwapchainKHR>( swapchain ), reinterpret_cast<VkGetLatencyMarkerInfoNV *>( &latencyMarkerInfo ) );
|
||||||
|
timings.resize( latencyMarkerInfo.timingCount );
|
||||||
|
latencyMarkerInfo.pTimings = timings.data();
|
||||||
d.vkGetLatencyTimingsNV( m_device, static_cast<VkSwapchainKHR>( swapchain ), reinterpret_cast<VkGetLatencyMarkerInfoNV *>( &latencyMarkerInfo ) );
|
d.vkGetLatencyTimingsNV( m_device, static_cast<VkSwapchainKHR>( swapchain ), reinterpret_cast<VkGetLatencyMarkerInfoNV *>( &latencyMarkerInfo ) );
|
||||||
|
|
||||||
return latencyMarkerInfo;
|
return timings;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
typename LatencyTimingsFrameReportNVAllocator,
|
||||||
|
typename Dispatch,
|
||||||
|
typename std::enable_if<std::is_same<typename LatencyTimingsFrameReportNVAllocator::value_type, VULKAN_HPP_NAMESPACE::LatencyTimingsFrameReportNV>::value,
|
||||||
|
int>::type>
|
||||||
|
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<VULKAN_HPP_NAMESPACE::LatencyTimingsFrameReportNV, LatencyTimingsFrameReportNVAllocator>
|
||||||
|
Device::getLatencyTimingsNV( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain,
|
||||||
|
LatencyTimingsFrameReportNVAllocator & latencyTimingsFrameReportNVAllocator,
|
||||||
|
Dispatch const & d ) const
|
||||||
|
{
|
||||||
|
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
|
||||||
|
# if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
|
||||||
|
VULKAN_HPP_ASSERT( d.vkGetLatencyTimingsNV && "Function <vkGetLatencyTimingsNV> requires <VK_NV_low_latency2>" );
|
||||||
|
# endif
|
||||||
|
|
||||||
|
std::vector<VULKAN_HPP_NAMESPACE::LatencyTimingsFrameReportNV, LatencyTimingsFrameReportNVAllocator> timings( latencyTimingsFrameReportNVAllocator );
|
||||||
|
VULKAN_HPP_NAMESPACE::GetLatencyMarkerInfoNV latencyMarkerInfo;
|
||||||
|
d.vkGetLatencyTimingsNV( m_device, static_cast<VkSwapchainKHR>( swapchain ), reinterpret_cast<VkGetLatencyMarkerInfoNV *>( &latencyMarkerInfo ) );
|
||||||
|
timings.resize( latencyMarkerInfo.timingCount );
|
||||||
|
latencyMarkerInfo.pTimings = timings.data();
|
||||||
|
d.vkGetLatencyTimingsNV( m_device, static_cast<VkSwapchainKHR>( swapchain ), reinterpret_cast<VkGetLatencyMarkerInfoNV *>( &latencyMarkerInfo ) );
|
||||||
|
|
||||||
|
return timings;
|
||||||
}
|
}
|
||||||
#endif /* VULKAN_HPP_DISABLE_ENHANCED_MODE */
|
#endif /* VULKAN_HPP_DISABLE_ENHANCED_MODE */
|
||||||
|
|
||||||
|
@ -14470,10 +14470,19 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
VULKAN_HPP_NAMESPACE::GetLatencyMarkerInfoNV * pLatencyMarkerInfo,
|
VULKAN_HPP_NAMESPACE::GetLatencyMarkerInfoNV * pLatencyMarkerInfo,
|
||||||
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 Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
|
template <typename LatencyTimingsFrameReportNVAllocator = std::allocator<VULKAN_HPP_NAMESPACE::LatencyTimingsFrameReportNV>,
|
||||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::GetLatencyMarkerInfoNV
|
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE>
|
||||||
getLatencyTimingsNV( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain,
|
VULKAN_HPP_NODISCARD std::vector<VULKAN_HPP_NAMESPACE::LatencyTimingsFrameReportNV, LatencyTimingsFrameReportNVAllocator>
|
||||||
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
|
getLatencyTimingsNV( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
|
||||||
|
template <
|
||||||
|
typename LatencyTimingsFrameReportNVAllocator = std::allocator<VULKAN_HPP_NAMESPACE::LatencyTimingsFrameReportNV>,
|
||||||
|
typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE,
|
||||||
|
typename std::enable_if<std::is_same<typename LatencyTimingsFrameReportNVAllocator::value_type, VULKAN_HPP_NAMESPACE::LatencyTimingsFrameReportNV>::value,
|
||||||
|
int>::type = 0>
|
||||||
|
VULKAN_HPP_NODISCARD std::vector<VULKAN_HPP_NAMESPACE::LatencyTimingsFrameReportNV, LatencyTimingsFrameReportNVAllocator>
|
||||||
|
getLatencyTimingsNV( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain,
|
||||||
|
LatencyTimingsFrameReportNVAllocator & latencyTimingsFrameReportNVAllocator,
|
||||||
|
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
|
||||||
#endif /* VULKAN_HPP_DISABLE_ENHANCED_MODE */
|
#endif /* VULKAN_HPP_DISABLE_ENHANCED_MODE */
|
||||||
|
|
||||||
#if defined( VK_USE_PLATFORM_SCREEN_QNX )
|
#if defined( VK_USE_PLATFORM_SCREEN_QNX )
|
||||||
|
@ -11501,7 +11501,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
|
|
||||||
void setLatencyMarkerNV( const VULKAN_HPP_NAMESPACE::SetLatencyMarkerInfoNV & latencyMarkerInfo ) const VULKAN_HPP_NOEXCEPT;
|
void setLatencyMarkerNV( const VULKAN_HPP_NAMESPACE::SetLatencyMarkerInfoNV & latencyMarkerInfo ) const VULKAN_HPP_NOEXCEPT;
|
||||||
|
|
||||||
VULKAN_HPP_NODISCARD VULKAN_HPP_NAMESPACE::GetLatencyMarkerInfoNV getLatencyTimingsNV() const VULKAN_HPP_NOEXCEPT;
|
VULKAN_HPP_NODISCARD std::vector<VULKAN_HPP_NAMESPACE::LatencyTimingsFrameReportNV> getLatencyTimingsNV() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VULKAN_HPP_NAMESPACE::Device m_device = {};
|
VULKAN_HPP_NAMESPACE::Device m_device = {};
|
||||||
@ -22699,15 +22699,20 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
reinterpret_cast<const VkSetLatencyMarkerInfoNV *>( &latencyMarkerInfo ) );
|
reinterpret_cast<const VkSetLatencyMarkerInfoNV *>( &latencyMarkerInfo ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE VULKAN_HPP_NAMESPACE::GetLatencyMarkerInfoNV SwapchainKHR::getLatencyTimingsNV() const VULKAN_HPP_NOEXCEPT
|
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::vector<VULKAN_HPP_NAMESPACE::LatencyTimingsFrameReportNV> SwapchainKHR::getLatencyTimingsNV() const
|
||||||
{
|
{
|
||||||
VULKAN_HPP_ASSERT( getDispatcher()->vkGetLatencyTimingsNV && "Function <vkGetLatencyTimingsNV> requires <VK_NV_low_latency2>" );
|
VULKAN_HPP_ASSERT( getDispatcher()->vkGetLatencyTimingsNV && "Function <vkGetLatencyTimingsNV> requires <VK_NV_low_latency2>" );
|
||||||
|
|
||||||
VULKAN_HPP_NAMESPACE::GetLatencyMarkerInfoNV latencyMarkerInfo;
|
std::vector<VULKAN_HPP_NAMESPACE::LatencyTimingsFrameReportNV> timings;
|
||||||
|
VULKAN_HPP_NAMESPACE::GetLatencyMarkerInfoNV latencyMarkerInfo;
|
||||||
|
getDispatcher()->vkGetLatencyTimingsNV(
|
||||||
|
static_cast<VkDevice>( m_device ), static_cast<VkSwapchainKHR>( m_swapchain ), reinterpret_cast<VkGetLatencyMarkerInfoNV *>( &latencyMarkerInfo ) );
|
||||||
|
timings.resize( latencyMarkerInfo.timingCount );
|
||||||
|
latencyMarkerInfo.pTimings = timings.data();
|
||||||
getDispatcher()->vkGetLatencyTimingsNV(
|
getDispatcher()->vkGetLatencyTimingsNV(
|
||||||
static_cast<VkDevice>( m_device ), static_cast<VkSwapchainKHR>( m_swapchain ), reinterpret_cast<VkGetLatencyMarkerInfoNV *>( &latencyMarkerInfo ) );
|
static_cast<VkDevice>( m_device ), static_cast<VkSwapchainKHR>( m_swapchain ), reinterpret_cast<VkGetLatencyMarkerInfoNV *>( &latencyMarkerInfo ) );
|
||||||
|
|
||||||
return latencyMarkerInfo;
|
return timings;
|
||||||
}
|
}
|
||||||
|
|
||||||
VULKAN_HPP_INLINE void Queue::notifyOutOfBandNV( const VULKAN_HPP_NAMESPACE::OutOfBandQueueTypeInfoNV & queueTypeInfo ) const VULKAN_HPP_NOEXCEPT
|
VULKAN_HPP_INLINE void Queue::notifyOutOfBandNV( const VULKAN_HPP_NAMESPACE::OutOfBandQueueTypeInfoNV & queueTypeInfo ) const VULKAN_HPP_NOEXCEPT
|
||||||
|
Loading…
Reference in New Issue
Block a user