mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[d3d11] Implicitly begin scoped queries in End if necessary
Matches (undocumented) D3D11 behaviour. Warriors Orochi 4 runs into this because it does not begin some of its timestamp disjoint queries before ending them and retrieving data.
This commit is contained in:
parent
35a9934cde
commit
a57dc75247
@ -80,10 +80,14 @@ namespace dxvk {
|
|||||||
m_queriesBegun.begin(),
|
m_queriesBegun.begin(),
|
||||||
m_queriesBegun.end(), query);
|
m_queriesBegun.end(), query);
|
||||||
|
|
||||||
if (unlikely(entry == m_queriesBegun.end()))
|
if (likely(entry != m_queriesBegun.end())) {
|
||||||
return;
|
m_queriesBegun.erase(entry);
|
||||||
|
} else {
|
||||||
m_queriesBegun.erase(entry);
|
EmitCs([cQuery = query]
|
||||||
|
(DxvkContext* ctx) {
|
||||||
|
cQuery->Begin(ctx);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_commandList->AddQuery(query.ptr());
|
m_commandList->AddQuery(query.ptr());
|
||||||
|
@ -124,8 +124,12 @@ namespace dxvk {
|
|||||||
|
|
||||||
auto query = static_cast<D3D11Query*>(pAsync);
|
auto query = static_cast<D3D11Query*>(pAsync);
|
||||||
|
|
||||||
if (unlikely(!query->DoEnd()))
|
if (unlikely(!query->DoEnd())) {
|
||||||
return;
|
EmitCs([cQuery = Com<D3D11Query, false>(query)]
|
||||||
|
(DxvkContext* ctx) {
|
||||||
|
cQuery->Begin(ctx);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
EmitCs([cQuery = Com<D3D11Query, false>(query)]
|
EmitCs([cQuery = Com<D3D11Query, false>(query)]
|
||||||
(DxvkContext* ctx) {
|
(DxvkContext* ctx) {
|
||||||
|
@ -228,12 +228,14 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool STDMETHODCALLTYPE D3D11Query::DoEnd() {
|
bool STDMETHODCALLTYPE D3D11Query::DoEnd() {
|
||||||
if (IsScoped() && m_state != D3D11_VK_QUERY_BEGUN)
|
// Apparently the D3D11 runtime implicitly begins the query
|
||||||
return false;
|
// if it is in the wrong state at the time End is called, so
|
||||||
|
// let the caller react to it instead of just failing here.
|
||||||
|
bool result = m_state == D3D11_VK_QUERY_BEGUN || !IsScoped();
|
||||||
|
|
||||||
m_state = D3D11_VK_QUERY_ENDED;
|
m_state = D3D11_VK_QUERY_ENDED;
|
||||||
m_resetCtr.fetch_add(1, std::memory_order_acquire);
|
m_resetCtr.fetch_add(1, std::memory_order_acquire);
|
||||||
return true;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user