3#include <boost/describe.hpp>
4#include <boost/preprocessor.hpp>
5#include <vulkan/vulkan.hpp>
6#include <vulkan/vulkan_enums.hpp>
7#include <vulkan/vulkan_to_string.hpp>
13 Result, eSuccess, eNotReady, eTimeout, eEventSet, eEventReset, eIncomplete,
14 eErrorOutOfHostMemory, eErrorOutOfDeviceMemory, eErrorInitializationFailed,
15 eErrorDeviceLost, eErrorMemoryMapFailed, eErrorLayerNotPresent,
16 eErrorExtensionNotPresent, eErrorFeatureNotPresent,
17 eErrorIncompatibleDriver, eErrorTooManyObjects, eErrorFormatNotSupported,
18 eErrorFragmentedPool, eErrorUnknown, eErrorOutOfPoolMemory,
19 eErrorOutOfPoolMemoryKHR, eErrorInvalidExternalHandle,
20 eErrorInvalidExternalHandleKHR, eErrorFragmentation, eErrorFragmentationEXT,
21 eErrorInvalidOpaqueCaptureAddress, eErrorInvalidDeviceAddressEXT,
22 eErrorInvalidOpaqueCaptureAddressKHR, ePipelineCompileRequired,
23 eErrorPipelineCompileRequiredEXT, ePipelineCompileRequiredEXT,
24 eErrorSurfaceLostKHR, eErrorNativeWindowInUseKHR, eSuboptimalKHR,
25 eErrorOutOfDateKHR, eErrorIncompatibleDisplayKHR, eErrorValidationFailedEXT,
26 eErrorInvalidShaderNV, eErrorImageUsageNotSupportedKHR,
27 eErrorVideoPictureLayoutNotSupportedKHR,
28 eErrorVideoProfileOperationNotSupportedKHR,
29 eErrorVideoProfileFormatNotSupportedKHR,
30 eErrorVideoProfileCodecNotSupportedKHR,
31 eErrorVideoStdVersionNotSupportedKHR,
32 eErrorInvalidDrmFormatModifierPlaneLayoutEXT, eErrorNotPermittedKHR,
33 eErrorNotPermittedEXT, eThreadIdleKHR, eThreadDoneKHR,
34 eOperationDeferredKHR, eOperationNotDeferredKHR,
35 eErrorCompressionExhaustedEXT);
43 QueueFamilyNotSupported)
46#define VK_TRY_RESULT_1(unique, expr) \
47 auto [unique, BOOST_PP_CAT(unique, _out)] = expr; \
48 if (unique != ::vk::Result::eSuccess) \
49 return std::unexpected(make_error_code(unique));
51#define VK_TRY_RESULT_2(unique, out, expr) \
52 auto [unique, out] = expr; \
53 if (unique != ::vk::Result::eSuccess) \
54 return std::unexpected(make_error_code(unique));
56#define VK_TRY_RESULT(...) \
57 BOOST_PP_OVERLOAD(VK_TRY_RESULT_, __VA_ARGS__) \
58 (RESULT_UNIQUE_NAME(), __VA_ARGS__)
60#define VK_TRY_RESULT_VOID_IMPL(unique, expr) \
61 const auto& unique = (expr); \
62 if (unique != ::vk::Result::eSuccess) \
63 return std::unexpected(make_error_code(unique));
65#define VK_TRY_RESULT_VOID(...) \
66 VK_TRY_RESULT_VOID_IMPL(RESULT_UNIQUE_NAME(), __VA_ARGS__)
68#define VK_TIE_RESULT_IMPL(unique, out, expr) \
69 ::vk::Result unique = ::vk::Result::eSuccess; \
70 std::tie(unique, out) = expr; \
71 if (unique != ::vk::Result::eSuccess) \
72 return std::unexpected(make_error_code(unique));
74#define VK_TIE_RESULT(...) VK_TIE_RESULT_IMPL(RESULT_UNIQUE_NAME(), __VA_ARGS__)
76#define VK_CHECK_RESULT_IMPL(unique, expr) \
77 ::vk::Result unique = (expr); \
78 if ((unique) != ::vk::Result::eSuccess) \
79 return std::unexpected(make_error_code(unique));
81#define VK_CHECK_RESULT(expr) VK_CHECK_RESULT_IMPL(RESULT_UNIQUE_NAME(), (expr))
86#define VK_ERR_PROP(out, err) \
87 auto [LINEIZE(res, __LINE__), out] = err; \
88 if (LINEIZE(res, __LINE__) != ::vk::Result::eSuccess) \
89 return std::unexpected(make_error_code(LINEIZE(res, __LINE__)));
92#define VK_ERR_PROP_VOID(err) \
93 ::vk::Result LINEIZE(res, __LINE__) = err; \
94 if (LINEIZE(res, __LINE__) != ::vk::Result::eSuccess) \
95 return std::unexpected(make_error_code(LINEIZE(res, __LINE__)));
98#define VK_TIE_ERR_PROP(out, err) \
99 ::vk::Result LINEIZE(res, __LINE__) = ::vk::Result::eSuccess; \
100 std::tie(LINEIZE(res, __LINE__), out) = err; \
101 if (LINEIZE(res, __LINE__) != ::vk::Result::eSuccess) \
102 return std::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)
Definition editor_scene.hpp:5
#define DEFINE_ERROR_IMPL(CAT_NAME, ERROR_ENUM)
This macro creates the hooks into std::error_code for a given error enum.
Definition result.hpp:77
#define DEFINE_ERROR(cat_name, name,...)
Definition result.hpp:105