summaryrefslogtreecommitdiff
path: root/src/device.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/device.h')
-rw-r--r--src/device.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/device.h b/src/device.h
index d6768e1..3491b8a 100644
--- a/src/device.h
+++ b/src/device.h
@@ -1,9 +1,18 @@
#ifndef DEVICE_H
#define DEVICE_H
+#include <stdint.h>
+#include <stdbool.h>
#include <vulkan/vulkan.h>
+
#include "common.h"
+// from vulkan source
+#define MAKE_VERSION(major, minor, patch) \
+ ((((u32)(major)) << 22U) | (((u32)(minor)) << 12U) | ((u32)(patch)))
+
+typedef uint32_t u32;
+
typedef struct device {
VkInstance instance;
VkDebugUtilsMessengerEXT debug_messenger;
@@ -11,20 +20,23 @@ typedef struct device {
VkPhysicalDevice physical_device;
VkDevice logical_device;
VkQueue graphics_queue;
+ VkQueue present_queue;
+ VkSwapchainKHR swap_chain;
VkSurfaceKHR surface;
-} * device_t;
-typedef int (*surface_func_t)(VkInstance instance, VkSurfaceKHR *surface);
+ VkImage *swap_chain_images;
+ u32 nimages;
+} * device_t;
struct device_info {
char *name;
- uint32_t version;
+ u32 version;
const char* const* extensions;
- uint32_t ext_count;
+ u32 ext_count;
- surface_func_t surface_func;
+ int (*surface_func)(VkInstance instance, VkSurfaceKHR *surface);
};
device_t device_create(struct device_info *info);