Fix perf query regression

When trying to do a small optimization in 8a0f5ea, I failed to
take into account that WeakFlush and FlushOne update m_query_count.

Only D3D11 and OGL had this problem, not D3D12 and Vulkan.
This commit is contained in:
JosJuice 2021-05-21 12:48:27 +02:00
parent 0a2fde73a2
commit 1d3b9fdec2
2 changed files with 16 additions and 3 deletions

View File

@ -27,16 +27,20 @@ PerfQuery::~PerfQuery() = default;
void PerfQuery::EnableQuery(PerfQueryGroup type) 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? // Is this sane?
if (query_count > m_query_buffer.size() / 2) if (query_count > m_query_buffer.size() / 2)
{
WeakFlush(); WeakFlush();
query_count = m_query_count.load(std::memory_order_relaxed);
}
if (m_query_buffer.size() == query_count) if (m_query_buffer.size() == query_count)
{ {
// TODO // TODO
FlushOne(); FlushOne();
query_count = m_query_count.load(std::memory_order_relaxed);
ERROR_LOG_FMT(VIDEO, "Flushed query buffer early!"); ERROR_LOG_FMT(VIDEO, "Flushed query buffer early!");
} }

View File

@ -99,15 +99,19 @@ PerfQueryGL::~PerfQueryGL()
void PerfQueryGL::EnableQuery(PerfQueryGroup type) 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? // Is this sane?
if (query_count > m_query_buffer.size() / 2) if (query_count > m_query_buffer.size() / 2)
{
WeakFlush(); WeakFlush();
query_count = m_query_count.load(std::memory_order_relaxed);
}
if (m_query_buffer.size() == query_count) if (m_query_buffer.size() == query_count)
{ {
FlushOne(); FlushOne();
query_count = m_query_count.load(std::memory_order_relaxed);
// ERROR_LOG_FMT(VIDEO, "Flushed query buffer early!"); // ERROR_LOG_FMT(VIDEO, "Flushed query buffer early!");
} }
@ -195,14 +199,19 @@ PerfQueryGLESNV::~PerfQueryGLESNV()
void PerfQueryGLESNV::EnableQuery(PerfQueryGroup type) 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? // Is this sane?
if (query_count > m_query_buffer.size() / 2) if (query_count > m_query_buffer.size() / 2)
{
WeakFlush(); WeakFlush();
query_count = m_query_count.load(std::memory_order_relaxed);
}
if (m_query_buffer.size() == query_count) if (m_query_buffer.size() == query_count)
{ {
FlushOne(); FlushOne();
query_count = m_query_count.load(std::memory_order_relaxed);
// ERROR_LOG_FMT(VIDEO, "Flushed query buffer early!"); // ERROR_LOG_FMT(VIDEO, "Flushed query buffer early!");
} }