Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #9731 from JosJuice/perf-queries-slow
Fix perf query regression
  • Loading branch information
lioncash committed May 21, 2021
2 parents 0a2fde7 + 1d3b9fd commit bc89df8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Source/Core/VideoBackends/D3D/D3DPerfQuery.cpp
Expand Up @@ -27,16 +27,20 @@ PerfQuery::~PerfQuery() = default;

void PerfQuery::EnableQuery(PerfQueryGroup type)
{
const u32 query_count = m_query_count.load(std::memory_order_relaxed);
u32 query_count = m_query_count.load(std::memory_order_relaxed);

// Is this sane?
if (query_count > m_query_buffer.size() / 2)
{
WeakFlush();
query_count = m_query_count.load(std::memory_order_relaxed);
}

if (m_query_buffer.size() == query_count)
{
// TODO
FlushOne();
query_count = m_query_count.load(std::memory_order_relaxed);
ERROR_LOG_FMT(VIDEO, "Flushed query buffer early!");
}

Expand Down
13 changes: 11 additions & 2 deletions Source/Core/VideoBackends/OGL/OGLPerfQuery.cpp
Expand Up @@ -99,15 +99,19 @@ PerfQueryGL::~PerfQueryGL()

void PerfQueryGL::EnableQuery(PerfQueryGroup type)
{
const u32 query_count = m_query_count.load(std::memory_order_relaxed);
u32 query_count = m_query_count.load(std::memory_order_relaxed);

// Is this sane?
if (query_count > m_query_buffer.size() / 2)
{
WeakFlush();
query_count = m_query_count.load(std::memory_order_relaxed);
}

if (m_query_buffer.size() == query_count)
{
FlushOne();
query_count = m_query_count.load(std::memory_order_relaxed);
// ERROR_LOG_FMT(VIDEO, "Flushed query buffer early!");
}

Expand Down Expand Up @@ -195,14 +199,19 @@ PerfQueryGLESNV::~PerfQueryGLESNV()

void PerfQueryGLESNV::EnableQuery(PerfQueryGroup type)
{
const u32 query_count = m_query_count.load(std::memory_order_relaxed);
u32 query_count = m_query_count.load(std::memory_order_relaxed);

// Is this sane?
if (query_count > m_query_buffer.size() / 2)
{
WeakFlush();
query_count = m_query_count.load(std::memory_order_relaxed);
}

if (m_query_buffer.size() == query_count)
{
FlushOne();
query_count = m_query_count.load(std::memory_order_relaxed);
// ERROR_LOG_FMT(VIDEO, "Flushed query buffer early!");
}

Expand Down

0 comments on commit bc89df8

Please sign in to comment.