#include "./except.hpp" #include using vk::error; /////////////////////////////////////////////////////////////////////////////// void error::try_code (VkResult res) { if (__builtin_expect (res >= 0, true)) return; throw_code (res); } //----------------------------------------------------------------------------- void error::throw_code (VkResult res) { switch (res) { case VK_SUCCESS: throw error_code (); // partial successes case VK_NOT_READY: throw error_code (); case VK_TIMEOUT: throw error_code (); case VK_EVENT_SET: throw error_code (); case VK_EVENT_RESET: throw error_code (); case VK_INCOMPLETE: throw error_code (); // errors case VK_ERROR_OUT_OF_HOST_MEMORY: throw error_code (); case VK_ERROR_OUT_OF_DEVICE_MEMORY: throw error_code (); case VK_ERROR_INITIALIZATION_FAILED: throw error_code (); case VK_ERROR_DEVICE_LOST: throw error_code (); case VK_ERROR_MEMORY_MAP_FAILED: throw error_code (); case VK_ERROR_LAYER_NOT_PRESENT: throw error_code (); case VK_ERROR_EXTENSION_NOT_PRESENT: throw error_code (); case VK_ERROR_FEATURE_NOT_PRESENT: throw error_code (); case VK_ERROR_INCOMPATIBLE_DRIVER: throw error_code (); case VK_ERROR_TOO_MANY_OBJECTS: throw error_code (); case VK_ERROR_FORMAT_NOT_SUPPORTED: throw error_code (); } unreachable (); }