From 1d3b9fdec2c8ed73ec9af95e390a6b86a699cf6f Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 21 May 2021 12:48:27 +0200 Subject: 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. --- Source/Core/VideoBackends/OGL/OGLPerfQuery.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoBackends/OGL/OGLPerfQuery.cpp') 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!"); } -- cgit v1.2.3