Vulkan: release all resources on RendererVk destroy

The most important part of this is unloading the libvulkan handle. We
open the handle in ::initialize but we were previously only unloading it
in ::~RendererVk[1]. Since a DisplayVk (and RendererVk) are not
destructed in between context creations, this meant that the libvulkan
library handle reference count only increased, never decreased.

[1] Which, incidentally, never gets invoked, ever. We create Display
    instances and they live forever in a static structure and we only
    ::initialize/::terminate them.

Bug: angleproject:8225
Change-Id: I03da9b19f0c4ae3b5efacd07880aadb7ee77ebf5
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4636882
Reviewed-by: Charlie Lao <cclao@google.com>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
This commit is contained in:
Steven Noonan
2023-06-22 01:47:33 -07:00
committed by Angle LUCI CQ
parent c1ba8e6f28
commit ac4f52c4f7

View File

@@ -1412,17 +1412,7 @@ RendererVk::RendererVk()
ASSERT(IsLittleEndian());
}
RendererVk::~RendererVk()
{
mAllocator.release();
mPipelineCache.release();
ASSERT(!hasSharedGarbage());
if (mLibVulkanLibrary)
{
angle::CloseSystemLibrary(mLibVulkanLibrary);
}
}
RendererVk::~RendererVk() {}
bool RendererVk::hasSharedGarbage()
{
@@ -1496,6 +1486,14 @@ void RendererVk::onDestroy(vk::Context *context)
mEnabledInstanceExtensions.clear();
mEnabledDeviceExtensions.clear();
ASSERT(!hasSharedGarbage());
if (mLibVulkanLibrary)
{
angle::CloseSystemLibrary(mLibVulkanLibrary);
mLibVulkanLibrary = nullptr;
}
}
void RendererVk::notifyDeviceLost()