diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 3d44e9a..21e1f0a 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -6816,66 +6816,6 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith return ""; } -std::string - VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnChain( std::map::const_iterator commandIt, - size_t initialSkipCount, - std::map const & vectorParams, - std::vector const & returnParams, - bool definition ) const -{ - std::set skippedParams = determineSkippedParams( commandIt->second.params, initialSkipCount, vectorParams, returnParams, false ); - std::string argumentList = - generateArgumentListEnhanced( commandIt->second.params, returnParams, vectorParams, skippedParams, {}, {}, definition, false, false, false ); - std::string commandName = generateCommandName( commandIt->first, commandIt->second.params, initialSkipCount, m_tags, false, false ); - - if ( definition ) - { - std::string const functionTemplate = - R"( - template - VULKAN_HPP_NODISCARD StructureChain ${className}::${commandName}( ${argumentList} ) const - { - StructureChain structureChain; - ${returnType} & ${returnVariable} = structureChain.template get<${returnType}>(); - VULKAN_HPP_NAMESPACE::Result result = static_cast( getDispatcher()->${vkCommand}( ${callArguments} ) ); - if ( ${failureCheck} ) - { - throwResultException( result, VULKAN_HPP_NAMESPACE_STRING"::${className}::${commandName}" ); - } - return structureChain; - } -)"; - - std::string callArguments = generateCallArgumentsEnhanced( commandIt->second, initialSkipCount, false, {}, {}, true ); - std::string returnType = stripPostfix( commandIt->second.params[returnParams[0]].type.compose( "VULKAN_HPP_NAMESPACE" ), "*" ); - std::string returnVariable = startLowerCase( stripPrefix( commandIt->second.params[returnParams[0]].name, "p" ) ); - - return replaceWithMap( functionTemplate, - { { "argumentList", argumentList }, - { "callArguments", callArguments }, - { "className", stripPrefix( commandIt->second.params[initialSkipCount - 1].type.type, "Vk" ) }, - { "commandName", commandName }, - { "failureCheck", generateFailureCheck( commandIt->second.successCodes ) }, - { "returnVariable", returnVariable }, - { "returnType", returnType }, - { "vkCommand", commandIt->first } } ); - } - else - { - std::string const declarationTemplate = - R"( - template - VULKAN_HPP_NODISCARD StructureChain ${commandName}( ${argumentList} ) const; -)"; - - return replaceWithMap( declarationTemplate, - { - { "argumentList", argumentList }, - { "commandName", commandName }, - } ); - } -} - std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWithErrors1Return( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition, @@ -6955,7 +6895,7 @@ std::string VulkanHppGenerator::generateRAIIHandleCommandResultSingleSuccessWith if ( vectorParams.empty() ) { str = generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, false, false ); - str += generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnChain( commandIt, initialSkipCount, vectorParams, { returnParam }, definition ); + str += generateRAIIHandleCommandEnhanced( commandIt, initialSkipCount, { returnParam }, vectorParams, definition, true, false ); } } else diff --git a/VulkanHppGenerator.hpp b/VulkanHppGenerator.hpp index 9633b86..aecadfa 100644 --- a/VulkanHppGenerator.hpp +++ b/VulkanHppGenerator.hpp @@ -741,11 +741,6 @@ private: std::string generateRAIIHandleCommandResultSingleSuccessWithErrors( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition ) const; - std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1ReturnChain( std::map::const_iterator commandIt, - size_t initialSkipCount, - std::map const & vectorParamIndices, - std::vector const & returnParamIndices, - bool definition ) const; std::string generateRAIIHandleCommandResultSingleSuccessWithErrors1Return( std::map::const_iterator commandIt, size_t initialSkipCount, bool definition, diff --git a/vulkan/vulkan_raii.hpp b/vulkan/vulkan_raii.hpp index 95cdbbc..1debe2a 100644 --- a/vulkan/vulkan_raii.hpp +++ b/vulkan/vulkan_raii.hpp @@ -11552,19 +11552,17 @@ namespace VULKAN_HPP_NAMESPACE } template - VULKAN_HPP_NODISCARD StructureChain - PhysicalDevice::getImageFormatProperties2( const VULKAN_HPP_NAMESPACE::PhysicalDeviceImageFormatInfo2 & imageFormatInfo ) const + VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE StructureChain + PhysicalDevice::getImageFormatProperties2( const VULKAN_HPP_NAMESPACE::PhysicalDeviceImageFormatInfo2 & imageFormatInfo ) const { StructureChain structureChain; VULKAN_HPP_NAMESPACE::ImageFormatProperties2 & imageFormatProperties = structureChain.template get(); - VULKAN_HPP_NAMESPACE::Result result = static_cast( + VkResult result = getDispatcher()->vkGetPhysicalDeviceImageFormatProperties2( static_cast( m_physicalDevice ), reinterpret_cast( &imageFormatInfo ), - reinterpret_cast( &imageFormatProperties ) ) ); - if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess ) - { - throwResultException( result, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::getImageFormatProperties2" ); - } + reinterpret_cast( &imageFormatProperties ) ); + resultCheck( static_cast( result ), VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::getImageFormatProperties2" ); + return structureChain; } @@ -12769,18 +12767,19 @@ namespace VULKAN_HPP_NAMESPACE } template - VULKAN_HPP_NODISCARD StructureChain PhysicalDevice::getVideoCapabilitiesKHR( const VULKAN_HPP_NAMESPACE::VideoProfileKHR & videoProfile ) const + VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE StructureChain + PhysicalDevice::getVideoCapabilitiesKHR( const VULKAN_HPP_NAMESPACE::VideoProfileKHR & videoProfile ) const { + VULKAN_HPP_ASSERT( getDispatcher()->vkGetPhysicalDeviceVideoCapabilitiesKHR && + "Function needs extension enabled!" ); + StructureChain structureChain; VULKAN_HPP_NAMESPACE::VideoCapabilitiesKHR & capabilities = structureChain.template get(); - VULKAN_HPP_NAMESPACE::Result result = static_cast( - getDispatcher()->vkGetPhysicalDeviceVideoCapabilitiesKHR( static_cast( m_physicalDevice ), - reinterpret_cast( &videoProfile ), - reinterpret_cast( &capabilities ) ) ); - if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess ) - { - throwResultException( result, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::getVideoCapabilitiesKHR" ); - } + VkResult result = getDispatcher()->vkGetPhysicalDeviceVideoCapabilitiesKHR( static_cast( m_physicalDevice ), + reinterpret_cast( &videoProfile ), + reinterpret_cast( &capabilities ) ); + resultCheck( static_cast( result ), VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::getVideoCapabilitiesKHR" ); + return structureChain; } @@ -13323,19 +13322,20 @@ namespace VULKAN_HPP_NAMESPACE } template - VULKAN_HPP_NODISCARD StructureChain - PhysicalDevice::getImageFormatProperties2KHR( const VULKAN_HPP_NAMESPACE::PhysicalDeviceImageFormatInfo2 & imageFormatInfo ) const + VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE StructureChain + PhysicalDevice::getImageFormatProperties2KHR( const VULKAN_HPP_NAMESPACE::PhysicalDeviceImageFormatInfo2 & imageFormatInfo ) const { + VULKAN_HPP_ASSERT( getDispatcher()->vkGetPhysicalDeviceImageFormatProperties2KHR && + "Function needs extension enabled!" ); + StructureChain structureChain; VULKAN_HPP_NAMESPACE::ImageFormatProperties2 & imageFormatProperties = structureChain.template get(); - VULKAN_HPP_NAMESPACE::Result result = static_cast( + VkResult result = getDispatcher()->vkGetPhysicalDeviceImageFormatProperties2KHR( static_cast( m_physicalDevice ), reinterpret_cast( &imageFormatInfo ), - reinterpret_cast( &imageFormatProperties ) ) ); - if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess ) - { - throwResultException( result, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::getImageFormatProperties2KHR" ); - } + reinterpret_cast( &imageFormatProperties ) ); + resultCheck( static_cast( result ), VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::getImageFormatProperties2KHR" ); + return structureChain; } @@ -14156,19 +14156,19 @@ namespace VULKAN_HPP_NAMESPACE } template - VULKAN_HPP_NODISCARD StructureChain - PhysicalDevice::getSurfaceCapabilities2KHR( const VULKAN_HPP_NAMESPACE::PhysicalDeviceSurfaceInfo2KHR & surfaceInfo ) const + VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE StructureChain + PhysicalDevice::getSurfaceCapabilities2KHR( const VULKAN_HPP_NAMESPACE::PhysicalDeviceSurfaceInfo2KHR & surfaceInfo ) const { + VULKAN_HPP_ASSERT( getDispatcher()->vkGetPhysicalDeviceSurfaceCapabilities2KHR && + "Function needs extension enabled!" ); + StructureChain structureChain; VULKAN_HPP_NAMESPACE::SurfaceCapabilities2KHR & surfaceCapabilities = structureChain.template get(); - VULKAN_HPP_NAMESPACE::Result result = static_cast( - getDispatcher()->vkGetPhysicalDeviceSurfaceCapabilities2KHR( static_cast( m_physicalDevice ), - reinterpret_cast( &surfaceInfo ), - reinterpret_cast( &surfaceCapabilities ) ) ); - if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess ) - { - throwResultException( result, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::getSurfaceCapabilities2KHR" ); - } + VkResult result = getDispatcher()->vkGetPhysicalDeviceSurfaceCapabilities2KHR( static_cast( m_physicalDevice ), + reinterpret_cast( &surfaceInfo ), + reinterpret_cast( &surfaceCapabilities ) ); + resultCheck( static_cast( result ), VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::getSurfaceCapabilities2KHR" ); + return structureChain; } @@ -14483,17 +14483,20 @@ namespace VULKAN_HPP_NAMESPACE } template - VULKAN_HPP_NODISCARD StructureChain Device::getAndroidHardwareBufferPropertiesANDROID( const struct AHardwareBuffer & buffer ) const + VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE StructureChain + Device::getAndroidHardwareBufferPropertiesANDROID( const struct AHardwareBuffer & buffer ) const { + VULKAN_HPP_ASSERT( + getDispatcher()->vkGetAndroidHardwareBufferPropertiesANDROID && + "Function needs extension enabled!" ); + StructureChain structureChain; VULKAN_HPP_NAMESPACE::AndroidHardwareBufferPropertiesANDROID & properties = structureChain.template get(); - VULKAN_HPP_NAMESPACE::Result result = static_cast( getDispatcher()->vkGetAndroidHardwareBufferPropertiesANDROID( - static_cast( m_device ), &buffer, reinterpret_cast( &properties ) ) ); - if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess ) - { - throwResultException( result, VULKAN_HPP_NAMESPACE_STRING "::Device::getAndroidHardwareBufferPropertiesANDROID" ); - } + VkResult result = getDispatcher()->vkGetAndroidHardwareBufferPropertiesANDROID( + static_cast( m_device ), &buffer, reinterpret_cast( &properties ) ); + resultCheck( static_cast( result ), VULKAN_HPP_NAMESPACE_STRING "::Device::getAndroidHardwareBufferPropertiesANDROID" ); + return structureChain; } @@ -17029,18 +17032,19 @@ namespace VULKAN_HPP_NAMESPACE } template - VULKAN_HPP_NODISCARD StructureChain Device::getPipelinePropertiesEXT( const VULKAN_HPP_NAMESPACE::PipelineInfoEXT & pipelineInfo ) const + VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE StructureChain + Device::getPipelinePropertiesEXT( const VULKAN_HPP_NAMESPACE::PipelineInfoEXT & pipelineInfo ) const { + VULKAN_HPP_ASSERT( getDispatcher()->vkGetPipelinePropertiesEXT && + "Function needs extension enabled!" ); + StructureChain structureChain; VULKAN_HPP_NAMESPACE::BaseOutStructure & pipelineProperties = structureChain.template get(); - VULKAN_HPP_NAMESPACE::Result result = static_cast( - getDispatcher()->vkGetPipelinePropertiesEXT( static_cast( m_device ), - reinterpret_cast( &pipelineInfo ), - reinterpret_cast( &pipelineProperties ) ) ); - if ( result != VULKAN_HPP_NAMESPACE::Result::eSuccess ) - { - throwResultException( result, VULKAN_HPP_NAMESPACE_STRING "::Device::getPipelinePropertiesEXT" ); - } + VkResult result = getDispatcher()->vkGetPipelinePropertiesEXT( static_cast( m_device ), + reinterpret_cast( &pipelineInfo ), + reinterpret_cast( &pipelineProperties ) ); + resultCheck( static_cast( result ), VULKAN_HPP_NAMESPACE_STRING "::Device::getPipelinePropertiesEXT" ); + return structureChain; }