From 7878c4fef0d0afb1b07b37b62306f59e037cf32a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Wed, 9 May 2018 06:57:24 +0200 Subject: [PATCH] vkh_event_create + cpp guard in all headers --- include/vkh.h | 1 + src/vkh_app.h | 7 +++++++ src/vkh_buffer.h | 7 +++++++ src/vkh_device.h | 7 +++++++ src/vkh_image.h | 7 +++++++ src/vkh_phyinfo.h | 7 +++++++ src/vkh_presenter.c | 2 ++ src/vkh_queue.h | 7 +++++++ src/vkhelpers.c | 6 ++++++ 9 files changed, 51 insertions(+) diff --git a/include/vkh.h b/include/vkh.h index 11c40ce..67134e4 100644 --- a/include/vkh.h +++ b/include/vkh.h @@ -135,6 +135,7 @@ void* vkh_buffer_get_mapped_pointer (VkhBuffer buff); VkFence vkh_fence_create (VkhDevice dev); VkFence vkh_fence_create_signaled (VkhDevice dev); VkSemaphore vkh_semaphore_create (VkhDevice dev); +VkEvent vkh_event_create (VkhDevice dev); VkCommandPool vkh_cmd_pool_create (VkhDevice dev, uint32_t qFamIndex, VkCommandPoolCreateFlags flags); VkCommandBuffer vkh_cmd_buff_create (VkhDevice dev, VkCommandPool cmdPool, VkCommandBufferLevel level); diff --git a/src/vkh_app.h b/src/vkh_app.h index 2c08cf2..07cc394 100644 --- a/src/vkh_app.h +++ b/src/vkh_app.h @@ -22,10 +22,17 @@ #ifndef VKH_APP_H #define VKH_APP_H +#ifdef __cplusplus +extern "C" { +#endif + #include "vkh.h" typedef struct _vkh_app_t{ VkApplicationInfo infos; VkInstance inst; }vkh_app_t; +#ifdef __cplusplus +} +#endif #endif diff --git a/src/vkh_buffer.h b/src/vkh_buffer.h index 00902dc..347c973 100644 --- a/src/vkh_buffer.h +++ b/src/vkh_buffer.h @@ -22,6 +22,10 @@ #ifndef VKH_BUFFER_H #define VKH_BUFFER_H +#ifdef __cplusplus +extern "C" { +#endif + #include "vkh.h" typedef struct _vkh_buffer_t { @@ -38,4 +42,7 @@ typedef struct _vkh_buffer_t { void* mapped; }vkh_buffer_t; +#ifdef __cplusplus +} +#endif #endif diff --git a/src/vkh_device.h b/src/vkh_device.h index 5e56e50..1b5b1bf 100644 --- a/src/vkh_device.h +++ b/src/vkh_device.h @@ -22,6 +22,10 @@ #ifndef VKH_DEVICE_H #define VKH_DEVICE_H +#ifdef __cplusplus +extern "C" { +#endif + #include "vkh.h" typedef struct _vkh_device_t{ @@ -31,4 +35,7 @@ typedef struct _vkh_device_t{ VmaAllocator allocator; }vkh_device_t; +#ifdef __cplusplus +} +#endif #endif diff --git a/src/vkh_image.h b/src/vkh_image.h index d925466..fb67512 100644 --- a/src/vkh_image.h +++ b/src/vkh_image.h @@ -22,6 +22,10 @@ #ifndef VKH_IMAGE_H #define VKH_IMAGE_H +#ifdef __cplusplus +extern "C" { +#endif + #include "vkh.h" typedef struct _vkh_image_t { @@ -38,4 +42,7 @@ typedef struct _vkh_image_t { VkImageLayout layout; //current layout bool imported; }vkh_image_t; +#ifdef __cplusplus +} +#endif #endif diff --git a/src/vkh_phyinfo.h b/src/vkh_phyinfo.h index cf1fcea..75c987c 100644 --- a/src/vkh_phyinfo.h +++ b/src/vkh_phyinfo.h @@ -22,6 +22,10 @@ #ifndef VKH_PHY_H #define VKH_PHY_H +#ifdef __cplusplus +extern "C" { +#endif + #include "vkh.h" typedef struct _vkh_phy_t{ @@ -38,4 +42,7 @@ typedef struct _vkh_phy_t{ uint32_t qCreateInfosCount; VkDeviceQueueCreateInfo* qCreateInfos; }vkh_phy_t; +#ifdef __cplusplus +} +#endif #endif diff --git a/src/vkh_presenter.c b/src/vkh_presenter.c index a629116..5324347 100644 --- a/src/vkh_presenter.c +++ b/src/vkh_presenter.c @@ -41,6 +41,7 @@ VkhPresenter vkh_presenter_create (VkhDevice dev, uint32_t presentQueueFamIdx, V r->cmdPool = vkh_cmd_pool_create (r->dev, presentQueueFamIdx, 0); r->semaPresentEnd = vkh_semaphore_create (r->dev); r->semaDrawEnd = vkh_semaphore_create (r->dev); + r->evtReady = vkh_event_create (r->dev); _init_phy_surface (r, preferedFormat, presentMode); @@ -54,6 +55,7 @@ void vkh_presenter_destroy (VkhPresenter r) { _swapchain_destroy (r); + vkDestroyEvent (r->dev->dev, r->evtReady, NULL); vkDestroySemaphore (r->dev->dev, r->semaDrawEnd, NULL); vkDestroySemaphore (r->dev->dev, r->semaPresentEnd, NULL); vkDestroyCommandPool(r->dev->dev, r->cmdPool, NULL); diff --git a/src/vkh_queue.h b/src/vkh_queue.h index f33d800..68cab36 100644 --- a/src/vkh_queue.h +++ b/src/vkh_queue.h @@ -22,6 +22,10 @@ #ifndef VKH_QUEUE_H #define VKH_QUEUE_H +#ifdef __cplusplus +extern "C" { +#endif + #include "vkh.h" typedef struct _vkh_queue_t{ @@ -31,4 +35,7 @@ typedef struct _vkh_queue_t{ VkQueueFlags flags; }vkh_queue_t; +#ifdef __cplusplus +} +#endif #endif diff --git a/src/vkhelpers.c b/src/vkhelpers.c index a547968..b8ae79e 100644 --- a/src/vkhelpers.c +++ b/src/vkhelpers.c @@ -49,6 +49,12 @@ VkSemaphore vkh_semaphore_create (VkhDevice dev) { VK_CHECK_RESULT(vkCreateSemaphore(dev->dev, &info, NULL, &semaphore)); return semaphore; } +VkEvent vkh_event_create (VkhDevice dev) { + VkEvent evt; + VkEventCreateInfo evtInfo = {.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO}; + VK_CHECK_RESULT(vkCreateEvent (dev->dev, &evtInfo, NULL, &evt)); + return evt; +} VkCommandPool vkh_cmd_pool_create (VkhDevice dev, uint32_t qFamIndex, VkCommandPoolCreateFlags flags){ VkCommandPool cmdPool; VkCommandPoolCreateInfo cmd_pool_info = { .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, -- 2.47.3