mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Merge pull request #1370 from asuessenbach/function
Combine two types of commands into one generation function
This commit is contained in:
commit
b95c02b89d
@ -6615,8 +6615,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
|
||||
if ( commandIt->second.params[vectorParams.begin()->second].type.type == "size_t" )
|
||||
{
|
||||
str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, false, false );
|
||||
str +=
|
||||
generateRAIIHandleCommandResultMultiSuccessWithErrors1ReturnVoidSingular( commandIt, initialSkipCount, vectorParams, { returnParam }, definition );
|
||||
str += generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, false, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6650,69 +6649,6 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithE
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string
|
||||
VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithErrors1ReturnVoidSingular( std::map<std::string, CommandData>::const_iterator commandIt,
|
||||
size_t initialSkipCount,
|
||||
std::map<size_t, size_t> const & vectorParams,
|
||||
std::vector<size_t> const & returnParams,
|
||||
bool definition ) const
|
||||
{
|
||||
assert( returnParams.size() == 1 );
|
||||
std::set<size_t> skippedParams = determineSkippedParams( commandIt->second.params, initialSkipCount, vectorParams, returnParams, true );
|
||||
std::set<size_t> singularParams = determineSingularParams( returnParams[0], vectorParams );
|
||||
std::set<size_t> templatedParams = determineVoidPointerParams( commandIt->second.params );
|
||||
assert( templatedParams.size() == 1 );
|
||||
std::string argumentList = generateArgumentListEnhanced(
|
||||
commandIt->second.params, returnParams, vectorParams, skippedParams, singularParams, templatedParams, definition, false, false, false );
|
||||
std::string argumentTemplates = generateArgumentTemplates( commandIt->second.params, returnParams, vectorParams, templatedParams, false, true );
|
||||
std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags, true, false );
|
||||
std::string dataType = stripPrefix( commandIt->second.params[*templatedParams.begin()].name, "p" ) + "Type";
|
||||
|
||||
if ( definition )
|
||||
{
|
||||
std::string const singularDefinitionTemplate =
|
||||
R"(
|
||||
${argumentTemplates}
|
||||
VULKAN_HPP_NODISCARD std::pair<VULKAN_HPP_NAMESPACE::Result, ${dataType}> ${className}::${commandName}( ${argumentList} ) const
|
||||
{
|
||||
${dataType} ${dataName};
|
||||
Result result = static_cast<Result>( getDispatcher()->${vkCommand}( ${callArguments} ) );
|
||||
if ( ${failureCheck} )
|
||||
{
|
||||
throwResultException( result, VULKAN_HPP_NAMESPACE_STRING"::${className}::${commandName}" );
|
||||
}
|
||||
return std::make_pair( result, ${dataName} );
|
||||
}
|
||||
)";
|
||||
|
||||
std::string callArguments = generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, singularParams, {}, true );
|
||||
std::string dataName = startLowerCase( stripPrefix( commandIt->second.params[returnParams[0]].name, "p" ) );
|
||||
|
||||
return replaceWithMap( singularDefinitionTemplate,
|
||||
{ { "argumentList", argumentList },
|
||||
{ "argumentTemplates", argumentTemplates },
|
||||
{ "callArguments", callArguments },
|
||||
{ "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) },
|
||||
{ "commandName", commandName },
|
||||
{ "dataName", dataName },
|
||||
{ "dataType", dataType },
|
||||
{ "failureCheck", generateFailureCheck( commandIt->second.successCodes ) },
|
||||
{ "vkCommand", commandIt->first } } );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string const singularDeclarationTemplate =
|
||||
R"(
|
||||
${argumentTemplates}
|
||||
VULKAN_HPP_NODISCARD std::pair<VULKAN_HPP_NAMESPACE::Result, ${dataType}> ${commandName}( ${argumentList} ) const;
|
||||
)";
|
||||
|
||||
return replaceWithMap(
|
||||
singularDeclarationTemplate,
|
||||
{ { "argumentList", argumentList }, { "argumentTemplates", argumentTemplates }, { "commandName", commandName }, { "dataType", dataType } } );
|
||||
}
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::generateRAIIHandleCommandResultMultiSuccessWithErrors2Return( std::map<std::string, CommandData>::const_iterator commandIt,
|
||||
size_t initialSkipCount,
|
||||
bool definition,
|
||||
|
@ -718,11 +718,6 @@ private:
|
||||
size_t initialSkipCount,
|
||||
bool definition,
|
||||
size_t returnParam ) const;
|
||||
std::string generateRAIIHandleCommandResultMultiSuccessWithErrors1ReturnVoidSingular( std::map<std::string, CommandData>::const_iterator commandIt,
|
||||
size_t initialSkipCount,
|
||||
std::map<size_t, size_t> const & vectorParamIndices,
|
||||
std::vector<size_t> const & returnParamIndices,
|
||||
bool definition ) const;
|
||||
std::string generateRAIIHandleCommandResultMultiSuccessWithErrors2Return( std::map<std::string, CommandData>::const_iterator commandIt,
|
||||
size_t initialSkipCount,
|
||||
bool definition,
|
||||
|
@ -10678,25 +10678,23 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
}
|
||||
|
||||
template <typename DataType>
|
||||
VULKAN_HPP_NODISCARD std::pair<VULKAN_HPP_NAMESPACE::Result, DataType> QueryPool::getResult( uint32_t firstQuery,
|
||||
uint32_t queryCount,
|
||||
VULKAN_HPP_NAMESPACE::DeviceSize stride,
|
||||
VULKAN_HPP_NAMESPACE::QueryResultFlags flags ) const
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE std::pair<VULKAN_HPP_NAMESPACE::Result, DataType> QueryPool::getResult(
|
||||
uint32_t firstQuery, uint32_t queryCount, VULKAN_HPP_NAMESPACE::DeviceSize stride, VULKAN_HPP_NAMESPACE::QueryResultFlags flags ) const
|
||||
{
|
||||
DataType data;
|
||||
Result result = static_cast<Result>( getDispatcher()->vkGetQueryPoolResults( static_cast<VkDevice>( m_device ),
|
||||
static_cast<VkQueryPool>( m_queryPool ),
|
||||
firstQuery,
|
||||
queryCount,
|
||||
sizeof( DataType ),
|
||||
reinterpret_cast<void *>( &data ),
|
||||
static_cast<VkDeviceSize>( stride ),
|
||||
static_cast<VkQueryResultFlags>( flags ) ) );
|
||||
if ( ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess ) && ( result != VULKAN_HPP_NAMESPACE::Result::eNotReady ) )
|
||||
{
|
||||
throwResultException( result, VULKAN_HPP_NAMESPACE_STRING "::QueryPool::getResult" );
|
||||
}
|
||||
return std::make_pair( result, data );
|
||||
VkResult result = getDispatcher()->vkGetQueryPoolResults( static_cast<VkDevice>( m_device ),
|
||||
static_cast<VkQueryPool>( m_queryPool ),
|
||||
firstQuery,
|
||||
queryCount,
|
||||
sizeof( DataType ),
|
||||
reinterpret_cast<void *>( &data ),
|
||||
static_cast<VkDeviceSize>( stride ),
|
||||
static_cast<VkQueryResultFlags>( flags ) );
|
||||
resultCheck( static_cast<VULKAN_HPP_NAMESPACE::Result>( result ),
|
||||
VULKAN_HPP_NAMESPACE_STRING "::QueryPool::getResult",
|
||||
{ VULKAN_HPP_NAMESPACE::Result::eSuccess, VULKAN_HPP_NAMESPACE::Result::eNotReady } );
|
||||
|
||||
return std::make_pair( static_cast<VULKAN_HPP_NAMESPACE::Result>( result ), data );
|
||||
}
|
||||
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE VULKAN_HPP_RAII_NAMESPACE::Buffer
|
||||
|
Loading…
Reference in New Issue
Block a user