From 2438b00856a5abf53e84284dd7d9e2e0d339dbb4 Mon Sep 17 00:00:00 2001 From: Caleb Cornett Date: Sat, 17 Oct 2026 11:22:50 -0400 Subject: [PATCH] vulkan: Remove uninitialized defragLock --- src/gpu/vulkan/SDL_gpu_vulkan.c | 37 --------------------------------- 1 file changed, 37 deletions(-) diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index 9097aae69b57c..f69e810fc2da2 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -1235,10 +1235,6 @@ struct VulkanRenderer SDL_Mutex *descriptorSetLayoutFetchLock; SDL_Mutex *windowLock; - // We don't want transfer commands to block each other, - // but we want all transfers to block during defrag. - SDL_RWLock *defragLock; - Uint8 defragInProgress; VulkanMemoryAllocation **allocationsToDefrag; @@ -8897,8 +8893,6 @@ static void VULKAN_UploadToTexture( VulkanTextureSubresource *vulkanTextureSubresource; VkBufferImageCopy imageCopy; - SDL_LockRWLockForReading(renderer->defragLock); - // Note that the transfer buffer does not need a barrier, as it is synced by the client vulkanTextureSubresource = VULKAN_INTERNAL_PrepareTextureSubresourceForWrite( renderer, @@ -8940,8 +8934,6 @@ static void VULKAN_UploadToTexture( VULKAN_INTERNAL_TrackBuffer(vulkanCommandBuffer, transferBufferContainer->activeBuffer); VULKAN_INTERNAL_TrackTexture(vulkanCommandBuffer, vulkanTextureSubresource->parent); VULKAN_INTERNAL_TrackTextureTransfer(vulkanCommandBuffer, vulkanTextureSubresource->parent); - - SDL_UnlockRWLock(renderer->defragLock); } static void VULKAN_UploadToBuffer( @@ -8956,8 +8948,6 @@ static void VULKAN_UploadToBuffer( VulkanBufferContainer *bufferContainer = (VulkanBufferContainer *)destination->buffer; VkBufferCopy bufferCopy; - SDL_LockRWLockForReading(renderer->defragLock); - // Note that the transfer buffer does not need a barrier, as it is synced by the client VulkanBuffer *vulkanBuffer = VULKAN_INTERNAL_PrepareBufferForWrite( renderer, @@ -8987,8 +8977,6 @@ static void VULKAN_UploadToBuffer( VULKAN_INTERNAL_TrackBuffer(vulkanCommandBuffer, transferBufferContainer->activeBuffer); VULKAN_INTERNAL_TrackBuffer(vulkanCommandBuffer, vulkanBuffer); VULKAN_INTERNAL_TrackBufferTransfer(vulkanCommandBuffer, vulkanBuffer); - - SDL_UnlockRWLock(renderer->defragLock); } // Readback @@ -9005,8 +8993,6 @@ static void VULKAN_DownloadFromTexture( VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer *)destination->transfer_buffer; VkBufferImageCopy imageCopy; - SDL_LockRWLockForReading(renderer->defragLock); - vulkanTextureSubresource = VULKAN_INTERNAL_FetchTextureSubresource( textureContainer, source->layer, @@ -9051,8 +9037,6 @@ static void VULKAN_DownloadFromTexture( VULKAN_INTERNAL_TrackBuffer(vulkanCommandBuffer, transferBufferContainer->activeBuffer); VULKAN_INTERNAL_TrackTexture(vulkanCommandBuffer, vulkanTextureSubresource->parent); VULKAN_INTERNAL_TrackTextureTransfer(vulkanCommandBuffer, vulkanTextureSubresource->parent); - - SDL_UnlockRWLock(renderer->defragLock); } static void VULKAN_DownloadFromBuffer( @@ -9066,8 +9050,6 @@ static void VULKAN_DownloadFromBuffer( VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer *)destination->transfer_buffer; VkBufferCopy bufferCopy; - SDL_LockRWLockForReading(renderer->defragLock); - // Note that transfer buffer does not need a barrier, as it is synced by the client VULKAN_INTERNAL_BufferTransitionFromDefaultUsage( renderer, @@ -9095,8 +9077,6 @@ static void VULKAN_DownloadFromBuffer( VULKAN_INTERNAL_TrackBuffer(vulkanCommandBuffer, transferBufferContainer->activeBuffer); VULKAN_INTERNAL_TrackBuffer(vulkanCommandBuffer, bufferContainer->activeBuffer); VULKAN_INTERNAL_TrackBufferTransfer(vulkanCommandBuffer, bufferContainer->activeBuffer); - - SDL_UnlockRWLock(renderer->defragLock); } static void VULKAN_CopyTextureToTexture( @@ -9114,8 +9094,6 @@ static void VULKAN_CopyTextureToTexture( VulkanTextureSubresource *dstSubresource; VkImageCopy imageCopy; - SDL_LockRWLockForReading(renderer->defragLock); - srcSubresource = VULKAN_INTERNAL_FetchTextureSubresource( (VulkanTextureContainer *)source->texture, source->layer, @@ -9179,8 +9157,6 @@ static void VULKAN_CopyTextureToTexture( VULKAN_INTERNAL_TrackTexture(vulkanCommandBuffer, dstSubresource->parent); VULKAN_INTERNAL_TrackTextureTransfer(vulkanCommandBuffer, srcSubresource->parent); VULKAN_INTERNAL_TrackTextureTransfer(vulkanCommandBuffer, dstSubresource->parent); - - SDL_UnlockRWLock(renderer->defragLock); } static void VULKAN_CopyBufferToBuffer( @@ -9196,8 +9172,6 @@ static void VULKAN_CopyBufferToBuffer( VulkanBufferContainer *dstContainer = (VulkanBufferContainer *)destination->buffer; VkBufferCopy bufferCopy; - SDL_LockRWLockForReading(renderer->defragLock); - VulkanBuffer *dstBuffer = VULKAN_INTERNAL_PrepareBufferForWrite( renderer, vulkanCommandBuffer, @@ -9238,8 +9212,6 @@ static void VULKAN_CopyBufferToBuffer( VULKAN_INTERNAL_TrackBuffer(vulkanCommandBuffer, dstBuffer); VULKAN_INTERNAL_TrackBufferTransfer(vulkanCommandBuffer, srcContainer->activeBuffer); VULKAN_INTERNAL_TrackBufferTransfer(vulkanCommandBuffer, dstBuffer); - - SDL_UnlockRWLock(renderer->defragLock); } static void VULKAN_GenerateMipmaps( @@ -9253,8 +9225,6 @@ static void VULKAN_GenerateMipmaps( VulkanTextureSubresource *dstTextureSubresource; VkImageBlit blit; - SDL_LockRWLockForReading(renderer->defragLock); - // Blit each slice sequentially. Barriers, barriers everywhere! for (Uint32 layerOrDepthIndex = 0; layerOrDepthIndex < container->header.info.layer_count_or_depth; layerOrDepthIndex += 1) { for (Uint32 level = 1; level < container->header.info.num_levels; level += 1) { @@ -9340,8 +9310,6 @@ static void VULKAN_GenerateMipmaps( } } - - SDL_UnlockRWLock(renderer->defragLock); } static void VULKAN_EndCopyPass( @@ -11039,7 +11007,6 @@ static bool VULKAN_INTERNAL_DefragmentMemory( commandBuffer->isDefrag = 1; SDL_LockMutex(renderer->allocatorLock); - SDL_LockRWLockForWriting(renderer->defragLock); // Find an allocation that doesn't have any pending transfer operations Sint32 indexToDefrag = -1; @@ -11052,7 +11019,6 @@ static bool VULKAN_INTERNAL_DefragmentMemory( if (indexToDefrag == -1) { // Nothing is available to defrag, but it's not an error - SDL_UnlockRWLock(renderer->defragLock); SDL_UnlockMutex(renderer->allocatorLock); return true; } @@ -11082,7 +11048,6 @@ static bool VULKAN_INTERNAL_DefragmentMemory( currentRegion->vulkanBuffer->container != NULL ? currentRegion->vulkanBuffer->container->debugName : NULL); if (newBuffer == NULL) { - SDL_UnlockRWLock(renderer->defragLock); SDL_UnlockMutex(renderer->allocatorLock); SDL_LogError(SDL_LOG_CATEGORY_GPU, "%s", "Failed to allocate defrag buffer!"); return false; @@ -11148,7 +11113,6 @@ static bool VULKAN_INTERNAL_DefragmentMemory( ¤tRegion->vulkanTexture->container->header.info); if (newTexture == NULL) { - SDL_UnlockRWLock(renderer->defragLock); SDL_UnlockMutex(renderer->allocatorLock); SDL_LogError(SDL_LOG_CATEGORY_GPU, "%s", "Failed to allocate defrag buffer!"); return false; @@ -11225,7 +11189,6 @@ static bool VULKAN_INTERNAL_DefragmentMemory( } } - SDL_UnlockRWLock(renderer->defragLock); SDL_UnlockMutex(renderer->allocatorLock); return true;