mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 11:52:12 +01:00
[d3d9] Sync frame latency after presentation
This commit is contained in:
parent
f98a45b305
commit
787de33022
@ -778,10 +778,6 @@ namespace dxvk {
|
|||||||
auto swapImage = m_backBuffers[0]->GetCommonTexture()->GetImage();
|
auto swapImage = m_backBuffers[0]->GetCommonTexture()->GetImage();
|
||||||
auto swapImageView = m_backBuffers[0]->GetImageView(false);
|
auto swapImageView = m_backBuffers[0]->GetImageView(false);
|
||||||
|
|
||||||
// Wait for the sync event so that we respect the maximum frame latency
|
|
||||||
uint64_t frameId = ++m_frameId;
|
|
||||||
m_frameLatencySignal->wait(frameId - GetActualFrameLatency());
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < SyncInterval || i < 1; i++) {
|
for (uint32_t i = 0; i < SyncInterval || i < 1; i++) {
|
||||||
SynchronizePresent();
|
SynchronizePresent();
|
||||||
|
|
||||||
@ -819,11 +815,16 @@ namespace dxvk {
|
|||||||
m_hud->render(m_context, info.format, info.imageExtent);
|
m_hud->render(m_context, info.format, info.imageExtent);
|
||||||
|
|
||||||
if (i + 1 >= SyncInterval)
|
if (i + 1 >= SyncInterval)
|
||||||
m_context->signal(m_frameLatencySignal, frameId);
|
m_context->signal(m_frameLatencySignal, m_frameId);
|
||||||
|
|
||||||
SubmitPresent(sync, i);
|
SubmitPresent(sync, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bump our frame id.
|
||||||
|
++m_frameId;
|
||||||
|
|
||||||
|
SyncFrameLatency();
|
||||||
|
|
||||||
// Rotate swap chain buffers so that the back
|
// Rotate swap chain buffers so that the back
|
||||||
// buffer at index 0 becomes the front buffer.
|
// buffer at index 0 becomes the front buffer.
|
||||||
for (uint32_t i = 1; i < m_backBuffers.size(); i++)
|
for (uint32_t i = 1; i < m_backBuffers.size(); i++)
|
||||||
@ -1055,6 +1056,11 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void D3D9SwapChainEx::SyncFrameLatency() {
|
||||||
|
// Wait for the sync event so that we respect the maximum frame latency
|
||||||
|
m_frameLatencySignal->wait(m_frameId - GetActualFrameLatency());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t D3D9SwapChainEx::GetActualFrameLatency() {
|
uint32_t D3D9SwapChainEx::GetActualFrameLatency() {
|
||||||
uint32_t maxFrameLatency = m_parent->GetFrameLatency();
|
uint32_t maxFrameLatency = m_parent->GetFrameLatency();
|
||||||
|
@ -76,6 +76,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
const D3DPRESENT_PARAMETERS* GetPresentParams() const { return &m_presentParams; }
|
const D3DPRESENT_PARAMETERS* GetPresentParams() const { return &m_presentParams; }
|
||||||
|
|
||||||
|
void SyncFrameLatency();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
enum BindingIds : uint32_t {
|
enum BindingIds : uint32_t {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user