From d1acb0a937d842abaf55844d63298971e73ecee7 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Fri, 1 Mar 2013 23:12:41 +0100 Subject: [PATCH] OGL: Fix perf metrics being overcounted when using a non-native internal resolution. --- Source/Plugins/Plugin_VideoDX11/Src/PerfQuery.cpp | 1 + Source/Plugins/Plugin_VideoOGL/Src/PerfQuery.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/Plugins/Plugin_VideoDX11/Src/PerfQuery.cpp b/Source/Plugins/Plugin_VideoDX11/Src/PerfQuery.cpp index 6ab91fed27..d2a76d7d4b 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/PerfQuery.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/PerfQuery.cpp @@ -103,6 +103,7 @@ void PerfQuery::FlushOne() hr = D3D::context->GetData(entry.query, &result, sizeof(result), 0); } + // NOTE: Reported pixel metrics should be referenced to native resolution m_results[entry.query_type] += result * EFB_WIDTH * EFB_HEIGHT / g_renderer->GetTargetWidth() / g_renderer->GetTargetHeight(); m_query_read_pos = (m_query_read_pos + 1) % ARRAYSIZE(m_query_buffer); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PerfQuery.cpp b/Source/Plugins/Plugin_VideoOGL/Src/PerfQuery.cpp index 8cee426e98..42ff918942 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/PerfQuery.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/PerfQuery.cpp @@ -1,3 +1,4 @@ +#include "RenderBase.h" #include "GLUtil.h" #include "PerfQuery.h" @@ -61,12 +62,13 @@ bool PerfQuery::IsFlushed() const void PerfQuery::FlushOne() { auto& entry = m_query_buffer[m_query_read_pos]; - + GLuint result = 0; glGetQueryObjectuiv(entry.query_id, GL_QUERY_RESULT, &result); - - m_results[entry.query_type] += result; - + + // NOTE: Reported pixel metrics should be referenced to native resolution + m_results[entry.query_type] += result * EFB_WIDTH * EFB_HEIGHT / g_renderer->GetTargetWidth() / g_renderer->GetTargetHeight(); + m_query_read_pos = (m_query_read_pos + 1) % ARRAYSIZE(m_query_buffer); --m_query_count; }