From aac9647ba2715b4a96fe301116a9f41cd8046441 Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Tue, 14 Mar 2023 02:13:25 +0100 Subject: [PATCH] Divide by MSAA for PerfQuery in all backends. --- Source/Core/VideoBackends/D3D/D3DPerfQuery.cpp | 7 +++++-- Source/Core/VideoBackends/D3D12/D3D12PerfQuery.cpp | 9 ++++++--- Source/Core/VideoBackends/Vulkan/VKPerfQuery.cpp | 9 ++++++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Source/Core/VideoBackends/D3D/D3DPerfQuery.cpp b/Source/Core/VideoBackends/D3D/D3DPerfQuery.cpp index 983abc15c8..f2ae05bb99 100644 --- a/Source/Core/VideoBackends/D3D/D3DPerfQuery.cpp +++ b/Source/Core/VideoBackends/D3D/D3DPerfQuery.cpp @@ -8,6 +8,7 @@ #include "VideoBackends/D3D/D3DBase.h" #include "VideoCommon/FramebufferManager.h" #include "VideoCommon/VideoCommon.h" +#include "VideoCommon/VideoConfig.h" namespace DX11 { @@ -114,8 +115,10 @@ 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. - const u64 native_res_result = result * EFB_WIDTH / g_framebuffer_manager->GetEFBWidth() * - EFB_HEIGHT / g_framebuffer_manager->GetEFBHeight(); + u64 native_res_result = result * EFB_WIDTH / g_framebuffer_manager->GetEFBWidth() * EFB_HEIGHT / + g_framebuffer_manager->GetEFBHeight(); + if (g_ActiveConfig.iMultisamples > 1) + native_res_result /= g_ActiveConfig.iMultisamples; m_results[entry.query_group].fetch_add(static_cast(native_res_result), std::memory_order_relaxed); diff --git a/Source/Core/VideoBackends/D3D12/D3D12PerfQuery.cpp b/Source/Core/VideoBackends/D3D12/D3D12PerfQuery.cpp index 933f118ce9..da9a6e6546 100644 --- a/Source/Core/VideoBackends/D3D12/D3D12PerfQuery.cpp +++ b/Source/Core/VideoBackends/D3D12/D3D12PerfQuery.cpp @@ -13,6 +13,7 @@ #include "VideoBackends/D3D12/DX12Context.h" #include "VideoCommon/FramebufferManager.h" #include "VideoCommon/VideoCommon.h" +#include "VideoCommon/VideoConfig.h" namespace DX12 { @@ -244,9 +245,11 @@ void PerfQuery::AccumulateQueriesFromBuffer(u32 query_count) std::memcpy(&result, mapped_ptr + (index * sizeof(PerfQueryDataType)), sizeof(result)); // NOTE: Reported pixel metrics should be referenced to native resolution - const u64 native_res_result = static_cast(result) * EFB_WIDTH / - g_framebuffer_manager->GetEFBWidth() * EFB_HEIGHT / - g_framebuffer_manager->GetEFBHeight(); + u64 native_res_result = static_cast(result) * EFB_WIDTH / + g_framebuffer_manager->GetEFBWidth() * EFB_HEIGHT / + g_framebuffer_manager->GetEFBHeight(); + if (g_ActiveConfig.iMultisamples > 1) + native_res_result /= g_ActiveConfig.iMultisamples; m_results[entry.query_group].fetch_add(static_cast(native_res_result), std::memory_order_relaxed); } diff --git a/Source/Core/VideoBackends/Vulkan/VKPerfQuery.cpp b/Source/Core/VideoBackends/Vulkan/VKPerfQuery.cpp index d16c8c379b..c6aee79327 100644 --- a/Source/Core/VideoBackends/Vulkan/VKPerfQuery.cpp +++ b/Source/Core/VideoBackends/Vulkan/VKPerfQuery.cpp @@ -17,6 +17,7 @@ #include "VideoBackends/Vulkan/VulkanContext.h" #include "VideoCommon/FramebufferManager.h" #include "VideoCommon/VideoCommon.h" +#include "VideoCommon/VideoConfig.h" namespace Vulkan { @@ -218,9 +219,11 @@ void PerfQuery::ReadbackQueries(u32 query_count) entry.has_value = false; // NOTE: Reported pixel metrics should be referenced to native resolution - const u64 native_res_result = static_cast(m_query_result_buffer[i]) * EFB_WIDTH / - g_framebuffer_manager->GetEFBWidth() * EFB_HEIGHT / - g_framebuffer_manager->GetEFBHeight(); + u64 native_res_result = static_cast(m_query_result_buffer[i]) * EFB_WIDTH / + g_framebuffer_manager->GetEFBWidth() * EFB_HEIGHT / + g_framebuffer_manager->GetEFBHeight(); + if (g_ActiveConfig.iMultisamples > 1) + native_res_result /= g_ActiveConfig.iMultisamples; m_results[entry.query_group].fetch_add(static_cast(native_res_result), std::memory_order_relaxed); }