-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[exceptions] Introduced custom base class for exceptions and special …
…class for Vulkan API exceptions.
- Loading branch information
1 parent
8d6a115
commit ba7e494
Showing
28 changed files
with
507 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
|
||
#include <stdexcept> | ||
#include <string> | ||
|
||
namespace inexor::vulkan_renderer::exceptions { | ||
|
||
/// @brief A custom base class for exceptions | ||
class Exception : public std::runtime_error { | ||
public: | ||
// No need to define own constructors. | ||
using std::runtime_error::runtime_error; | ||
}; | ||
|
||
} // namespace inexor::vulkan_renderer::exceptions |
29 changes: 29 additions & 0 deletions
29
include/inexor/vulkan-renderer/exceptions/vk_exception.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include "inexor/vulkan-renderer/exceptions/exception.hpp" | ||
|
||
#include <vulkan/vulkan_core.h> | ||
|
||
namespace inexor::vulkan_renderer::exceptions { | ||
|
||
/// @brief | ||
class VulkanException final : public Exception { | ||
private: | ||
///@brief Return a VkResult's description text. | ||
/// @note This function can be used for both VkResult error and success values. | ||
/// @param result The VkResult return value which will be turned into a string. | ||
[[nodiscard]] static std::string get_vkresult_description(const VkResult result); | ||
|
||
/// @brief Turn a VkResult into a string. | ||
/// @note This function can be used for both VkResult error and success values. | ||
/// @param result The VkResult return value which will be turned into a string. | ||
[[nodiscard]] static std::string get_vkresult_string(const VkResult result); | ||
|
||
public: | ||
/// @brief Default constructor. | ||
/// @param message The exception message. | ||
/// @param result The VkResult value of the Vulkan API call which failed. | ||
VulkanException(const std::string message, const VkResult result); | ||
}; | ||
|
||
} // namespace inexor::vulkan_renderer::exceptions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.