From c93f2b980eb6ae8d7539122d8351a7bfda7bbf0e Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 13 Jun 2018 14:29:58 +0200 Subject: [PATCH] [d3d11] Report correct timer frequency for TIMESTAMP_DISJOINT queries --- src/d3d11/d3d11_query.cpp | 12 ++++++++++-- src/d3d11/d3d11_query.h | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/d3d11/d3d11_query.cpp b/src/d3d11/d3d11_query.cpp index 9a51e3bf2..d872acddd 100644 --- a/src/d3d11/d3d11_query.cpp +++ b/src/d3d11/d3d11_query.cpp @@ -208,9 +208,8 @@ namespace dxvk { return S_OK; case D3D11_QUERY_TIMESTAMP_DISJOINT: { - // FIXME return correct frequency auto data = static_cast(pData); - data->Frequency = 1000; + data->Frequency = GetTimestampQueryFrequency(); data->Disjoint = FALSE; } return S_OK; @@ -236,4 +235,13 @@ namespace dxvk { } } + + UINT64 D3D11Query::GetTimestampQueryFrequency() const { + Rc device = m_device->GetDXVKDevice(); + Rc adapter = device->adapter(); + + VkPhysicalDeviceLimits limits = adapter->deviceProperties().limits; + return uint64_t(1'000'000'000.0f / limits.timestampPeriod); + } + } diff --git a/src/d3d11/d3d11_query.h b/src/d3d11/d3d11_query.h index 7d4d48e6c..a9aa53603 100644 --- a/src/d3d11/d3d11_query.h +++ b/src/d3d11/d3d11_query.h @@ -52,6 +52,8 @@ namespace dxvk { Rc m_event = nullptr; uint32_t m_revision = 0; + + UINT64 GetTimestampQueryFrequency() const; };