summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2016-09-27 13:07:35 +0200
committerGitHub <noreply@github.com>2016-09-27 13:07:35 +0200
commitcb759528e055a88eee63f1803f2fde273a4e3825 (patch)
tree283264d1c78b0a7dcd217eb5c503e77d054e04ce /Source
parent3de4dc2186da871ac0e3fa76a23579a95bd5ba38 (diff)
parent8be5717a60a4c4fbd29a0968a9f331152ff581e3 (diff)
Merge pull request #3893 from hthh/perf-query-bug
Improve PerfQuery accuracy
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/VideoBackends/D3D/PerfQuery.cpp4
-rw-r--r--Source/Core/VideoBackends/D3D12/PerfQuery.cpp6
-rw-r--r--Source/Core/VideoBackends/OGL/PerfQuery.cpp21
3 files changed, 24 insertions, 7 deletions
diff --git a/Source/Core/VideoBackends/D3D/PerfQuery.cpp b/Source/Core/VideoBackends/D3D/PerfQuery.cpp
index 2eb3c6d89d..15574a9c76 100644
--- a/Source/Core/VideoBackends/D3D/PerfQuery.cpp
+++ b/Source/Core/VideoBackends/D3D/PerfQuery.cpp
@@ -86,7 +86,7 @@ u32 PerfQuery::GetQueryResult(PerfQueryType type)
else if (type == PQ_EFB_COPY_CLOCKS)
result = m_results[PQG_EFB_COPY_CLOCKS];
- return result / 4;
+ return result;
}
void PerfQuery::FlushOne()
@@ -102,6 +102,8 @@ void PerfQuery::FlushOne()
}
// NOTE: Reported pixel metrics should be referenced to native resolution
+ // TODO: Dropping the lower 2 bits from this count should be closer to actual
+ // hardware behavior when drawing triangles.
m_results[entry.query_type] += (u32)(result * EFB_WIDTH / g_renderer->GetTargetWidth() *
EFB_HEIGHT / g_renderer->GetTargetHeight());
diff --git a/Source/Core/VideoBackends/D3D12/PerfQuery.cpp b/Source/Core/VideoBackends/D3D12/PerfQuery.cpp
index 4794b134c1..df5b5ce224 100644
--- a/Source/Core/VideoBackends/D3D12/PerfQuery.cpp
+++ b/Source/Core/VideoBackends/D3D12/PerfQuery.cpp
@@ -98,7 +98,7 @@ u32 PerfQuery::GetQueryResult(PerfQueryType type)
else if (type == PQ_EFB_COPY_CLOCKS)
result = m_results[PQG_EFB_COPY_CLOCKS];
- return result / 4;
+ return result;
}
void PerfQuery::FlushOne()
@@ -126,6 +126,8 @@ void PerfQuery::FlushOne()
m_query_readback_buffer->Unmap(0, &write_range);
// NOTE: Reported pixel metrics should be referenced to native resolution
+ // TODO: Dropping the lower 2 bits from this count should be closer to actual
+ // hardware behavior when drawing triangles.
m_results[entry.query_type] += (u32)(result * EFB_WIDTH / g_renderer->GetTargetWidth() *
EFB_HEIGHT / g_renderer->GetTargetHeight());
@@ -179,6 +181,8 @@ void PerfQuery::FlushResults()
sizeof(UINT64));
// NOTE: Reported pixel metrics should be referenced to native resolution
+ // TODO: Dropping the lower 2 bits from this count should be closer to actual
+ // hardware behavior when drawing triangles.
m_results[entry.query_type] += (u32)(result * EFB_WIDTH / g_renderer->GetTargetWidth() *
EFB_HEIGHT / g_renderer->GetTargetHeight());
diff --git a/Source/Core/VideoBackends/OGL/PerfQuery.cpp b/Source/Core/VideoBackends/OGL/PerfQuery.cpp
index cbe4ff7056..b3b5df2265 100644
--- a/Source/Core/VideoBackends/OGL/PerfQuery.cpp
+++ b/Source/Core/VideoBackends/OGL/PerfQuery.cpp
@@ -11,6 +11,7 @@
#include "VideoBackends/OGL/PerfQuery.h"
#include "VideoCommon/RenderBase.h"
+#include "VideoCommon/VideoConfig.h"
namespace OGL
{
@@ -79,7 +80,7 @@ u32 PerfQuery::GetQueryResult(PerfQueryType type)
result = m_results[PQG_EFB_COPY_CLOCKS];
}
- return result / 4;
+ return result;
}
// Implementations
@@ -155,8 +156,16 @@ void PerfQueryGL::FlushOne()
glGetQueryObjectuiv(entry.query_id, GL_QUERY_RESULT, &result);
// NOTE: Reported pixel metrics should be referenced to native resolution
- m_results[entry.query_type] += (u64)result * EFB_WIDTH / g_renderer->GetTargetWidth() *
- EFB_HEIGHT / g_renderer->GetTargetHeight();
+ // TODO: Dropping the lower 2 bits from this count should be closer to actual
+ // hardware behavior when drawing triangles.
+ result = static_cast<u64>(result) * EFB_WIDTH * EFB_HEIGHT /
+ (g_renderer->GetTargetWidth() * g_renderer->GetTargetHeight());
+
+ // Adjust for multisampling
+ if (g_ActiveConfig.iMultisamples > 1)
+ result /= g_ActiveConfig.iMultisamples;
+
+ m_results[entry.query_type] += result;
m_query_read_pos = (m_query_read_pos + 1) % m_query_buffer.size();
--m_query_count;
@@ -241,8 +250,10 @@ void PerfQueryGLESNV::FlushOne()
glGetOcclusionQueryuivNV(entry.query_id, GL_OCCLUSION_TEST_RESULT_HP, &result);
// NOTE: Reported pixel metrics should be referenced to native resolution
- m_results[entry.query_type] += (u64)result * EFB_WIDTH / g_renderer->GetTargetWidth() *
- EFB_HEIGHT / g_renderer->GetTargetHeight();
+ // TODO: Dropping the lower 2 bits from this count should be closer to actual
+ // hardware behavior when drawing triangles.
+ m_results[entry.query_type] += static_cast<u64>(result) * EFB_WIDTH * EFB_HEIGHT /
+ (g_renderer->GetTargetWidth() * g_renderer->GetTargetHeight());
m_query_read_pos = (m_query_read_pos + 1) % m_query_buffer.size();
--m_query_count;