From 22128c747e0817f09c11b004016e6d7c518c1523 Mon Sep 17 00:00:00 2001 From: kartofen Date: Wed, 18 Oct 2023 21:00:52 +0300 Subject: swap chain support and minor reorganization --- src/device.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/device.h') 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 +#include #include + #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); -- cgit v1.2.3