[metacity] vulkan: create semaphore
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] vulkan: create semaphore
- Date: Thu, 16 Mar 2017 17:41:55 +0000 (UTC)
commit e15af3113b2ee4645bfbf3b57a8d2458c7752272
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Thu Mar 16 17:29:32 2017 +0200
vulkan: create semaphore
src/compositor/meta-compositor-vulkan.c | 35 +++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/src/compositor/meta-compositor-vulkan.c b/src/compositor/meta-compositor-vulkan.c
index 45d3d30..9ec831a 100644
--- a/src/compositor/meta-compositor-vulkan.c
+++ b/src/compositor/meta-compositor-vulkan.c
@@ -51,6 +51,8 @@ struct _MetaCompositorVulkan
VkQueue present_queue;
VkCommandPool command_pool;
+
+ VkSemaphore semaphore;
#endif
};
@@ -657,6 +659,30 @@ create_command_pool (MetaCompositorVulkan *vulkan,
return TRUE;
}
+
+static gboolean
+create_semaphore (MetaCompositorVulkan *vulkan,
+ GError **error)
+{
+ VkSemaphoreCreateInfo info;
+ VkResult result;
+
+ info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
+ info.pNext = NULL;
+ info.flags = 0;
+
+ result = vkCreateSemaphore (vulkan->device, &info, NULL, &vulkan->semaphore);
+
+ if (result != VK_SUCCESS)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Failed to create semaphore");
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
#endif
static void
@@ -667,6 +693,12 @@ meta_compositor_vulkan_finalize (GObject *object)
vulkan = META_COMPOSITOR_VULKAN (object);
+ if (vulkan->semaphore != VK_NULL_HANDLE)
+ {
+ vkDestroySemaphore (vulkan->device, vulkan->semaphore, NULL);
+ vulkan->semaphore = VK_NULL_HANDLE;
+ }
+
if (vulkan->command_pool != VK_NULL_HANDLE)
{
vkDestroyCommandPool (vulkan->device, vulkan->command_pool, NULL);
@@ -761,6 +793,9 @@ meta_compositor_vulkan_manage (MetaCompositor *compositor,
if (!create_command_pool (vulkan, error))
return FALSE;
+ if (!create_semaphore (vulkan, error))
+ return FALSE;
+
g_timeout_add (10000, (GSourceFunc) not_implemented_cb, vulkan);
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]