mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 05:52:11 +01:00
[d3d11] Move query state tracking to immediate context implementation
This commit is contained in:
parent
be5dc234c1
commit
0924bb469c
@ -68,6 +68,9 @@ namespace dxvk {
|
||||
|
||||
|
||||
void D3D11CommandList::EmitToCsThread(DxvkCsThread* CsThread) {
|
||||
for (const auto& query : m_queries)
|
||||
query->DoDeferredEnd();
|
||||
|
||||
for (const auto& chunk : m_chunks)
|
||||
CsThread->dispatchChunk(DxvkCsChunkRef(chunk));
|
||||
|
||||
|
@ -110,7 +110,7 @@ namespace dxvk {
|
||||
|
||||
Com<D3D11Query, false> query(static_cast<D3D11Query*>(pAsync));
|
||||
|
||||
if (unlikely(!query->IsScoped()))
|
||||
if (unlikely(!query->DoBegin()))
|
||||
return;
|
||||
|
||||
EmitCs([cQuery = std::move(query)]
|
||||
@ -128,6 +128,9 @@ namespace dxvk {
|
||||
|
||||
Com<D3D11Query, false> query(static_cast<D3D11Query*>(pAsync));
|
||||
|
||||
if (unlikely(!query->DoEnd()))
|
||||
return;
|
||||
|
||||
if (unlikely(query->IsEvent())) {
|
||||
query->NotifyEnd();
|
||||
query->IsStalling()
|
||||
|
@ -182,9 +182,6 @@ namespace dxvk {
|
||||
|
||||
|
||||
void D3D11Query::Begin(DxvkContext* ctx) {
|
||||
if (unlikely(m_state == D3D11_VK_QUERY_BEGUN))
|
||||
return;
|
||||
|
||||
switch (m_desc.Query) {
|
||||
case D3D11_QUERY_EVENT:
|
||||
case D3D11_QUERY_TIMESTAMP:
|
||||
@ -197,8 +194,6 @@ namespace dxvk {
|
||||
default:
|
||||
ctx->beginQuery(m_query[0]);
|
||||
}
|
||||
|
||||
m_state = D3D11_VK_QUERY_BEGUN;
|
||||
}
|
||||
|
||||
|
||||
@ -214,19 +209,31 @@ namespace dxvk {
|
||||
break;
|
||||
|
||||
default:
|
||||
if (unlikely(m_state != D3D11_VK_QUERY_BEGUN))
|
||||
return;
|
||||
|
||||
ctx->endQuery(m_query[0]);
|
||||
}
|
||||
|
||||
if (unlikely(m_predicate != nullptr))
|
||||
ctx->writePredicate(DxvkBufferSlice(m_predicate), m_query[0]);
|
||||
|
||||
m_state = D3D11_VK_QUERY_ENDED;
|
||||
}
|
||||
|
||||
|
||||
bool STDMETHODCALLTYPE D3D11Query::DoBegin() {
|
||||
if (!IsScoped() || m_state == D3D11_VK_QUERY_BEGUN)
|
||||
return false;
|
||||
|
||||
m_state = D3D11_VK_QUERY_BEGUN;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool STDMETHODCALLTYPE D3D11Query::DoEnd() {
|
||||
if (IsScoped() && m_state != D3D11_VK_QUERY_BEGUN)
|
||||
return false;
|
||||
|
||||
m_state = D3D11_VK_QUERY_ENDED;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D11Query::GetData(
|
||||
void* pData,
|
||||
UINT GetDataFlags) {
|
||||
@ -327,9 +334,6 @@ namespace dxvk {
|
||||
if (unlikely(m_desc.Query != D3D11_QUERY_OCCLUSION_PREDICATE))
|
||||
return DxvkBufferSlice();
|
||||
|
||||
if (unlikely(m_state != D3D11_VK_QUERY_ENDED))
|
||||
return DxvkBufferSlice();
|
||||
|
||||
if (unlikely(m_predicate != nullptr)) {
|
||||
m_predicate = CreatePredicateBuffer();
|
||||
ctx->writePredicate(DxvkBufferSlice(m_predicate), m_query[0]);
|
||||
|
@ -43,12 +43,21 @@ namespace dxvk {
|
||||
|
||||
void End(DxvkContext* ctx);
|
||||
|
||||
bool STDMETHODCALLTYPE DoBegin();
|
||||
|
||||
bool STDMETHODCALLTYPE DoEnd();
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetData(
|
||||
void* pData,
|
||||
UINT GetDataFlags);
|
||||
|
||||
DxvkBufferSlice GetPredicate(DxvkContext* ctx);
|
||||
|
||||
void DoDeferredEnd() {
|
||||
m_state = D3D11_VK_QUERY_ENDED;
|
||||
m_resetCtr += 1;
|
||||
}
|
||||
|
||||
bool IsScoped() const {
|
||||
return m_desc.Query != D3D11_QUERY_EVENT
|
||||
&& m_desc.Query != D3D11_QUERY_TIMESTAMP;
|
||||
|
Loading…
x
Reference in New Issue
Block a user