summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/Texture2D.cpp
diff options
context:
space:
mode:
authorshuffle2 <godisgovernment@gmail.com>2016-10-04 01:47:59 -0700
committerGitHub <noreply@github.com>2016-10-04 01:47:59 -0700
commitea33405febf183058bb30a22f4f627fed4bb8e17 (patch)
tree6222aceb31b2d6d922a8b3e45331b42fa1abba2d /Source/Core/VideoBackends/Vulkan/Texture2D.cpp
parent037f0a1803c274ce7e9f97ff9b7baed2955b9004 (diff)
parent28e5fa8d261cd486e9339a66d91b4713e83d9a14 (diff)
Merge pull request #4270 from stenzek/vulkan-defer-fix
Vulkan: Miscellaneous minor fixes
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/Texture2D.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/Texture2D.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/Texture2D.cpp b/Source/Core/VideoBackends/Vulkan/Texture2D.cpp
index 470328c47c..9dda089b21 100644
--- a/Source/Core/VideoBackends/Vulkan/Texture2D.cpp
+++ b/Source/Core/VideoBackends/Vulkan/Texture2D.cpp
@@ -21,13 +21,13 @@ Texture2D::Texture2D(u32 width, u32 height, u32 levels, u32 layers, VkFormat for
Texture2D::~Texture2D()
{
- g_command_buffer_mgr->DeferResourceDestruction(m_view);
+ g_command_buffer_mgr->DeferImageViewDestruction(m_view);
// If we don't have device memory allocated, the image is not owned by us (e.g. swapchain)
if (m_device_memory != VK_NULL_HANDLE)
{
- g_command_buffer_mgr->DeferResourceDestruction(m_image);
- g_command_buffer_mgr->DeferResourceDestruction(m_device_memory);
+ g_command_buffer_mgr->DeferImageDestruction(m_image);
+ g_command_buffer_mgr->DeferDeviceMemoryDestruction(m_device_memory);
}
}
@@ -134,6 +134,8 @@ std::unique_ptr<Texture2D> Texture2D::CreateFromExistingImage(u32 width, u32 hei
static_cast<VkImageAspectFlags>(VK_IMAGE_ASPECT_COLOR_BIT),
0, levels, 0, layers}};
+ // Memory is managed by the owner of the image.
+ VkDeviceMemory memory = VK_NULL_HANDLE;
VkImageView view = VK_NULL_HANDLE;
VkResult res = vkCreateImageView(g_vulkan_context->GetDevice(), &view_info, nullptr, &view);
if (res != VK_SUCCESS)
@@ -143,7 +145,7 @@ std::unique_ptr<Texture2D> Texture2D::CreateFromExistingImage(u32 width, u32 hei
}
return std::make_unique<Texture2D>(width, height, levels, layers, format, samples, view_type,
- existing_image, nullptr, view);
+ existing_image, memory, view);
}
void Texture2D::OverrideImageLayout(VkImageLayout new_layout)