Add full_error() function to Result for easier printing of errors

Comment the various error functions in Result
This commit is contained in:
Charles Giessen 2021-02-18 11:33:34 -07:00 committed by Charles Giessen
parent 4120362762
commit 3ebe53bdfe

View File

@ -93,11 +93,14 @@ template <typename T> class Result {
const T&& value () const&& { assert (m_init); return std::move (m_value); } const T&& value () const&& { assert (m_init); return std::move (m_value); }
T&& value () && { assert (m_init); return std::move (m_value); } T&& value () && { assert (m_init); return std::move (m_value); }
// std::error_code associated with the error
std::error_code error() const { assert (!m_init); return m_error.type; } std::error_code error() const { assert (!m_init); return m_error.type; }
// optional VkResult that could of been produced due to the error
VkResult vk_result() const { assert (!m_init); return m_error.vk_result; } VkResult vk_result() const { assert (!m_init); return m_error.vk_result; }
// Returns the struct that holds the std::error_code and VkResult
Error full_error() const { assert (!m_init); return m_error; }
// clang-format on // clang-format on
bool has_value () const { return m_init; } bool has_value () const { return m_init; }
explicit operator bool () const { return m_init; } explicit operator bool () const { return m_init; }
@ -471,9 +474,9 @@ class PhysicalDeviceSelector {
enum class QueueType { present, graphics, compute, transfer }; enum class QueueType { present, graphics, compute, transfer };
namespace detail { namespace detail {
// Sentinel value, used in implementation only // Sentinel value, used in implementation only
const int QUEUE_INDEX_MAX_VALUE = 65536; const int QUEUE_INDEX_MAX_VALUE = 65536;
} } // namespace detail
// ---- Device ---- // // ---- Device ---- //
@ -616,9 +619,9 @@ class SwapchainBuilder {
SwapchainBuilder& set_clipped (bool clipped = true); SwapchainBuilder& set_clipped (bool clipped = true);
// Set the VkSwapchainCreateFlagBitsKHR. // Set the VkSwapchainCreateFlagBitsKHR.
SwapchainBuilder& set_create_flags (VkSwapchainCreateFlagBitsKHR create_flags); SwapchainBuilder& set_create_flags(VkSwapchainCreateFlagBitsKHR create_flags);
// Set the transform to be applied, like a 90 degree rotation. Default is the no transform. // Set the transform to be applied, like a 90 degree rotation. Default is no transform.
SwapchainBuilder& set_pre_transform_flags (VkSurfaceTransformFlagBitsKHR pre_transform_flags); SwapchainBuilder& set_pre_transform_flags(VkSurfaceTransformFlagBitsKHR pre_transform_flags);
// Set the alpha channel to be used with other windows in on the system. Default is VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR. // Set the alpha channel to be used with other windows in on the system. Default is VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR.
SwapchainBuilder& set_composite_alpha_flags (VkCompositeAlphaFlagBitsKHR composite_alpha_flags); SwapchainBuilder& set_composite_alpha_flags (VkCompositeAlphaFlagBitsKHR composite_alpha_flags);