From 441691227f34a5ab6bb901f96836548cc488c327 Mon Sep 17 00:00:00 2001 From: squidbus <175574877+squidbus@users.noreply.github.com> Date: Tue, 12 Aug 2025 17:46:56 -0700 Subject: [PATCH] Improve texture memory usage --- MarathonRecomp/gpu/video.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MarathonRecomp/gpu/video.cpp b/MarathonRecomp/gpu/video.cpp index e374f322f..0e42f47e1 100644 --- a/MarathonRecomp/gpu/video.cpp +++ b/MarathonRecomp/gpu/video.cpp @@ -724,6 +724,7 @@ static void DestructTempResources() { case ResourceType::Texture: case ResourceType::VolumeTexture: + case ResourceType::ArrayTexture: { const auto texture = reinterpret_cast(resource); @@ -731,10 +732,14 @@ static void DestructTempResources() g_userHeap.Free(texture->mappedMemory); } + g_textureDescriptorSet->setTexture(texture->descriptorIndex, nullptr, {}); g_textureDescriptorAllocator.free(texture->descriptorIndex); if (texture->patchedTexture != nullptr) + { + g_textureDescriptorSet->setTexture(texture->patchedTexture->descriptorIndex, nullptr, {}); g_textureDescriptorAllocator.free(texture->patchedTexture->descriptorIndex); + } texture->~GuestTexture(); break; @@ -759,7 +764,10 @@ static void DestructTempResources() const auto surface = reinterpret_cast(resource); if (surface->descriptorIndex != NULL) + { + g_textureDescriptorSet->setTexture(surface->descriptorIndex, nullptr, {}); g_textureDescriptorAllocator.free(surface->descriptorIndex); + } surface->~GuestSurface(); break;