9#include "VKPhysicalDevice.h"
10#include "VKSwapchain.h"
11#include <vulkan/vulkan.h>
16 std::string get_device_name()
const override;
17 std::string get_renderer_name()
const override;
18 std::string get_vendor_name()
const override;
45 static void init(
const Window& win);
49 static void create_instance();
50 static void create_surface(
const Window& win);
51 static void select_physical_device();
52 static void create_device();
53 static void create_swapchain();
54 static void create_command_pool();
57inline std::string_view ToString(VkResult res)
65 return "VK_NOT_READY";
71 return "VK_EVENT_SET";
74 return "VK_EVENT_RESET";
77 return "VK_INCOMPLETE";
79 case VK_ERROR_OUT_OF_HOST_MEMORY:
80 return "VK_ERROR_OUT_OF_HOST_MEMORY";
82 case VK_ERROR_OUT_OF_DEVICE_MEMORY:
83 return "VK_ERROR_OUT_OF_DEVICE_MEMORY";
85 case VK_ERROR_INITIALIZATION_FAILED:
86 return "VK_ERROR_INITIALIZATION_FAILED";
88 case VK_ERROR_DEVICE_LOST:
89 return "VK_ERROR_DEVICE_LOST";
91 case VK_ERROR_MEMORY_MAP_FAILED:
92 return "VK_ERROR_MEMORY_MAP_FAILED";
94 case VK_ERROR_LAYER_NOT_PRESENT:
95 return "VK_ERROR_LAYER_NOT_PRESENT";
97 case VK_ERROR_FEATURE_NOT_PRESENT:
98 return "VK_ERROR_FEATURE_NOT_PRESENT";
100 case VK_ERROR_INCOMPATIBLE_DRIVER:
101 return "VK_ERROR_INCOMPATIBLE_DRIVER";
103 case VK_ERROR_TOO_MANY_OBJECTS:
104 return "VK_ERROR_TOO_MANY_OBJECTS";
106 case VK_ERROR_FORMAT_NOT_SUPPORTED:
107 return "VK_ERROR_FORMAT_NOT_SUPPORTED";
109 case VK_ERROR_SURFACE_LOST_KHR:
110 return "VK_ERROR_SURFACE_LOST_KHR";
112 case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR:
113 return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR";
115 case VK_SUBOPTIMAL_KHR:
116 return "VK_SUBOPTIMAL_KHR";
118 case VK_ERROR_OUT_OF_DATE_KHR:
119 return "VK_ERROR_OUT_OF_DATE_KHR";
121 case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR:
122 return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR";
124 case VK_ERROR_VALIDATION_FAILED_EXT:
125 return "VK_ERROR_VALIDATION_FAILED_EXT";
127 case VK_ERROR_INVALID_SHADER_NV:
128 return "VK_ERROR_INVALID_SHADER_NV";
135inline VkResult VKCheck(VkResult res)
137 if(res != VK_SUCCESS)
138 throw std::runtime_error(
"Vulkan:" + std::string(ToString(res)));
Definition: Renderer.h:10
Vulkan 逻辑设备.
Definition: VKDevice.h:14
Vulkan 实例.
Definition: VKInstance.h:12
Vulkan 物理设备.
Definition: VKPhysicalDevice.h:15
Definition: VKRenderer.h:14
const VKDevice & get_device() const
获取 VKDevice.
Definition: VKRenderer.cpp:50
const VKSwapchain & get_swapchain() const
获取 VKSwapchain.
Definition: VKRenderer.cpp:55
const VKPhysicalDevice & get_physical_device() const
获取 VKPhysicalDevice.
Definition: VKRenderer.cpp:45
const VKInstance & get_instance() const
获取 VKInstance.
Definition: VKRenderer.cpp:40
const VkCommandPool & get_command_pool() const
获取命令缓冲区池.
Definition: VKRenderer.cpp:60
Definition: VKSwapchain.h:11
窗体.
Definition: Window.h:24