Update to Version 1.0.11: extended writeExceptionCheck to support an arbitrary number of successCodes.

This commit is contained in:
Andreas Süßenbach 2016-04-29 15:24:27 +02:00
parent 8b4b35dc09
commit 3ba0905e26
3 changed files with 12 additions and 6 deletions

View File

@ -1752,16 +1752,22 @@ void writeCall(std::ofstream & ofs, std::string const& name, size_t templateInde
void writeExceptionCheck(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, std::vector<std::string> const& successCodes) void writeExceptionCheck(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, std::vector<std::string> const& successCodes)
{ {
assert(!successCodes.empty());
ofs << indentation << " if (";
if (successCodes.size() == 1) if (successCodes.size() == 1)
{ {
assert(successCodes.front() == "eSuccess"); assert(successCodes.front() == "eSuccess");
ofs << indentation << " if ( result != Result::eSuccess )" << std::endl; ofs << " result != Result::eSuccess";
} }
else else
{ {
assert(successCodes.size() == 2); for (size_t i = 0; i < successCodes.size() - 1; i++)
ofs << indentation << " if ( ( result != Result::" << successCodes[0] << " ) && ( result != Result::" << successCodes[1] << " ) )" << std::endl; {
ofs << " ( result != Result::" << successCodes[i] << " ) &&";
} }
ofs << " ( result != Result::" << successCodes.back() << " )";
}
ofs << " )" << std::endl;
ofs << indentation << " {" << std::endl ofs << indentation << " {" << std::endl
<< indentation << " throw std::system_error( result, \"vk::"; << indentation << " throw std::system_error( result, \"vk::";
if (!className.empty()) if (!className.empty())

@ -1 +1 @@
Subproject commit ce3204c7dd53a0116ce3a91fd12919d606c306f5 Subproject commit 6db51e924115759f9badd40eb91bbcf3240de1fb

View File

@ -63,7 +63,7 @@
# include <vector> # include <vector>
#endif /*VKCPP_DISABLE_ENHANCED_MODE*/ #endif /*VKCPP_DISABLE_ENHANCED_MODE*/
static_assert( VK_HEADER_VERSION == 8 , "Wrong VK_HEADER_VERSION!" ); static_assert( VK_HEADER_VERSION == 11 , "Wrong VK_HEADER_VERSION!" );
// 32-bit vulkan is not typesafe for handles, so don't allow copy constructors on this platform by default. // 32-bit vulkan is not typesafe for handles, so don't allow copy constructors on this platform by default.
// To enable this feature on 32-bit platforms please define VK_CPP_TYPESAFE_CONVERSION // To enable this feature on 32-bit platforms please define VK_CPP_TYPESAFE_CONVERSION
@ -21699,7 +21699,7 @@ namespace vk
Result acquireNextImageKHR( SwapchainKHR swapchain, uint64_t timeout, Semaphore semaphore, Fence fence, uint32_t & imageIndex ) const Result acquireNextImageKHR( SwapchainKHR swapchain, uint64_t timeout, Semaphore semaphore, Fence fence, uint32_t & imageIndex ) const
{ {
Result result = static_cast<Result>( vkAcquireNextImageKHR( m_device, static_cast<VkSwapchainKHR>( swapchain ), timeout, static_cast<VkSemaphore>( semaphore ), static_cast<VkFence>( fence ), &imageIndex ) ); Result result = static_cast<Result>( vkAcquireNextImageKHR( m_device, static_cast<VkSwapchainKHR>( swapchain ), timeout, static_cast<VkSemaphore>( semaphore ), static_cast<VkFence>( fence ), &imageIndex ) );
if ( ( result != Result::eSuccess ) && ( result != Result::eSuboptimalKHR ) ) if ( ( result != Result::eSuccess ) && ( result != Result::eTimeout ) && ( result != Result::eNotReady ) && ( result != Result::eSuboptimalKHR ) )
{ {
throw std::system_error( result, "vk::Device::acquireNextImageKHR" ); throw std::system_error( result, "vk::Device::acquireNextImageKHR" );
} }