mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +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) {
|
void D3D11CommandList::EmitToCsThread(DxvkCsThread* CsThread) {
|
||||||
|
for (const auto& query : m_queries)
|
||||||
|
query->DoDeferredEnd();
|
||||||
|
|
||||||
for (const auto& chunk : m_chunks)
|
for (const auto& chunk : m_chunks)
|
||||||
CsThread->dispatchChunk(DxvkCsChunkRef(chunk));
|
CsThread->dispatchChunk(DxvkCsChunkRef(chunk));
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
Com<D3D11Query, false> query(static_cast<D3D11Query*>(pAsync));
|
Com<D3D11Query, false> query(static_cast<D3D11Query*>(pAsync));
|
||||||
|
|
||||||
if (unlikely(!query->IsScoped()))
|
if (unlikely(!query->DoBegin()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EmitCs([cQuery = std::move(query)]
|
EmitCs([cQuery = std::move(query)]
|
||||||
@ -128,6 +128,9 @@ namespace dxvk {
|
|||||||
|
|
||||||
Com<D3D11Query, false> query(static_cast<D3D11Query*>(pAsync));
|
Com<D3D11Query, false> query(static_cast<D3D11Query*>(pAsync));
|
||||||
|
|
||||||
|
if (unlikely(!query->DoEnd()))
|
||||||
|
return;
|
||||||
|
|
||||||
if (unlikely(query->IsEvent())) {
|
if (unlikely(query->IsEvent())) {
|
||||||
query->NotifyEnd();
|
query->NotifyEnd();
|
||||||
query->IsStalling()
|
query->IsStalling()
|
||||||
|
@ -182,9 +182,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
void D3D11Query::Begin(DxvkContext* ctx) {
|
void D3D11Query::Begin(DxvkContext* ctx) {
|
||||||
if (unlikely(m_state == D3D11_VK_QUERY_BEGUN))
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (m_desc.Query) {
|
switch (m_desc.Query) {
|
||||||
case D3D11_QUERY_EVENT:
|
case D3D11_QUERY_EVENT:
|
||||||
case D3D11_QUERY_TIMESTAMP:
|
case D3D11_QUERY_TIMESTAMP:
|
||||||
@ -197,8 +194,6 @@ namespace dxvk {
|
|||||||
default:
|
default:
|
||||||
ctx->beginQuery(m_query[0]);
|
ctx->beginQuery(m_query[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_state = D3D11_VK_QUERY_BEGUN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -214,19 +209,31 @@ namespace dxvk {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (unlikely(m_state != D3D11_VK_QUERY_BEGUN))
|
|
||||||
return;
|
|
||||||
|
|
||||||
ctx->endQuery(m_query[0]);
|
ctx->endQuery(m_query[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(m_predicate != nullptr))
|
if (unlikely(m_predicate != nullptr))
|
||||||
ctx->writePredicate(DxvkBufferSlice(m_predicate), m_query[0]);
|
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(
|
HRESULT STDMETHODCALLTYPE D3D11Query::GetData(
|
||||||
void* pData,
|
void* pData,
|
||||||
UINT GetDataFlags) {
|
UINT GetDataFlags) {
|
||||||
@ -327,9 +334,6 @@ namespace dxvk {
|
|||||||
if (unlikely(m_desc.Query != D3D11_QUERY_OCCLUSION_PREDICATE))
|
if (unlikely(m_desc.Query != D3D11_QUERY_OCCLUSION_PREDICATE))
|
||||||
return DxvkBufferSlice();
|
return DxvkBufferSlice();
|
||||||
|
|
||||||
if (unlikely(m_state != D3D11_VK_QUERY_ENDED))
|
|
||||||
return DxvkBufferSlice();
|
|
||||||
|
|
||||||
if (unlikely(m_predicate != nullptr)) {
|
if (unlikely(m_predicate != nullptr)) {
|
||||||
m_predicate = CreatePredicateBuffer();
|
m_predicate = CreatePredicateBuffer();
|
||||||
ctx->writePredicate(DxvkBufferSlice(m_predicate), m_query[0]);
|
ctx->writePredicate(DxvkBufferSlice(m_predicate), m_query[0]);
|
||||||
|
@ -43,12 +43,21 @@ namespace dxvk {
|
|||||||
|
|
||||||
void End(DxvkContext* ctx);
|
void End(DxvkContext* ctx);
|
||||||
|
|
||||||
|
bool STDMETHODCALLTYPE DoBegin();
|
||||||
|
|
||||||
|
bool STDMETHODCALLTYPE DoEnd();
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE GetData(
|
HRESULT STDMETHODCALLTYPE GetData(
|
||||||
void* pData,
|
void* pData,
|
||||||
UINT GetDataFlags);
|
UINT GetDataFlags);
|
||||||
|
|
||||||
DxvkBufferSlice GetPredicate(DxvkContext* ctx);
|
DxvkBufferSlice GetPredicate(DxvkContext* ctx);
|
||||||
|
|
||||||
|
void DoDeferredEnd() {
|
||||||
|
m_state = D3D11_VK_QUERY_ENDED;
|
||||||
|
m_resetCtr += 1;
|
||||||
|
}
|
||||||
|
|
||||||
bool IsScoped() const {
|
bool IsScoped() const {
|
||||||
return m_desc.Query != D3D11_QUERY_EVENT
|
return m_desc.Query != D3D11_QUERY_EVENT
|
||||||
&& m_desc.Query != D3D11_QUERY_TIMESTAMP;
|
&& m_desc.Query != D3D11_QUERY_TIMESTAMP;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user