From: John Tsiombikas Date: Thu, 23 Dec 2021 07:46:32 +0000 (+0200) Subject: create swapchain, images and image views for the swapchain X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=vkray;a=commitdiff_plain;h=cdc640d99b613ef7f783badae5dd55ab402822d3 create swapchain, images and image views for the swapchain --- diff --git a/src/app.c b/src/app.c index 4d845c5..1d97906 100644 --- a/src/app.c +++ b/src/app.c @@ -1,3 +1,4 @@ +#include #include "app.h" #include "vk.h" @@ -21,6 +22,9 @@ void app_display(void) void app_reshape(int x, int y) { + if(vk_reshape(x, y) == -1) { + abort(); + } } void app_keyboard(int key, int press) diff --git a/src/vk.c b/src/vk.c index cfe2668..f3cb508 100644 --- a/src/vk.c +++ b/src/vk.c @@ -17,6 +17,8 @@ static int create_instance(void); static int create_surface(void); static int choose_phys_dev(void); static int create_device(void); +static int create_swapchain(void); + static int choose_pixfmt(void); static int eval_pdev_score(VkPhysicalDevice dev); static int have_inst_layer(const char *name); @@ -36,6 +38,9 @@ static int vksurf_numfmt, vksurf_selfmt; static VkSurfaceFormatKHR *vksurf_fmt; static VkSwapchainKHR vksc; static int vksc_numimg; +static VkImage *vksc_img; +static VkExtent2D vksc_extent; +static VkImageView *vksc_view; static VkLayerProperties *inst_layers; static VkExtensionProperties *inst_ext, *dev_ext; @@ -63,12 +68,64 @@ int vk_init(void) void vk_cleanup(void) { - vkDestroyInstance(vk, 0); + int i; + + free(vksc_img); + vksc_img = 0; + free(vksc_view); + vksc_view = 0; + if(vksc_view) { + for(i=0; i