From 57de549b73e90f51a453c353815e97cbcf442983 Mon Sep 17 00:00:00 2001 From: asuessenbach Date: Mon, 19 Oct 2020 15:43:29 +0200 Subject: [PATCH] Refactor commands returning some value with no enhancements available. --- VulkanHppGenerator.cpp | 21 ++++++++++---------- vulkan/vulkan.hpp | 44 ++++++------------------------------------ 2 files changed, 17 insertions(+), 48 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index dc2579b..34d5acb 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -1170,18 +1170,18 @@ void VulkanHppGenerator::appendCommand( std::string & str, } ) == constPointerParamIndices.end() ) { // no vector paramter and no non-void const-pointer - if ( commandData.returnType == "void" ) - { - // void functions with no fancy input have just standard call - appendCommandStandard( str, name, commandData, definition ); - appendedFunction = true; - } - else if ( commandData.returnType == "VkResult" ) + if ( commandData.returnType == "VkResult" ) { // function returning a result but no fancy input have either standard or enhanced call appendCommandStandardOrEnhanced( str, name, commandData, definition ); appendedFunction = true; } + else + { + // void functions and functions returning some value with no fancy input have just standard call + appendCommandStandard( str, name, commandData, definition ); + appendedFunction = true; + } } else { @@ -1571,16 +1571,17 @@ void VulkanHppGenerator::appendCommandStandard( std::string & str, bool definition ) const { const std::string functionTemplate = R"( -${commandStandard} -)"; +${enter}${commandStandard} +${leave})"; std::string enter, leave; std::tie( enter, leave ) = generateProtection( commandData.feature, commandData.extensions ); - assert( enter.empty() ); str += replaceWithMap( functionTemplate, std::map( { { "commandStandard", constructCommandStandard( name, commandData, definition ) }, + { "enter", enter }, + { "leave", leave } } ) ); } diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index 7ba9294..fb4e07d 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -54512,18 +54512,11 @@ namespace VULKAN_HPP_NAMESPACE #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #ifdef VK_ENABLE_BETA_EXTENSIONS -# ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE template uint32_t getDeferredOperationMaxConcurrencyKHR( VULKAN_HPP_NAMESPACE::DeferredOperationKHR operation, Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT; -# else - template - uint32_t getDeferredOperationMaxConcurrencyKHR( VULKAN_HPP_NAMESPACE::DeferredOperationKHR operation, - Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const - VULKAN_HPP_NOEXCEPT; -# endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ -#endif /*VK_ENABLE_BETA_EXTENSIONS*/ +#endif /*VK_ENABLE_BETA_EXTENSIONS*/ #ifdef VK_ENABLE_BETA_EXTENSIONS # ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE @@ -55691,8 +55684,8 @@ namespace VULKAN_HPP_NAMESPACE # else template VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename ResultValueType::type - releaseFullScreenExclusiveModeEXT( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, - Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; + releaseFullScreenExclusiveModeEXT( VULKAN_HPP_NAMESPACE::SwapchainKHR swapchain, + Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; # endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #endif /*VK_USE_PLATFORM_WIN32_KHR*/ @@ -61752,18 +61745,11 @@ namespace VULKAN_HPP_NAMESPACE #endif /*VK_USE_PLATFORM_WAYLAND_KHR*/ #ifdef VK_USE_PLATFORM_WIN32_KHR -# ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE template Bool32 getWin32PresentationSupportKHR( uint32_t queueFamilyIndex, Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT; -# else - template - Bool32 getWin32PresentationSupportKHR( uint32_t queueFamilyIndex, - Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const - VULKAN_HPP_NOEXCEPT; -# endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ -#endif /*VK_USE_PLATFORM_WIN32_KHR*/ +#endif /*VK_USE_PLATFORM_WIN32_KHR*/ #ifdef VK_USE_PLATFORM_XCB_KHR template @@ -98515,22 +98501,13 @@ namespace VULKAN_HPP_NAMESPACE #endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ #ifdef VK_ENABLE_BETA_EXTENSIONS -# ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_INLINE uint32_t Device::getDeferredOperationMaxConcurrencyKHR( VULKAN_HPP_NAMESPACE::DeferredOperationKHR operation, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT { return d.vkGetDeferredOperationMaxConcurrencyKHR( m_device, static_cast( operation ) ); } -# else - template - VULKAN_HPP_INLINE uint32_t Device::getDeferredOperationMaxConcurrencyKHR( - VULKAN_HPP_NAMESPACE::DeferredOperationKHR operation, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT - { - return d.vkGetDeferredOperationMaxConcurrencyKHR( m_device, static_cast( operation ) ); - } -# endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ -#endif /*VK_ENABLE_BETA_EXTENSIONS*/ +#endif /*VK_ENABLE_BETA_EXTENSIONS*/ #ifdef VK_ENABLE_BETA_EXTENSIONS # ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE @@ -106311,7 +106288,6 @@ namespace VULKAN_HPP_NAMESPACE #endif /*VK_USE_PLATFORM_WAYLAND_KHR*/ #ifdef VK_USE_PLATFORM_WIN32_KHR -# ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE template VULKAN_HPP_INLINE Bool32 PhysicalDevice::getWin32PresentationSupportKHR( uint32_t queueFamilyIndex, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT @@ -106319,15 +106295,7 @@ namespace VULKAN_HPP_NAMESPACE return static_cast( d.vkGetPhysicalDeviceWin32PresentationSupportKHR( m_physicalDevice, queueFamilyIndex ) ); } -# else - template - VULKAN_HPP_INLINE Bool32 PhysicalDevice::getWin32PresentationSupportKHR( - uint32_t queueFamilyIndex, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT - { - return d.vkGetPhysicalDeviceWin32PresentationSupportKHR( m_physicalDevice, queueFamilyIndex ); - } -# endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/ -#endif /*VK_USE_PLATFORM_WIN32_KHR*/ +#endif /*VK_USE_PLATFORM_WIN32_KHR*/ #ifdef VK_USE_PLATFORM_XCB_KHR template