summaryrefslogtreecommitdiff
path: root/src/vulkan_helper.h
diff options
context:
space:
mode:
authorChuyan Zhang <me@zcy.moe>2024-09-06 01:50:30 -0700
committerChuyan Zhang <me@zcy.moe>2024-09-06 01:50:30 -0700
commite12ca33626bdadedc3158cb69f2a4d2f9bbeeeb0 (patch)
tree1e7803cbdd48b8a2de355916f042f7b77325f920 /src/vulkan_helper.h
parent8c7926588b616988e7b016eaf704acee0ee77cc9 (diff)
downloadiris-e12ca33626bdadedc3158cb69f2a4d2f9bbeeeb0.tar.gz
iris-e12ca33626bdadedc3158cb69f2a4d2f9bbeeeb0.zip
setup swapchain
Diffstat (limited to 'src/vulkan_helper.h')
-rw-r--r--src/vulkan_helper.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/vulkan_helper.h b/src/vulkan_helper.h
new file mode 100644
index 0000000..089a09f
--- /dev/null
+++ b/src/vulkan_helper.h
@@ -0,0 +1,30 @@
+#include <cstdint>
+#include <vulkan/vulkan_core.h>
+#include <vector>
+#include <string>
+
+#define CHECK_VULKAN(result) \
+ do { \
+ VkResult res = result; \
+ if (res != VK_SUCCESS) { \
+ /* TODO: throw error instead of returning */ \
+ std::cerr << "Vulkan error: " << res << std::endl; \
+ abort(); \
+ } \
+ } while (0)
+
+namespace iris {
+
+struct Device {
+ VkInstance instance;
+ VkPhysicalDevice physical_device;
+ VkDevice device;
+ uint32_t main_queue_family_index;
+ VkQueue graphics_queue;
+
+ Device(
+ std::vector<std::string> layers,
+ std::vector<std::string> instance_extensions);
+};
+
+} // namespace iris \ No newline at end of file