diff --git a/src/d3d11/d3d11_context_imm.cpp b/src/d3d11/d3d11_context_imm.cpp index afd6a7c7..f24bae1f 100644 --- a/src/d3d11/d3d11_context_imm.cpp +++ b/src/d3d11/d3d11_context_imm.cpp @@ -77,10 +77,6 @@ namespace dxvk { // DataSize is 0, but we should ignore that pointer pData = DataSize ? pData : nullptr; - // Ensure that all query commands actually get - // executed before trying to access the query - SynchronizeCsThread(); - // Get query status directly from the query object auto query = static_cast(pAsync); HRESULT hr = query->GetData(pData, GetDataFlags); diff --git a/src/d3d11/d3d11_query.cpp b/src/d3d11/d3d11_query.cpp index b434a1c7..1d47b47a 100644 --- a/src/d3d11/d3d11_query.cpp +++ b/src/d3d11/d3d11_query.cpp @@ -214,6 +214,8 @@ namespace dxvk { if (unlikely(m_predicate != nullptr)) ctx->writePredicate(DxvkBufferSlice(m_predicate), m_query[0]); + + m_resetCtr -= 1; } @@ -230,6 +232,7 @@ namespace dxvk { return false; m_state = D3D11_VK_QUERY_ENDED; + m_resetCtr += 1; return true; } @@ -237,6 +240,12 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE D3D11Query::GetData( void* pData, UINT GetDataFlags) { + if (m_state != D3D11_VK_QUERY_ENDED) + return DXGI_ERROR_INVALID_CALL; + + if (m_resetCtr != 0u) + return S_FALSE; + if (m_desc.Query == D3D11_QUERY_EVENT) { DxvkGpuEventStatus status = m_event[0]->test(); diff --git a/src/d3d11/d3d11_query.h b/src/d3d11/d3d11_query.h index c70cd837..ea1e7f1e 100644 --- a/src/d3d11/d3d11_query.h +++ b/src/d3d11/d3d11_query.h @@ -114,6 +114,8 @@ namespace dxvk { uint32_t m_stallMask = 0; bool m_stallFlag = false; + std::atomic m_resetCtr = { 0u }; + UINT64 GetTimestampQueryFrequency() const; Rc CreatePredicateBuffer();