mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-02 10:43:44 +01:00
Extra safety when switching GPU backends, fix possible Vulkan shutdown issue. Should help #10005
This commit is contained in:
1 parent
bb1f651182
commit
3757070fe2
3 files changed
+15
-6
No files matched your search
@@ -135,13 +135,16 @@ TextureCacheVulkan::TextureCacheVulkan(Draw::DrawContext *draw, VulkanContext *v
|
||||
|
||||
TextureCacheVulkan::~TextureCacheVulkan() {
|
||||
Clear(true);
|
||||
allocator_->Destroy();
|
||||
|
||||
// We have to delete on queue, so this can free its queued deletions.
|
||||
vulkan_->Delete().QueueCallback([](void *ptr) {
|
||||
auto allocator = static_cast<VulkanDeviceAllocator *>(ptr);
|
||||
delete allocator;
|
||||
}, allocator_);
|
||||
if (allocator_) {
|
||||
allocator_->Destroy();
|
||||
|
||||
// We have to delete on queue, so this can free its queued deletions.
|
||||
vulkan_->Delete().QueueCallback([](void *ptr) {
|
||||
auto allocator = static_cast<VulkanDeviceAllocator *>(ptr);
|
||||
delete allocator;
|
||||
}, allocator_);
|
||||
}
|
||||
}
|
||||
|
||||
void TextureCacheVulkan::SetFramebufferManager(FramebufferManagerVulkan *fbManager) {
|
||||
@@ -171,6 +174,8 @@ void TextureCacheVulkan::DeviceLost() {
|
||||
void TextureCacheVulkan::DeviceRestore(VulkanContext *vulkan) {
|
||||
vulkan_ = vulkan;
|
||||
|
||||
assert(!allocator_);
|
||||
|
||||
allocator_ = new VulkanDeviceAllocator(vulkan_, TEXCACHE_MIN_SLAB_SIZE, TEXCACHE_MAX_SLAB_SIZE);
|
||||
samplerCache_.DeviceRestore(vulkan);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user