mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 10:54:16 +01:00
[dxgi] Implement IDXGISwapChain2::SetFrameLatency
This commit is contained in:
parent
2d1fb52b2f
commit
ef37b5fed6
@ -108,6 +108,11 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
UINT STDMETHODCALLTYPE D3D11SwapChain::GetFrameLatency() {
|
||||||
|
return m_frameLatency;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE D3D11SwapChain::ChangeProperties(
|
HRESULT STDMETHODCALLTYPE D3D11SwapChain::ChangeProperties(
|
||||||
const DXGI_SWAP_CHAIN_DESC1* pDesc) {
|
const DXGI_SWAP_CHAIN_DESC1* pDesc) {
|
||||||
|
|
||||||
@ -164,6 +169,16 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE D3D11SwapChain::SetFrameLatency(
|
||||||
|
UINT MaxLatency) {
|
||||||
|
if (MaxLatency == 0 || MaxLatency > DXGI_MAX_SWAP_CHAIN_BUFFERS)
|
||||||
|
return DXGI_ERROR_INVALID_CALL;
|
||||||
|
|
||||||
|
m_frameLatency = MaxLatency;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE D3D11SwapChain::Present(
|
HRESULT STDMETHODCALLTYPE D3D11SwapChain::Present(
|
||||||
UINT SyncInterval,
|
UINT SyncInterval,
|
||||||
UINT PresentFlags,
|
UINT PresentFlags,
|
||||||
@ -718,8 +733,10 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
uint32_t D3D11SwapChain::GetActualFrameLatency() {
|
uint32_t D3D11SwapChain::GetActualFrameLatency() {
|
||||||
uint32_t maxFrameLatency = DefaultFrameLatency;
|
uint32_t maxFrameLatency = m_frameLatency;
|
||||||
m_dxgiDevice->GetMaximumFrameLatency(&maxFrameLatency);
|
|
||||||
|
if (!(m_desc.Flags & DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT))
|
||||||
|
m_dxgiDevice->GetMaximumFrameLatency(&maxFrameLatency);
|
||||||
|
|
||||||
if (m_frameLatencyCap)
|
if (m_frameLatencyCap)
|
||||||
maxFrameLatency = std::min(maxFrameLatency, m_frameLatencyCap);
|
maxFrameLatency = std::min(maxFrameLatency, m_frameLatencyCap);
|
||||||
|
@ -54,6 +54,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
UINT STDMETHODCALLTYPE GetImageIndex();
|
UINT STDMETHODCALLTYPE GetImageIndex();
|
||||||
|
|
||||||
|
UINT STDMETHODCALLTYPE GetFrameLatency();
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE ChangeProperties(
|
HRESULT STDMETHODCALLTYPE ChangeProperties(
|
||||||
const DXGI_SWAP_CHAIN_DESC1* pDesc);
|
const DXGI_SWAP_CHAIN_DESC1* pDesc);
|
||||||
|
|
||||||
@ -64,6 +66,9 @@ namespace dxvk {
|
|||||||
UINT NumControlPoints,
|
UINT NumControlPoints,
|
||||||
const DXGI_RGB* pControlPoints);
|
const DXGI_RGB* pControlPoints);
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE SetFrameLatency(
|
||||||
|
UINT MaxLatency);
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE Present(
|
HRESULT STDMETHODCALLTYPE Present(
|
||||||
UINT SyncInterval,
|
UINT SyncInterval,
|
||||||
UINT PresentFlags,
|
UINT PresentFlags,
|
||||||
@ -117,7 +122,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
std::vector<Rc<DxvkImageView>> m_imageViews;
|
std::vector<Rc<DxvkImageView>> m_imageViews;
|
||||||
|
|
||||||
uint64_t m_frameId = DXGI_MAX_SWAP_CHAIN_BUFFERS;
|
uint64_t m_frameId = DXGI_MAX_SWAP_CHAIN_BUFFERS;
|
||||||
|
uint32_t m_frameLatency = DefaultFrameLatency;
|
||||||
uint32_t m_frameLatencyCap = 0;
|
uint32_t m_frameLatencyCap = 0;
|
||||||
Rc<sync::Signal> m_frameLatencySignal;
|
Rc<sync::Signal> m_frameLatencySignal;
|
||||||
|
|
||||||
|
@ -56,6 +56,8 @@ IDXGIVkSwapChain : public IUnknown {
|
|||||||
|
|
||||||
virtual UINT STDMETHODCALLTYPE GetImageIndex() = 0;
|
virtual UINT STDMETHODCALLTYPE GetImageIndex() = 0;
|
||||||
|
|
||||||
|
virtual UINT STDMETHODCALLTYPE GetFrameLatency() = 0;
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE ChangeProperties(
|
virtual HRESULT STDMETHODCALLTYPE ChangeProperties(
|
||||||
const DXGI_SWAP_CHAIN_DESC1* pDesc) = 0;
|
const DXGI_SWAP_CHAIN_DESC1* pDesc) = 0;
|
||||||
|
|
||||||
@ -66,6 +68,9 @@ IDXGIVkSwapChain : public IUnknown {
|
|||||||
UINT NumControlPoints,
|
UINT NumControlPoints,
|
||||||
const DXGI_RGB* pControlPoints) = 0;
|
const DXGI_RGB* pControlPoints) = 0;
|
||||||
|
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE SetFrameLatency(
|
||||||
|
UINT MaxLatency) = 0;
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE Present(
|
virtual HRESULT STDMETHODCALLTYPE Present(
|
||||||
UINT SyncInterval,
|
UINT SyncInterval,
|
||||||
UINT PresentFlags,
|
UINT PresentFlags,
|
||||||
|
@ -421,8 +421,12 @@ namespace dxvk {
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE DxgiSwapChain::GetMaximumFrameLatency(
|
HRESULT STDMETHODCALLTYPE DxgiSwapChain::GetMaximumFrameLatency(
|
||||||
UINT* pMaxLatency) {
|
UINT* pMaxLatency) {
|
||||||
Logger::err("DxgiSwapChain::GetMaximumFrameLatency: Not implemented");
|
if (!(m_desc.Flags & DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT))
|
||||||
return DXGI_ERROR_INVALID_CALL;
|
return DXGI_ERROR_INVALID_CALL;
|
||||||
|
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(m_lockWindow);
|
||||||
|
*pMaxLatency = m_presenter->GetFrameLatency();
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -446,8 +450,11 @@ namespace dxvk {
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE DxgiSwapChain::SetMaximumFrameLatency(
|
HRESULT STDMETHODCALLTYPE DxgiSwapChain::SetMaximumFrameLatency(
|
||||||
UINT MaxLatency) {
|
UINT MaxLatency) {
|
||||||
Logger::err("DxgiSwapChain::SetMaximumFrameLatency: Not implemented");
|
if (!(m_desc.Flags & DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT))
|
||||||
return DXGI_ERROR_INVALID_CALL;
|
return DXGI_ERROR_INVALID_CALL;
|
||||||
|
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(m_lockWindow);
|
||||||
|
return m_presenter->SetFrameLatency(MaxLatency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user