mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-05 19:08:12 +00:00
GPU: Fix Vulkan backend never checking deallocations (#12567)
---------
Co-authored-by: Sam Lantinga <slouken@libsdl.org>
(cherry picked from commit 0bd70684b3
)
This commit is contained in:

committed by
Sam Lantinga

parent
cd673c8254
commit
daf468e141
@@ -1135,6 +1135,7 @@ struct VulkanRenderer
|
||||
|
||||
VulkanMemoryAllocator *memoryAllocator;
|
||||
VkPhysicalDeviceMemoryProperties memoryProperties;
|
||||
bool checkEmptyAllocations;
|
||||
|
||||
WindowData **claimedWindows;
|
||||
Uint32 claimedWindowCount;
|
||||
@@ -1577,6 +1578,10 @@ static void VULKAN_INTERNAL_RemoveMemoryUsedRegion(
|
||||
usedRegion->offset,
|
||||
usedRegion->size);
|
||||
|
||||
if (usedRegion->allocation->usedRegionCount == 0) {
|
||||
renderer->checkEmptyAllocations = true;
|
||||
}
|
||||
|
||||
SDL_free(usedRegion);
|
||||
|
||||
SDL_UnlockMutex(renderer->allocatorLock);
|
||||
@@ -10433,7 +10438,6 @@ static bool VULKAN_Submit(
|
||||
VkPipelineStageFlags waitStages[MAX_PRESENT_COUNT];
|
||||
Uint32 swapchainImageIndex;
|
||||
VulkanTextureSubresource *swapchainTextureSubresource;
|
||||
Uint8 commandBufferCleaned = 0;
|
||||
VulkanMemorySubAllocator *allocator;
|
||||
bool presenting = false;
|
||||
|
||||
@@ -10549,12 +10553,10 @@ static bool VULKAN_Submit(
|
||||
renderer,
|
||||
renderer->submittedCommandBuffers[i],
|
||||
false);
|
||||
|
||||
commandBufferCleaned = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (commandBufferCleaned) {
|
||||
if (renderer->checkEmptyAllocations) {
|
||||
SDL_LockMutex(renderer->allocatorLock);
|
||||
|
||||
for (Uint32 i = 0; i < VK_MAX_MEMORY_TYPES; i += 1) {
|
||||
@@ -10570,6 +10572,8 @@ static bool VULKAN_Submit(
|
||||
}
|
||||
}
|
||||
|
||||
renderer->checkEmptyAllocations = false;
|
||||
|
||||
SDL_UnlockMutex(renderer->allocatorLock);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user