From 7bcbc9b17a30c3e704e4bafc06ff4e9123ed92cd Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Thu, 19 Apr 2018 09:26:52 -0700 Subject: Added CreateSemaphore to VulkanLogicalDevice --- .../include/VulkanUtilities/VulkanLogicalDevice.h | 2 ++ .../include/VulkanUtilities/VulkanObjectWrappers.h | 1 + Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp | 1 + .../src/VulkanUtilities/VulkanLogicalDevice.cpp | 11 +++++++++++ 4 files changed, 15 insertions(+) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanLogicalDevice.h b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanLogicalDevice.h index bafe0bea..1945b11a 100644 --- a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanLogicalDevice.h +++ b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanLogicalDevice.h @@ -78,6 +78,7 @@ namespace VulkanUtilities FramebufferWrapper CreateFramebuffer (const VkFramebufferCreateInfo &FramebufferCI, const char *DebugName = "")const; DescriptorPoolWrapper CreateDescriptorPool(const VkDescriptorPoolCreateInfo &DescrPoolCI, const char *DebugName = "")const; DescriptorSetLayoutWrapper CreateDescriptorSetLayout(const VkDescriptorSetLayoutCreateInfo &LayoutCI, const char *DebugName = "")const; + SemaphoreWrapper CreateSemaphore(const VkSemaphoreCreateInfo &SemaphoreCI, const char *DebugName = "")const; VkCommandBuffer AllocateVkCommandBuffer(const VkCommandBufferAllocateInfo &AllocInfo, const char *DebugName = "")const; @@ -96,6 +97,7 @@ namespace VulkanUtilities void ReleaseVulkanObject(FramebufferWrapper&& Framebuffer)const; void ReleaseVulkanObject(DescriptorPoolWrapper&& DescriptorPool)const; void ReleaseVulkanObject(DescriptorSetLayoutWrapper&& DescriptorSetLayout)const; + void ReleaseVulkanObject(SemaphoreWrapper&& Semaphore)const; VkMemoryRequirements GetBufferMemoryRequirements(VkBuffer vkBuffer)const; VkMemoryRequirements GetImageMemoryRequirements (VkImage vkImage )const; diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanObjectWrappers.h b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanObjectWrappers.h index 59d757cb..783a1e66 100644 --- a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanObjectWrappers.h +++ b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanObjectWrappers.h @@ -105,4 +105,5 @@ namespace VulkanUtilities using FramebufferWrapper = VulkanObjectWrapper; using DescriptorPoolWrapper = VulkanObjectWrapper; using DescriptorSetLayoutWrapper = VulkanObjectWrapper; + using SemaphoreWrapper = VulkanObjectWrapper; } diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp index 43b115c3..0992c17f 100644 --- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp @@ -395,6 +395,7 @@ template void RenderDeviceVkImpl::SafeReleaseVkObject(VulkanUt template void RenderDeviceVkImpl::SafeReleaseVkObject (VulkanUtilities::FramebufferWrapper &&Object); template void RenderDeviceVkImpl::SafeReleaseVkObject (VulkanUtilities::DescriptorPoolWrapper &&Object); template void RenderDeviceVkImpl::SafeReleaseVkObject(VulkanUtilities::DescriptorSetLayoutWrapper &&Object); +template void RenderDeviceVkImpl::SafeReleaseVkObject (VulkanUtilities::SemaphoreWrapper &&Object); void RenderDeviceVkImpl::DiscardStaleVkObjects(Uint64 CmdListNumber, Uint64 FenceValue) diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanLogicalDevice.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanLogicalDevice.cpp index 3dff7a73..0b7fb004 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanLogicalDevice.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanLogicalDevice.cpp @@ -214,6 +214,11 @@ namespace VulkanUtilities return CreateVulkanObject(vkCreateDescriptorSetLayout, LayoutCI, DebugName, "descriptor set layout"); } + SemaphoreWrapper VulkanLogicalDevice::CreateSemaphore(const VkSemaphoreCreateInfo &SemaphoreCI, const char *DebugName)const + { + return CreateVulkanObject(vkCreateSemaphore, SemaphoreCI, DebugName, "semaphore"); + } + VkCommandBuffer VulkanLogicalDevice::AllocateVkCommandBuffer(const VkCommandBufferAllocateInfo &AllocInfo, const char *DebugName)const { if (DebugName == nullptr) @@ -319,6 +324,12 @@ namespace VulkanUtilities DescriptorSetLayout.m_VkObject = VK_NULL_HANDLE; } + void VulkanLogicalDevice::ReleaseVulkanObject(SemaphoreWrapper&& Semaphore)const + { + vkDestroySemaphore(m_VkDevice, Semaphore.m_VkObject, m_VkAllocator); + Semaphore.m_VkObject = VK_NULL_HANDLE; + } + -- cgit v1.2.3