diff options
author | kartofen <mladenovnasko0@gmail.com> | 2023-10-18 21:00:52 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2023-10-18 21:00:52 +0300 |
commit | 22128c747e0817f09c11b004016e6d7c518c1523 (patch) | |
tree | 315ad3ee75967504d318909e17c6f10091721d74 /src/device.h | |
parent | 9990c8d617d84e0d86ad680c39f648b0fab0906c (diff) |
swap chain support and minor reorganization
Diffstat (limited to 'src/device.h')
-rw-r--r-- | src/device.h | 22 |
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); |