summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/OGLPerfQuery.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2021-05-21 12:48:27 +0200
committerJosJuice <josjuice@gmail.com>2021-05-21 13:39:59 +0200
commit1d3b9fdec2c8ed73ec9af95e390a6b86a699cf6f (patch)
tree15714ead604e16661fda31e52675731b85d12170 /Source/Core/VideoBackends/OGL/OGLPerfQuery.cpp
parent0a2fde73a274fda20fa81b046291da35c9a93726 (diff)
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.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/OGLPerfQuery.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/OGLPerfQuery.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/Core/VideoBackends/OGL/OGLPerfQuery.cpp b/Source/Core/VideoBackends/OGL/OGLPerfQuery.cpp
index 2718dd49af..12d28082c6 100644
--- a/Source/Core/VideoBackends/OGL/OGLPerfQuery.cpp
+++ b/Source/Core/VideoBackends/OGL/OGLPerfQuery.cpp
@@ -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!");
}
@@ -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!");
}