Skip to content

Commit 25989c5

Browse files
authored
Improve texture memory usage (#93)
1 parent fad8862 commit 25989c5

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

MarathonRecomp/gpu/video.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,17 +724,22 @@ static void DestructTempResources()
724724
{
725725
case ResourceType::Texture:
726726
case ResourceType::VolumeTexture:
727+
case ResourceType::ArrayTexture:
727728
{
728729
const auto texture = reinterpret_cast<GuestTexture*>(resource);
729730

730731
if (texture->mappedMemory != nullptr) {
731732
g_userHeap.Free(texture->mappedMemory);
732733
}
733734

735+
g_textureDescriptorSet->setTexture(texture->descriptorIndex, nullptr, {});
734736
g_textureDescriptorAllocator.free(texture->descriptorIndex);
735737

736738
if (texture->patchedTexture != nullptr)
739+
{
740+
g_textureDescriptorSet->setTexture(texture->patchedTexture->descriptorIndex, nullptr, {});
737741
g_textureDescriptorAllocator.free(texture->patchedTexture->descriptorIndex);
742+
}
738743

739744
texture->~GuestTexture();
740745
break;
@@ -759,7 +764,10 @@ static void DestructTempResources()
759764
const auto surface = reinterpret_cast<GuestSurface*>(resource);
760765

761766
if (surface->descriptorIndex != NULL)
767+
{
768+
g_textureDescriptorSet->setTexture(surface->descriptorIndex, nullptr, {});
762769
g_textureDescriptorAllocator.free(surface->descriptorIndex);
770+
}
763771

764772
surface->~GuestSurface();
765773
break;

0 commit comments

Comments
 (0)