summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h1
-rw-r--r--Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp2
-rw-r--r--Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp18
3 files changed, 8 insertions, 13 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h b/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h
index 754a063d..5a98975a 100644
--- a/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h
@@ -116,7 +116,6 @@ protected:
*/
VulkanUtilities::ImageWrapper m_VulkanImage;
VulkanUtilities::DeviceMemoryWrapper m_ImageMemory;
- const bool m_IsExternalHandle;
};
}
diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
index db6fc6e6..f708b6aa 100644
--- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
@@ -76,7 +76,7 @@ RenderDeviceVkImpl :: RenderDeviceVkImpl(IReferenceCounters *pRefCounters,
m_StaleVkObjects(STD_ALLOCATOR_RAW_MEM(ReleaseQueueElemType, GetRawAllocator(), "Allocator for queue<ReleaseQueueElemType>")),/*,
m_UploadHeaps(STD_ALLOCATOR_RAW_MEM(UploadHeapPoolElemType, GetRawAllocator(), "Allocator for vector<unique_ptr<DynamicUploadHeap>>"))
*/
- m_CmdBufferPool(m_LogicalVkDevice, pCmdQueue->GetQueueFamilyIndex(), VK_COMMAND_POOL_CREATE_TRANSIENT_BIT | VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT)
+ m_CmdBufferPool(m_LogicalVkDevice->GetSharedPtr(), pCmdQueue->GetQueueFamilyIndex(), VK_COMMAND_POOL_CREATE_TRANSIENT_BIT | VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT)
{
m_DeviceCaps.DevType = DeviceType::Vulkan;
m_DeviceCaps.MajorVersion = 1;
diff --git a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp
index bb069dd9..05895085 100644
--- a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp
@@ -62,8 +62,7 @@ TextureVkImpl :: TextureVkImpl(IReferenceCounters *pRefCounters,
RenderDeviceVkImpl *pRenderDeviceVk,
const TextureDesc& TexDesc,
const TextureData &InitData /*= TextureData()*/) :
- TTextureBase(pRefCounters, TexViewObjAllocator, pRenderDeviceVk, TexDesc),
- m_IsExternalHandle(false)
+ TTextureBase(pRefCounters, TexViewObjAllocator, pRenderDeviceVk, TexDesc)
{
if( m_Desc.Usage == USAGE_STATIC && InitData.pSubResources == nullptr )
LOG_ERROR_AND_THROW("Static Texture must be initialized with data at creation time");
@@ -346,8 +345,7 @@ TextureVkImpl::TextureVkImpl(IReferenceCounters *pRefCounters,
const TextureDesc& TexDesc,
VkImage VkImageHandle) :
TTextureBase(pRefCounters, TexViewObjAllocator, pDeviceVk, InitTexDescFromVkImage(VkImageHandle, TexDesc)),
- m_VulkanImage(nullptr, VkImageHandle),
- m_IsExternalHandle(true)
+ m_VulkanImage(nullptr, VkImageHandle)
{
}
IMPLEMENT_QUERY_INTERFACE( TextureVkImpl, IID_TextureVk, TTextureBase )
@@ -425,13 +423,11 @@ void TextureVkImpl::CreateViewInternal( const struct TextureViewDesc &ViewDesc,
TextureVkImpl :: ~TextureVkImpl()
{
- if(!m_IsExternalHandle)
- {
- auto *pDeviceVkImpl = ValidatedCast<RenderDeviceVkImpl>(GetDevice());
- // Vk object can only be destroyed when it is no longer used by the GPU
- pDeviceVkImpl->SafeReleaseVkObject(std::move(m_VulkanImage));
- pDeviceVkImpl->SafeReleaseVkObject(std::move(m_ImageMemory));
- }
+ auto *pDeviceVkImpl = ValidatedCast<RenderDeviceVkImpl>(GetDevice());
+ // Vk object can only be destroyed when it is no longer used by the GPU
+ // Wrappers for external texture will not be destroyed as they are created with null device pointer
+ pDeviceVkImpl->SafeReleaseVkObject(std::move(m_VulkanImage));
+ pDeviceVkImpl->SafeReleaseVkObject(std::move(m_ImageMemory));
}
void TextureVkImpl::UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box &DstBox, const TextureSubResData &SubresData )