summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D/PerfQuery.cpp
diff options
context:
space:
mode:
authorConnor McLaughlin <stenzek@gmail.com>2019-03-29 20:40:06 +1000
committerGitHub <noreply@github.com>2019-03-29 20:40:06 +1000
commitf3fadd730218429a5f6472283d16d30d7e276f8d (patch)
treed1d6577cd52b2d3b3d7872aef4fac80dbd0ce563 /Source/Core/VideoBackends/D3D/PerfQuery.cpp
parentfbe57e8dbef17e583f0ba0208af7bf414a3716bf (diff)
parentd0d010f8549cc902829f567b3b5127d9a0556ca5 (diff)
Merge pull request #7869 from stenzek/d3dcommon
D3D: Move sharable D3D11/D3D12 code to common library
Diffstat (limited to 'Source/Core/VideoBackends/D3D/PerfQuery.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D/PerfQuery.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/Source/Core/VideoBackends/D3D/PerfQuery.cpp b/Source/Core/VideoBackends/D3D/PerfQuery.cpp
index 15574a9c76..0382be903c 100644
--- a/Source/Core/VideoBackends/D3D/PerfQuery.cpp
+++ b/Source/Core/VideoBackends/D3D/PerfQuery.cpp
@@ -22,14 +22,7 @@ PerfQuery::PerfQuery() : m_query_read_pos()
ResetQuery();
}
-PerfQuery::~PerfQuery()
-{
- for (ActiveQuery& entry : m_query_buffer)
- {
- // TODO: EndQuery?
- entry.query->Release();
- }
-}
+PerfQuery::~PerfQuery() = default;
void PerfQuery::EnableQuery(PerfQueryGroup type)
{
@@ -49,7 +42,7 @@ void PerfQuery::EnableQuery(PerfQueryGroup type)
{
auto& entry = m_query_buffer[(m_query_read_pos + m_query_count) % m_query_buffer.size()];
- D3D::context->Begin(entry.query);
+ D3D::context->Begin(entry.query.Get());
entry.query_type = type;
++m_query_count;
@@ -63,7 +56,7 @@ void PerfQuery::DisableQuery(PerfQueryGroup type)
{
auto& entry = m_query_buffer[(m_query_read_pos + m_query_count + m_query_buffer.size() - 1) %
m_query_buffer.size()];
- D3D::context->End(entry.query);
+ D3D::context->End(entry.query.Get());
}
}
@@ -98,7 +91,7 @@ void PerfQuery::FlushOne()
while (hr != S_OK)
{
// TODO: Might cause us to be stuck in an infinite loop!
- hr = D3D::context->GetData(entry.query, &result, sizeof(result), 0);
+ hr = D3D::context->GetData(entry.query.Get(), &result, sizeof(result), 0);
}
// NOTE: Reported pixel metrics should be referenced to native resolution
@@ -125,8 +118,8 @@ void PerfQuery::WeakFlush()
auto& entry = m_query_buffer[m_query_read_pos];
UINT64 result = 0;
- HRESULT hr =
- D3D::context->GetData(entry.query, &result, sizeof(result), D3D11_ASYNC_GETDATA_DONOTFLUSH);
+ HRESULT hr = D3D::context->GetData(entry.query.Get(), &result, sizeof(result),
+ D3D11_ASYNC_GETDATA_DONOTFLUSH);
if (hr == S_OK)
{
@@ -149,4 +142,4 @@ bool PerfQuery::IsFlushed() const
return 0 == m_query_count;
}
-} // namespace
+} // namespace DX11