if (FAILED(hr))
CLog::Log(LOGERROR, "%s - Failed to switch output mode: %s", __FUNCTION__, GetErrorDescription(hr).c_str());
}
-
- // wait until switching screen state is done
DXWait(m_pD3DDev, m_pImdContext);
}
+ // in windowed mode DWM uses triple buffering in any case.
+ // for FSEM we use double buffering
+ SetMaximumFrameLatency(2 - m_useWindowedDX);
}
bool CRenderSystemDX::IsFormatSupport(DXGI_FORMAT format, unsigned int usage)
pMultiThreading->Release();
}
- IDXGIDevice1* pDXGIDevice = NULL;
- if (SUCCEEDED(m_pD3DDev->QueryInterface(__uuidof(IDXGIDevice1), reinterpret_cast<void**>(&pDXGIDevice))))
- {
- // Not sure the following actually does something but this exists in dx9 implementation
- pDXGIDevice->SetGPUThreadPriority(7);
- // Ensure that DXGI does not queue more than one frame at a time. This both reduces
- // latency and ensures that the application will only render after each VSync
- pDXGIDevice->SetMaximumFrameLatency(1);
- SAFE_RELEASE(pDXGIDevice);
- }
+ // in windowed mode DWM uses triple buffering in any case.
+ // for FSEM we use double buffering
+ SetMaximumFrameLatency(2 - m_useWindowedDX);
#ifdef _DEBUG
if (SUCCEEDED(m_pD3DDev->QueryInterface(__uuidof(ID3D11Debug), reinterpret_cast<void**>(&m_d3dDebug))))
SAFE_RELEASE(pCommandList);
}
+void CRenderSystemDX::SetMaximumFrameLatency(uint32_t latency)
+{
+ if (!m_pD3DDev)
+ return;
+
+ IDXGIDevice1* pDXGIDevice = nullptr;
+ if (SUCCEEDED(m_pD3DDev->QueryInterface(__uuidof(IDXGIDevice1), reinterpret_cast<void**>(&pDXGIDevice))))
+ {
+ pDXGIDevice->SetMaximumFrameLatency(latency);
+ SAFE_RELEASE(pDXGIDevice);
+ }
+}
+
#endif
void SetFullScreenInternal();
void GetClosestDisplayModeToCurrent(IDXGIOutput* output, DXGI_MODE_DESC* outCurrentDisplayMode, bool useCached = false);
void CheckInterlasedStereoView(void);
+ void SetMaximumFrameLatency(uint32_t latency);
virtual void UpdateMonitor() {};