Skip to content

Commit 86cda78

Browse files
committed
Reduce back buffer count in reduced latency mode, since the default (3) is triple buffering
1 parent 1b7f307 commit 86cda78

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/FNA3D_Driver_D3D11.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -2540,6 +2540,7 @@ static void D3D11_INTERNAL_CreateSwapChain(
25402540
IDXGIDevice1 *dxgiDevice;
25412541
DXGI_COLOR_SPACE_TYPE colorSpace;
25422542
HRESULT res;
2543+
int reducedLatency = SDL_GetHintBoolean("FNA3D_REDUCED_FRAME_LATENCY", SDL_FALSE);
25432544

25442545
uint8_t growSwapchains = (swapchainData == NULL);
25452546

@@ -2565,7 +2566,7 @@ static void D3D11_INTERNAL_CreateSwapChain(
25652566
swapchainDesc.SampleDesc.Count = 1;
25662567
swapchainDesc.SampleDesc.Quality = 0;
25672568
swapchainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
2568-
swapchainDesc.BufferCount = 3;
2569+
swapchainDesc.BufferCount = reducedLatency ? 2 : 3;
25692570
swapchainDesc.OutputWindow = dxgiHandle;
25702571
swapchainDesc.Windowed = 1;
25712572
if (renderer->supportsTearing)
@@ -2669,7 +2670,7 @@ static void D3D11_INTERNAL_CreateSwapChain(
26692670
}
26702671
}
26712672

2672-
if (SDL_GetHintBoolean("FNA3D_REDUCED_FRAME_LATENCY", SDL_FALSE))
2673+
if (reducedLatency)
26732674
{
26742675
/*
26752676
If possible, limit queued frames to 1. (The default is 3.)

0 commit comments

Comments
 (0)