summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2023-10-18 21:00:52 +0300
committerkartofen <mladenovnasko0@gmail.com>2023-10-18 21:00:52 +0300
commit22128c747e0817f09c11b004016e6d7c518c1523 (patch)
tree315ad3ee75967504d318909e17c6f10091721d74 /src/main.c
parent9990c8d617d84e0d86ad680c39f648b0fab0906c (diff)
swap chain support and minor reorganization
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c18
1 files changed, 9 insertions, 9 deletions
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 <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
#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)