Skip to content

Commit

Permalink
Reduce back buffer count in reduced latency mode, since the default (…
Browse files Browse the repository at this point in the history
…3) is triple buffering
  • Loading branch information
kg committed Jan 22, 2024
1 parent 1b7f307 commit 86cda78
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/FNA3D_Driver_D3D11.c
Original file line number Diff line number Diff line change
Expand Up @@ -2540,6 +2540,7 @@ static void D3D11_INTERNAL_CreateSwapChain(
IDXGIDevice1 *dxgiDevice;
DXGI_COLOR_SPACE_TYPE colorSpace;
HRESULT res;
int reducedLatency = SDL_GetHintBoolean("FNA3D_REDUCED_FRAME_LATENCY", SDL_FALSE);

uint8_t growSwapchains = (swapchainData == NULL);

Expand All @@ -2565,7 +2566,7 @@ static void D3D11_INTERNAL_CreateSwapChain(
swapchainDesc.SampleDesc.Count = 1;
swapchainDesc.SampleDesc.Quality = 0;
swapchainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapchainDesc.BufferCount = 3;
swapchainDesc.BufferCount = reducedLatency ? 2 : 3;
swapchainDesc.OutputWindow = dxgiHandle;
swapchainDesc.Windowed = 1;
if (renderer->supportsTearing)
Expand Down Expand Up @@ -2669,7 +2670,7 @@ static void D3D11_INTERNAL_CreateSwapChain(
}
}

if (SDL_GetHintBoolean("FNA3D_REDUCED_FRAME_LATENCY", SDL_FALSE))
if (reducedLatency)
{
/*
If possible, limit queued frames to 1. (The default is 3.)
Expand Down

0 comments on commit 86cda78

Please sign in to comment.