summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D12/PerfQuery.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2019-04-01 20:49:24 +1000
committerStenzek <stenzek@gmail.com>2019-04-01 20:49:24 +1000
commitf2d8c8d2a8cad108425e297d65a9b0902b3d0c9c (patch)
tree3b97c3c349c7d63192f9a0ea5d54b075e3a498e1 /Source/Core/VideoBackends/D3D12/PerfQuery.cpp
parent92f1f553d13596ace349889a924d5bd8c40e845d (diff)
D3D12: Fix rare case where command list was executed with open queries
Diffstat (limited to 'Source/Core/VideoBackends/D3D12/PerfQuery.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D12/PerfQuery.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/Core/VideoBackends/D3D12/PerfQuery.cpp b/Source/Core/VideoBackends/D3D12/PerfQuery.cpp
index f5231aad76..4b2ec079ee 100644
--- a/Source/Core/VideoBackends/D3D12/PerfQuery.cpp
+++ b/Source/Core/VideoBackends/D3D12/PerfQuery.cpp
@@ -57,6 +57,12 @@ void PerfQuery::EnableQuery(PerfQueryGroup type)
PartialFlush(do_resolve, blocking);
}
+ // Ensure all state is applied before beginning the query.
+ // This is because we can't leave a query open when submitting a command list, and the draw
+ // call itself may need to execute a command list if we run out of descriptors. Note that
+ // this assumes that the caller has bound all required state prior to enabling the query.
+ Renderer::GetInstance()->ApplyState();
+
if (type == PQG_ZCOMP_ZCOMPLOC || type == PQG_ZCOMP)
{
ActiveQuery& entry = m_query_buffer[m_query_next_pos];