X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fapp.c;h=9a723095d97cb8ac2d0c78130fd4c6f3f28b1e19;hb=6d36eee057f3d8504e337e6000c664683c2989ab;hp=044a885d03c34a89d81b81a8d61fe13a9c015111;hpb=3319bddd8188f6dc7e575169f3a0a53a93b3a8c7;p=vktest3 diff --git a/src/app.c b/src/app.c index 044a885..9a72309 100644 --- a/src/app.c +++ b/src/app.c @@ -3,6 +3,8 @@ #include "app.h" #include "vk.h" +static VkSemaphore sem_getimg; + int app_init(void) { unsigned int flags; @@ -10,17 +12,36 @@ int app_init(void) if(vk_init(VKINIT_DEPTH, &flags) == -1) { return -1; } + + sem_getimg = vk_create_sem(); + sem_draw = vk_create_sem(); return 0; } void app_cleanup(void) { + vk_free_sem(sem_getimg); + vk_free_sem(sem_draw); vk_cleanup(); } void app_display(void) { + int imgid; + VkCommandBuffer cmdbuf; + + /* get the next image from the swap chain */ + imgid = vk_next_image(sem_getimg); + cmdbuf = vk_get_cmdbuf(imgid); + + /* TODO record */ + + /* submit the command buffer, wait for one semaphore, signal another */ + vk_submit(cmdbuf, sem_getimg, sem_draw); + + /* swap buffers after drawing is finished */ + vk_present(sem_draw); } void app_reshape(int x, int y)