Reduce host swap chain latency
This commit is contained in:
@@ -63,6 +63,8 @@ bool D3D12WindowSwapChainPresenter::CreateSwapChain(int width, int height) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ConfigureFrameLatency();
|
||||
|
||||
if (!RecreateBackBufferViews()) {
|
||||
m_lastError = "Failed to create swap chain back buffer views.";
|
||||
return false;
|
||||
@@ -73,6 +75,21 @@ bool D3D12WindowSwapChainPresenter::CreateSwapChain(int width, int height) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void D3D12WindowSwapChainPresenter::ConfigureFrameLatency() {
|
||||
D3D12SwapChain* d3d12SwapChain = GetD3D12SwapChain();
|
||||
if (d3d12SwapChain == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* nativeSwapChain =
|
||||
static_cast<IDXGISwapChain3*>(d3d12SwapChain->GetNativeHandle());
|
||||
if (nativeSwapChain == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
nativeSwapChain->SetMaximumFrameLatency(1u);
|
||||
}
|
||||
|
||||
void D3D12WindowSwapChainPresenter::DestroySwapChain() {
|
||||
ReleaseBackBufferViews();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user