mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-06 22:53:35 +00:00
TextureVk: Don't release swapchain-owned images
This commit is contained in:
parent
27570bd5b4
commit
6e01758dcd
@ -283,15 +283,17 @@ namespace backend { namespace vulkan {
|
|||||||
Texture::~Texture() {
|
Texture::~Texture() {
|
||||||
Device* device = ToBackend(GetDevice());
|
Device* device = ToBackend(GetDevice());
|
||||||
|
|
||||||
// We need to free both the memory allocation and the container. Memory should be freed
|
|
||||||
// after the VkImage is destroyed and this is taken care of by the FencedDeleter.
|
|
||||||
device->GetMemoryAllocator()->Free(&mMemoryAllocation);
|
|
||||||
|
|
||||||
// If we own the resource, release it.
|
// If we own the resource, release it.
|
||||||
if (mHandle != VK_NULL_HANDLE) {
|
if (mMemoryAllocation.GetMemory() != VK_NULL_HANDLE) {
|
||||||
device->GetFencedDeleter()->DeleteWhenUnused(mHandle);
|
// We need to free both the memory allocation and the container. Memory should be freed
|
||||||
mHandle = VK_NULL_HANDLE;
|
// after the VkImage is destroyed and this is taken care of by the FencedDeleter.
|
||||||
|
device->GetMemoryAllocator()->Free(&mMemoryAllocation);
|
||||||
|
|
||||||
|
if (mHandle != VK_NULL_HANDLE) {
|
||||||
|
device->GetFencedDeleter()->DeleteWhenUnused(mHandle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
mHandle = VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkImage Texture::GetHandle() const {
|
VkImage Texture::GetHandle() const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user