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); }
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; }
// optional VkResult that could of been produced due to the error
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
bool has_value () const { return m_init; }
explicit operator bool () const { return m_init; }
@ -473,7 +476,7 @@ enum class QueueType { present, graphics, compute, transfer };
namespace detail {
// Sentinel value, used in implementation only
const int QUEUE_INDEX_MAX_VALUE = 65536;
}
} // namespace detail
// ---- Device ---- //
@ -617,7 +620,7 @@ class SwapchainBuilder {
// Set the VkSwapchainCreateFlagBitsKHR.
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);
// 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);