3#include <boost/preprocessor.hpp>
4#include <vulkan/vulkan.hpp>
5#include <vulkan/vulkan_enums.hpp>
6#include <vulkan/vulkan_to_string.hpp>
12 Result, eSuccess, eNotReady, eTimeout, eEventSet, eEventReset, eIncomplete,
13 eErrorOutOfHostMemory, eErrorOutOfDeviceMemory, eErrorInitializationFailed,
14 eErrorDeviceLost, eErrorMemoryMapFailed, eErrorLayerNotPresent,
15 eErrorExtensionNotPresent, eErrorFeatureNotPresent,
16 eErrorIncompatibleDriver, eErrorTooManyObjects, eErrorFormatNotSupported,
17 eErrorFragmentedPool, eErrorUnknown, eErrorOutOfPoolMemory,
18 eErrorOutOfPoolMemoryKHR, eErrorInvalidExternalHandle,
19 eErrorInvalidExternalHandleKHR, eErrorFragmentation, eErrorFragmentationEXT,
20 eErrorInvalidOpaqueCaptureAddress, eErrorInvalidDeviceAddressEXT,
21 eErrorInvalidOpaqueCaptureAddressKHR, ePipelineCompileRequired,
22 eErrorPipelineCompileRequiredEXT, ePipelineCompileRequiredEXT,
23 eErrorSurfaceLostKHR, eErrorNativeWindowInUseKHR, eSuboptimalKHR,
24 eErrorOutOfDateKHR, eErrorIncompatibleDisplayKHR, eErrorValidationFailedEXT,
25 eErrorInvalidShaderNV, eErrorImageUsageNotSupportedKHR,
26 eErrorVideoPictureLayoutNotSupportedKHR,
27 eErrorVideoProfileOperationNotSupportedKHR,
28 eErrorVideoProfileFormatNotSupportedKHR,
29 eErrorVideoProfileCodecNotSupportedKHR,
30 eErrorVideoStdVersionNotSupportedKHR,
31 eErrorInvalidDrmFormatModifierPlaneLayoutEXT, eErrorNotPermittedKHR,
32 eErrorNotPermittedEXT, eThreadIdleKHR, eThreadDoneKHR,
33 eOperationDeferredKHR, eOperationNotDeferredKHR,
34 eErrorCompressionExhaustedEXT);
41DEFINE_ERROR(
"VulkanErrors", VulkanErrors, NoDevicesFound,
42 QueueFamilyNotSupported)
45#define VK_TRY_RESULT_1(unique, expr) \
46 auto [unique, BOOST_PP_CAT(unique, _out)] = expr; \
47 if (unique != ::vk::Result::eSuccess) \
48 return tl::make_unexpected(make_error_code(unique));
50#define VK_TRY_RESULT_2(unique, out, expr) \
51 auto [unique, out] = expr; \
52 if (unique != ::vk::Result::eSuccess) \
53 return tl::make_unexpected(make_error_code(unique));
55#define VK_TRY_RESULT(...) \
56 BOOST_PP_OVERLOAD(VK_TRY_RESULT_, __VA_ARGS__) \
57 (RESULT_UNIQUE_NAME(), __VA_ARGS__)
59#define VK_TIE_RESULT_IMPL(unique, out, expr) \
60 ::vk::Result unique = ::vk::Result::eSuccess; \
61 std::tie(unique, out) = expr; \
62 if (unique != ::vk::Result::eSuccess) \
63 return tl::make_unexpected(make_error_code(unique));
65#define VK_TIE_RESULT(...) VK_TIE_RESULT_IMPL(RESULT_UNIQUE_NAME(), __VA_ARGS__)
67#define VK_CHECK_RESULT_IMPL(unique, expr) \
68 ::vk::Result unique = (expr); \
69 if ((unique) != ::vk::Result::eSuccess) \
70 return tl::make_unexpected(make_error_code(unique));
72#define VK_CHECK_RESULT(expr) VK_CHECK_RESULT_IMPL(RESULT_UNIQUE_NAME(), (expr))
77#define VK_ERR_PROP(out, err) \
78 auto [LINEIZE(res, __LINE__), out] = err; \
79 if (LINEIZE(res, __LINE__) != ::vk::Result::eSuccess) \
80 return tl::make_unexpected(make_error_code(LINEIZE(res, __LINE__)));
83#define VK_ERR_PROP_VOID(err) \
84 ::vk::Result LINEIZE(res, __LINE__) = err; \
85 if (LINEIZE(res, __LINE__) != ::vk::Result::eSuccess) \
86 return tl::make_unexpected(make_error_code(LINEIZE(res, __LINE__)));
89#define VK_TIE_ERR_PROP(out, err) \
90 ::vk::Result LINEIZE(res, __LINE__) = ::vk::Result::eSuccess; \
91 std::tie(LINEIZE(res, __LINE__), out) = err; \
92 if (LINEIZE(res, __LINE__) != ::vk::Result::eSuccess) \
93 return tl::make_unexpected(make_error_code(LINEIZE(res, __LINE__)));
BOOST_DESCRIBE_ENUM(Result, eSuccess, eNotReady, eTimeout, eEventSet, eEventReset, eIncomplete, eErrorOutOfHostMemory, eErrorOutOfDeviceMemory, eErrorInitializationFailed, eErrorDeviceLost, eErrorMemoryMapFailed, eErrorLayerNotPresent, eErrorExtensionNotPresent, eErrorFeatureNotPresent, eErrorIncompatibleDriver, eErrorTooManyObjects, eErrorFormatNotSupported, eErrorFragmentedPool, eErrorUnknown, eErrorOutOfPoolMemory, eErrorOutOfPoolMemoryKHR, eErrorInvalidExternalHandle, eErrorInvalidExternalHandleKHR, eErrorFragmentation, eErrorFragmentationEXT, eErrorInvalidOpaqueCaptureAddress, eErrorInvalidDeviceAddressEXT, eErrorInvalidOpaqueCaptureAddressKHR, ePipelineCompileRequired, eErrorPipelineCompileRequiredEXT, ePipelineCompileRequiredEXT, eErrorSurfaceLostKHR, eErrorNativeWindowInUseKHR, eSuboptimalKHR, eErrorOutOfDateKHR, eErrorIncompatibleDisplayKHR, eErrorValidationFailedEXT, eErrorInvalidShaderNV, eErrorImageUsageNotSupportedKHR, eErrorVideoPictureLayoutNotSupportedKHR, eErrorVideoProfileOperationNotSupportedKHR, eErrorVideoProfileFormatNotSupportedKHR, eErrorVideoProfileCodecNotSupportedKHR, eErrorVideoStdVersionNotSupportedKHR, eErrorInvalidDrmFormatModifierPlaneLayoutEXT, eErrorNotPermittedKHR, eErrorNotPermittedEXT, eThreadIdleKHR, eThreadDoneKHR, eOperationDeferredKHR, eOperationNotDeferredKHR, eErrorCompressionExhaustedEXT)
#define DEFINE_ERROR_IMPL(CAT_NAME, ERROR_ENUM)
This macro creates the hooks into std::error_code for a given error enum.
Definition errors.hpp:61
#define DEFINE_ERROR(cat_name, name,...)
This macro defines an enum with BOOST_DEFINE_ENUM_CLASS and hooks into the std::error_code system The...
Definition errors.hpp:90