summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Halase <jordan@halase.me>2019-11-04 13:51:52 -0600
committerJordan Halase <jordan@halase.me>2019-11-04 13:51:52 -0600
commitc41f34b278e3cca25ad8c3df1bb32d1eaedb3c7c (patch)
treeed3019c4715982e07f0eddceb4579e4ab969bd12
parenta4048cefacb8d5a653d175d4c9235e791e2e0641 (diff)
Load vkGetFenceStatus and quit when escape key is pressed
-rwxr-xr-xmain.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/main.c b/main.c
index b122b18..aeec0e2 100755
--- a/main.c
+++ b/main.c
@@ -173,6 +173,7 @@ struct VulkanDev {
PFN_vkDestroySemaphore vkDestroySemaphore;
PFN_vkCreateFence vkCreateFence;
PFN_vkDestroyFence vkDestroyFence;
+ PFN_vkGetFenceStatus vkGetFenceStatus;
PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR;
PFN_vkWaitForFences vkWaitForFences;
PFN_vkResetFences vkResetFences;
@@ -1091,6 +1092,13 @@ static int rvkLoadDeviceFunctions(struct RenderVulkan *vk, VkDevice device)
return -1;
}
+ static const char *const _vkGetFenceStatus = "vkGetFenceStatus";
+ vk->dev->vkGetFenceStatus = (PFN_vkGetFenceStatus)vk->api->vkGetDeviceProcAddr(device, _vkGetFenceStatus);
+ if (!vk->dev->vkGetFenceStatus) {
+ rvkSetErrMsg(vk, strErrLd, _vkGetFenceStatus);
+ return -1;
+ }
+
static const char *const _vkDestroySemaphore = "vkDestroySemaphore";
vk->dev->vkDestroySemaphore = (PFN_vkDestroySemaphore)vk->api->vkGetDeviceProcAddr(device, _vkDestroySemaphore);
if (!vk->dev->vkDestroySemaphore) {
@@ -1661,6 +1669,7 @@ PuglStatus onDisplay(PuglView *view)
struct RenderVulkan *vk = puglGetHandle(view);
uint32_t imageIndex;
VkResult result;
+
if ((result = vk->dev->vkAcquireNextImageKHR(
vk->device,
vk->swapchain.rawSwapchain,
@@ -1729,6 +1738,11 @@ PuglStatus onEvent(PuglView *view, const PuglEvent *e)
case PUGL_CLOSE:
running = 0;
break;
+ case PUGL_KEY_PRESS:
+ if (e->key.key == PUGL_KEY_ESCAPE) {
+ running = 0;
+ }
+ break;
default:
break;
}