mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-11-04 01:34:38 +00:00 
			
		
		
		
	Fix SDL GPU D3D12 Descriptor Heap leak
When descriptor leaks overflow, the D3D12 SDL GPU renderer fetches more from the pool, but never returns them, which eventually causes an "out of memory" crash.
This commit is contained in:
		@@ -4885,7 +4885,14 @@ static void D3D12_INTERNAL_SetGPUDescriptorHeaps(D3D12CommandBuffer *commandBuff
 | 
			
		||||
    viewHeap = D3D12_INTERNAL_AcquireGPUDescriptorHeapFromPool(commandBuffer, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
 | 
			
		||||
    samplerHeap = D3D12_INTERNAL_AcquireGPUDescriptorHeapFromPool(commandBuffer, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
 | 
			
		||||
 | 
			
		||||
    if (commandBuffer->gpuDescriptorHeaps[0] != NULL) {
 | 
			
		||||
        D3D12_INTERNAL_ReturnGPUDescriptorHeapToPool(commandBuffer->renderer, commandBuffer->gpuDescriptorHeaps[0]);
 | 
			
		||||
    }
 | 
			
		||||
    commandBuffer->gpuDescriptorHeaps[0] = viewHeap;
 | 
			
		||||
 | 
			
		||||
    if (commandBuffer->gpuDescriptorHeaps[1] != NULL) {
 | 
			
		||||
        D3D12_INTERNAL_ReturnGPUDescriptorHeapToPool(commandBuffer->renderer, commandBuffer->gpuDescriptorHeaps[1]);
 | 
			
		||||
    }
 | 
			
		||||
    commandBuffer->gpuDescriptorHeaps[1] = samplerHeap;
 | 
			
		||||
 | 
			
		||||
    heaps[0] = viewHeap->handle;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user