Переглянути джерело

gpu: Fix swapchain texture cycling.

This is actually a 1:1 copy of a patch we wrote for GPU PS5 some time ago!
Ethan Lee 1 тиждень тому
батько
коміт
0c57e99b4a
1 змінених файлів з 4 додано та 1 видалено
  1. 4 1
      src/gpu/d3d12/SDL_gpu_d3d12.c

+ 4 - 1
src/gpu/d3d12/SDL_gpu_d3d12.c

@@ -8107,7 +8107,10 @@ static bool D3D12_Submit(
 
 
         windowData->inFlightFences[windowData->frameCounter] = (SDL_GPUFence *)d3d12CommandBuffer->inFlightFence;
         windowData->inFlightFences[windowData->frameCounter] = (SDL_GPUFence *)d3d12CommandBuffer->inFlightFence;
         (void)SDL_AtomicIncRef(&d3d12CommandBuffer->inFlightFence->referenceCount);
         (void)SDL_AtomicIncRef(&d3d12CommandBuffer->inFlightFence->referenceCount);
-        windowData->frameCounter = (windowData->frameCounter + 1) % renderer->allowedFramesInFlight;
+
+        // Normally this is '% allowedFramesInFlight', but the value gets clamped
+        // at swapchain creation time, so use swapchainTextureCount instead
+        windowData->frameCounter = (windowData->frameCounter + 1) % windowData->swapchainTextureCount;
     }
     }
 
 
     // Check for cleanups
     // Check for cleanups