mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Combine two types of commands into one generation function
This commit is contained in:
parent
b95c02b89d
commit
cb4a573b42
@ -6776,8 +6776,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
|
||||
if ( commandIt->second.params[vectorParams.begin()->second].type.type == "size_t" )
|
||||
{
|
||||
str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, false, false );
|
||||
str +=
|
||||
generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoidSingular( commandIt, initialSkipCount, vectorParams, returnParam, definition );
|
||||
str += generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, false, true );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -6791,8 +6790,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
|
||||
if ( commandIt->second.params[std::next( vectorParams.begin() )->second].type.type == "size_t" )
|
||||
{
|
||||
str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, false, false );
|
||||
str += generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoidSingular(
|
||||
commandIt, initialSkipCount, vectorParams, returnParam, definition );
|
||||
str += generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, false, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6847,70 +6845,6 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string
|
||||
VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoidSingular( std::map<std::string, CommandData>::const_iterator commandIt,
|
||||
size_t initialSkipCount,
|
||||
std::map<size_t, size_t> const & vectorParams,
|
||||
size_t returnParam,
|
||||
bool definition ) const
|
||||
{
|
||||
std::set<size_t> skippedParams = determineSkippedParams( commandIt->second.params, initialSkipCount, vectorParams, { returnParam }, true );
|
||||
std::set<size_t> singularParams = determineSingularParams( returnParam, vectorParams );
|
||||
std::string argumentList = generateArgumentListEnhanced(
|
||||
commandIt->second.params, { returnParam }, vectorParams, skippedParams, singularParams, { returnParam }, definition, false, false, false );
|
||||
std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags, true, false );
|
||||
std::string argumentTemplates = generateArgumentTemplates( commandIt->second.params, { returnParam }, vectorParams, { returnParam }, false, true );
|
||||
std::string dataType = stripPrefix( commandIt->second.params[returnParam].name, "p" ) + "Type";
|
||||
|
||||
if ( definition )
|
||||
{
|
||||
std::string const singularDefinitionTemplate =
|
||||
R"(
|
||||
${argumentTemplates}
|
||||
VULKAN_HPP_NODISCARD ${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 ${dataName};
|
||||
}
|
||||
)";
|
||||
|
||||
std::string callArguments = generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, singularParams, {}, true );
|
||||
std::string dataName = startLowerCase( stripPrefix( commandIt->second.params[returnParam].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 ${dataType} ${commandName}( ${argumentList} ) const;
|
||||
)";
|
||||
|
||||
return replaceWithMap( singularDeclarationTemplate,
|
||||
{
|
||||
{ "argumentList", argumentList },
|
||||
{ "argumentTemplates", argumentTemplates },
|
||||
{ "commandName", commandName },
|
||||
{ "dataType", dataType },
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWithErrors2Return( std::map<std::string, CommandData>::const_iterator commandIt,
|
||||
size_t initialSkipCount,
|
||||
bool definition,
|
||||
|
@ -736,11 +736,6 @@ private:
|
||||
size_t initialSkipCount,
|
||||
bool definition,
|
||||
size_t returnParam ) const;
|
||||
std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnVoidSingular( std::map<std::string, CommandData>::const_iterator commandIt,
|
||||
size_t initialSkipCount,
|
||||
std::map<size_t, size_t> const & vectorParamIndices,
|
||||
size_t returnParam,
|
||||
bool definition ) const;
|
||||
std::string generateRAIIHandleCommandResultSingleSuccessWithErrors2Return( std::map<std::string, CommandData>::const_iterator commandIt,
|
||||
size_t initialSkipCount,
|
||||
bool definition,
|
||||
|
@ -14827,24 +14827,25 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
}
|
||||
|
||||
template <typename DataType>
|
||||
VULKAN_HPP_NODISCARD DataType
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE DataType
|
||||
Device::writeAccelerationStructuresPropertyKHR( ArrayProxy<const VULKAN_HPP_NAMESPACE::AccelerationStructureKHR> const & accelerationStructures,
|
||||
VULKAN_HPP_NAMESPACE::QueryType queryType,
|
||||
size_t stride ) const
|
||||
{
|
||||
VULKAN_HPP_ASSERT( getDispatcher()->vkWriteAccelerationStructuresPropertiesKHR &&
|
||||
"Function <vkWriteAccelerationStructuresPropertiesKHR> needs extension <VK_KHR_acceleration_structure> enabled!" );
|
||||
|
||||
DataType data;
|
||||
Result result = static_cast<Result>(
|
||||
VkResult result =
|
||||
getDispatcher()->vkWriteAccelerationStructuresPropertiesKHR( static_cast<VkDevice>( m_device ),
|
||||
accelerationStructures.size(),
|
||||
reinterpret_cast<const VkAccelerationStructureKHR *>( accelerationStructures.data() ),
|
||||
static_cast<VkQueryType>( queryType ),
|
||||
sizeof( DataType ),
|
||||
reinterpret_cast<void *>( &data ),
|
||||
stride ) );
|
||||
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
|
||||
{
|
||||
throwResultException( result, VULKAN_HPP_NAMESPACE_STRING "::Device::writeAccelerationStructuresPropertyKHR" );
|
||||
}
|
||||
stride );
|
||||
resultCheck( static_cast<VULKAN_HPP_NAMESPACE::Result>( result ), VULKAN_HPP_NAMESPACE_STRING "::Device::writeAccelerationStructuresPropertyKHR" );
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -15243,19 +15244,20 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
}
|
||||
|
||||
template <typename DataType>
|
||||
VULKAN_HPP_NODISCARD DataType Pipeline::getRayTracingShaderGroupHandleNV( uint32_t firstGroup, uint32_t groupCount ) const
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE DataType Pipeline::getRayTracingShaderGroupHandleNV( uint32_t firstGroup, uint32_t groupCount ) const
|
||||
{
|
||||
VULKAN_HPP_ASSERT( getDispatcher()->vkGetRayTracingShaderGroupHandlesNV &&
|
||||
"Function <vkGetRayTracingShaderGroupHandlesNV> needs extension <VK_NV_ray_tracing> enabled!" );
|
||||
|
||||
DataType data;
|
||||
Result result = static_cast<Result>( getDispatcher()->vkGetRayTracingShaderGroupHandlesNV( static_cast<VkDevice>( m_device ),
|
||||
static_cast<VkPipeline>( m_pipeline ),
|
||||
firstGroup,
|
||||
groupCount,
|
||||
sizeof( DataType ),
|
||||
reinterpret_cast<void *>( &data ) ) );
|
||||
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
|
||||
{
|
||||
throwResultException( result, VULKAN_HPP_NAMESPACE_STRING "::Pipeline::getRayTracingShaderGroupHandleNV" );
|
||||
}
|
||||
VkResult result = getDispatcher()->vkGetRayTracingShaderGroupHandlesNV( static_cast<VkDevice>( m_device ),
|
||||
static_cast<VkPipeline>( m_pipeline ),
|
||||
firstGroup,
|
||||
groupCount,
|
||||
sizeof( DataType ),
|
||||
reinterpret_cast<void *>( &data ) );
|
||||
resultCheck( static_cast<VULKAN_HPP_NAMESPACE::Result>( result ), VULKAN_HPP_NAMESPACE_STRING "::Pipeline::getRayTracingShaderGroupHandleNV" );
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -15277,18 +15279,18 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
}
|
||||
|
||||
template <typename DataType>
|
||||
VULKAN_HPP_NODISCARD DataType AccelerationStructureNV::getHandle() const
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE DataType AccelerationStructureNV::getHandle() const
|
||||
{
|
||||
VULKAN_HPP_ASSERT( getDispatcher()->vkGetAccelerationStructureHandleNV &&
|
||||
"Function <vkGetAccelerationStructureHandleNV> needs extension <VK_NV_ray_tracing> enabled!" );
|
||||
|
||||
DataType data;
|
||||
Result result =
|
||||
static_cast<Result>( getDispatcher()->vkGetAccelerationStructureHandleNV( static_cast<VkDevice>( m_device ),
|
||||
static_cast<VkAccelerationStructureNV>( m_accelerationStructure ),
|
||||
sizeof( DataType ),
|
||||
reinterpret_cast<void *>( &data ) ) );
|
||||
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
|
||||
{
|
||||
throwResultException( result, VULKAN_HPP_NAMESPACE_STRING "::AccelerationStructureNV::getHandle" );
|
||||
}
|
||||
VkResult result = getDispatcher()->vkGetAccelerationStructureHandleNV( static_cast<VkDevice>( m_device ),
|
||||
static_cast<VkAccelerationStructureNV>( m_accelerationStructure ),
|
||||
sizeof( DataType ),
|
||||
reinterpret_cast<void *>( &data ) );
|
||||
resultCheck( static_cast<VULKAN_HPP_NAMESPACE::Result>( result ), VULKAN_HPP_NAMESPACE_STRING "::AccelerationStructureNV::getHandle" );
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -16769,19 +16771,20 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
}
|
||||
|
||||
template <typename DataType>
|
||||
VULKAN_HPP_NODISCARD DataType Pipeline::getRayTracingShaderGroupHandleKHR( uint32_t firstGroup, uint32_t groupCount ) const
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE DataType Pipeline::getRayTracingShaderGroupHandleKHR( uint32_t firstGroup, uint32_t groupCount ) const
|
||||
{
|
||||
VULKAN_HPP_ASSERT( getDispatcher()->vkGetRayTracingShaderGroupHandlesKHR &&
|
||||
"Function <vkGetRayTracingShaderGroupHandlesKHR> needs extension <VK_KHR_ray_tracing_pipeline> enabled!" );
|
||||
|
||||
DataType data;
|
||||
Result result = static_cast<Result>( getDispatcher()->vkGetRayTracingShaderGroupHandlesKHR( static_cast<VkDevice>( m_device ),
|
||||
static_cast<VkPipeline>( m_pipeline ),
|
||||
firstGroup,
|
||||
groupCount,
|
||||
sizeof( DataType ),
|
||||
reinterpret_cast<void *>( &data ) ) );
|
||||
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
|
||||
{
|
||||
throwResultException( result, VULKAN_HPP_NAMESPACE_STRING "::Pipeline::getRayTracingShaderGroupHandleKHR" );
|
||||
}
|
||||
VkResult result = getDispatcher()->vkGetRayTracingShaderGroupHandlesKHR( static_cast<VkDevice>( m_device ),
|
||||
static_cast<VkPipeline>( m_pipeline ),
|
||||
firstGroup,
|
||||
groupCount,
|
||||
sizeof( DataType ),
|
||||
reinterpret_cast<void *>( &data ) );
|
||||
resultCheck( static_cast<VULKAN_HPP_NAMESPACE::Result>( result ), VULKAN_HPP_NAMESPACE_STRING "::Pipeline::getRayTracingShaderGroupHandleKHR" );
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -16807,19 +16810,21 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
}
|
||||
|
||||
template <typename DataType>
|
||||
VULKAN_HPP_NODISCARD DataType Pipeline::getRayTracingCaptureReplayShaderGroupHandleKHR( uint32_t firstGroup, uint32_t groupCount ) const
|
||||
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE DataType Pipeline::getRayTracingCaptureReplayShaderGroupHandleKHR( uint32_t firstGroup, uint32_t groupCount ) const
|
||||
{
|
||||
VULKAN_HPP_ASSERT( getDispatcher()->vkGetRayTracingCaptureReplayShaderGroupHandlesKHR &&
|
||||
"Function <vkGetRayTracingCaptureReplayShaderGroupHandlesKHR> needs extension <VK_KHR_ray_tracing_pipeline> enabled!" );
|
||||
|
||||
DataType data;
|
||||
Result result = static_cast<Result>( getDispatcher()->vkGetRayTracingCaptureReplayShaderGroupHandlesKHR( static_cast<VkDevice>( m_device ),
|
||||
static_cast<VkPipeline>( m_pipeline ),
|
||||
firstGroup,
|
||||
groupCount,
|
||||
sizeof( DataType ),
|
||||
reinterpret_cast<void *>( &data ) ) );
|
||||
if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess )
|
||||
{
|
||||
throwResultException( result, VULKAN_HPP_NAMESPACE_STRING "::Pipeline::getRayTracingCaptureReplayShaderGroupHandleKHR" );
|
||||
}
|
||||
VkResult result = getDispatcher()->vkGetRayTracingCaptureReplayShaderGroupHandlesKHR( static_cast<VkDevice>( m_device ),
|
||||
static_cast<VkPipeline>( m_pipeline ),
|
||||
firstGroup,
|
||||
groupCount,
|
||||
sizeof( DataType ),
|
||||
reinterpret_cast<void *>( &data ) );
|
||||
resultCheck( static_cast<VULKAN_HPP_NAMESPACE::Result>( result ),
|
||||
VULKAN_HPP_NAMESPACE_STRING "::Pipeline::getRayTracingCaptureReplayShaderGroupHandleKHR" );
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user