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/main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 376e137..5309f09 100644 --- a/src/main.c +++ b/src/main.c @@ -1,13 +1,11 @@ #include #include -#include #include "device.h" #include "window.h" #include "common.h" // TODO: rename device.c/.h -// TODO: fix fail gotos window_t window; device_t device; @@ -20,7 +18,7 @@ int main(void) if(SDL_Init(0)) { err("SDL_Init: failed"); - goto sf; + goto f1; } // populate window info @@ -33,7 +31,7 @@ int main(void) window = window_create(&win_info); if(!window) { err("window_create: failed"); - goto wf; + goto f2; } // get extensions @@ -57,7 +55,8 @@ int main(void) device = device_create(&dev_info); if(!device) { err("device_create: failed"); - goto df; + if(extensions) free(extensions); + goto f3; } if(extensions) free(extensions); @@ -73,10 +72,11 @@ int main(void) } ret = 0; -df: device_destroy(device); -wf: window_destroy(window); -sf: SDL_Quit(); - return ret; + + device_destroy(device); +f3: window_destroy(window); +f2: SDL_Quit(); +f1: return ret; } int _create_surface(VkInstance instance, VkSurfaceKHR *surface) -- cgit v1.2.3