mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2025-10-30 07:01:10 +00:00
37 lines
1.1 KiB
C++
37 lines
1.1 KiB
C++
#ifndef EXCEPTIONS_HPP
|
|
#define EXCEPTIONS_HPP
|
|
|
|
#include <vulkan/vulkan_core.h>
|
|
|
|
#include <stdexcept>
|
|
#include <string>
|
|
|
|
namespace ls {
|
|
|
|
/// Simple exception class for Vulkan errors.
|
|
class vulkan_error : public std::runtime_error {
|
|
public:
|
|
///
|
|
/// Construct a vulkan_error with a message and a Vulkan result code.
|
|
///
|
|
/// @param result The Vulkan result code associated with the error.
|
|
/// @param message The error message.
|
|
///
|
|
explicit vulkan_error(VkResult result, const std::string& message);
|
|
|
|
/// Get the Vulkan result code associated with this error.
|
|
[[nodiscard]] VkResult error() const { return this->result; }
|
|
|
|
// Trivially copyable, moveable and destructible
|
|
vulkan_error(const vulkan_error&) = default;
|
|
vulkan_error(vulkan_error&&) = default;
|
|
vulkan_error& operator=(const vulkan_error&) = default;
|
|
vulkan_error& operator=(vulkan_error&&) = default;
|
|
~vulkan_error() noexcept override;
|
|
private:
|
|
VkResult result;
|
|
};
|
|
|
|
}
|
|
|
|
#endif // EXCEPTIONS_HPP
|