GS: Add Render Pass stats

This commit is contained in:
Stenzek 2023-04-24 23:25:02 +10:00 committed by refractionpcsx2
parent f26f8cafa9
commit 757a9532e6
7 changed files with 21 additions and 6 deletions

View File

@ -748,12 +748,13 @@ void GSgetStats(std::string& info)
}
else
{
fmt::format_to(std::back_inserter(info), "{} HW | {} P | {} D | {} DC | {} B | {} RB | {} TC | {} TU",
fmt::format_to(std::back_inserter(info), "{} HW | {} P | {} D | {} DC | {} B | {} RP | {} RB | {} TC | {} TU",
api_name,
(int)pm.Get(GSPerfMon::Prim),
(int)pm.Get(GSPerfMon::Draw),
(int)std::ceil(pm.Get(GSPerfMon::DrawCalls)),
(int)std::ceil(pm.Get(GSPerfMon::Barriers)),
(int)std::ceil(pm.Get(GSPerfMon::RenderPasses)),
(int)std::ceil(pm.Get(GSPerfMon::Readbacks)),
(int)std::ceil(pm.Get(GSPerfMon::TextureCopies)),
(int)std::ceil(pm.Get(GSPerfMon::TextureUploads)));

View File

@ -27,9 +27,9 @@ public:
Swizzle,
Unswizzle,
Fillrate,
Quad,
SyncPoint,
Barriers,
RenderPasses,
CounterLast,
// Reused counters for HW.

View File

@ -883,7 +883,9 @@ GSDevice::PresentResult GSDevice11::BeginPresent(bool frame_skip)
{
m_state.dsv->Release();
m_state.dsv = nullptr;
}
}
g_perfmon.Put(GSPerfMon::RenderPasses, 1);
const GSVector2i size = GetWindowSize();
SetViewport(size);
@ -2063,6 +2065,8 @@ void GSDevice11::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector
if (ds) dsv = *(GSTexture11*)ds;
const bool changed = (m_state.rt_view != rtv || m_state.dsv != dsv);
g_perfmon.Put(GSPerfMon::RenderPasses, static_cast<double>(changed));
if (m_state.rt_view != rtv)
{
if (m_state.rt_view)

View File

@ -538,6 +538,7 @@ GSDevice::PresentResult GSDevice12::BeginPresent(bool frame_skip)
swap_chain_buf.TransitionToState(cmdlist, D3D12_RESOURCE_STATE_RENDER_TARGET);
cmdlist->ClearRenderTargetView(swap_chain_buf.GetWriteDescriptor(), clear_color.data(), 0, nullptr);
cmdlist->OMSetRenderTargets(1, &swap_chain_buf.GetWriteDescriptor().cpu_handle, FALSE, nullptr);
g_perfmon.Put(GSPerfMon::RenderPasses, 1);
const D3D12_VIEWPORT vp{0.0f, 0.0f, static_cast<float>(m_window_info.surface_width),
static_cast<float>(m_window_info.surface_height), 0.0f, 1.0f};
@ -2746,11 +2747,15 @@ void GSDevice12::EndRenderPass()
if (!m_in_render_pass)
return;
g_d3d12_context->GetCommandList()->EndRenderPass();
m_in_render_pass = false;
// to render again, we need to reset OM
m_dirty_flags |= DIRTY_FLAG_RENDER_TARGET;
g_perfmon.Put(GSPerfMon::RenderPasses, 1);
g_d3d12_context->GetCommandList()->EndRenderPass();
}
void GSDevice12::SetViewport(const D3D12_VIEWPORT& viewport)

View File

@ -371,6 +371,7 @@ void GSDeviceMTL::EndRenderPass()
if (m_current_render.encoder)
{
EndDebugGroup(m_current_render.encoder);
g_perfmon.Put(GSPerfMon::RenderPasses, 1);
if (m_spin_timer)
[m_current_render.encoder updateFence:m_spin_fence afterStages:MTLRenderStageFragment];
[m_current_render.encoder endEncoding];

View File

@ -2156,6 +2156,8 @@ void GSDeviceOGL::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVecto
GSTextureOGL* RT = static_cast<GSTextureOGL*>(rt);
GSTextureOGL* DS = static_cast<GSTextureOGL*>(ds);
g_perfmon.Put(GSPerfMon::RenderPasses, static_cast<double>(GLState::rt != RT || GLState::ds != DS));
OMSetFBO(m_fbo);
if (rt)
{

View File

@ -475,6 +475,7 @@ void GSDeviceVK::EndPresent()
VkCommandBuffer cmdbuffer = g_vulkan_context->GetCurrentCommandBuffer();
vkCmdEndRenderPass(g_vulkan_context->GetCurrentCommandBuffer());
m_swap_chain->GetCurrentTexture().TransitionToLayout(cmdbuffer, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR);
g_perfmon.Put(GSPerfMon::RenderPasses, 1);
g_vulkan_context->SubmitCommandBuffer(m_swap_chain.get(), !m_swap_chain->IsPresentModeSynchronizing());
g_vulkan_context->MoveToNextCommandBuffer();
@ -3100,9 +3101,10 @@ void GSDeviceVK::EndRenderPass()
if (m_current_render_pass == VK_NULL_HANDLE)
return;
vkCmdEndRenderPass(g_vulkan_context->GetCurrentCommandBuffer());
m_current_render_pass = VK_NULL_HANDLE;
g_perfmon.Put(GSPerfMon::RenderPasses, 1);
vkCmdEndRenderPass(g_vulkan_context->GetCurrentCommandBuffer());
}
void GSDeviceVK::SetViewport(const VkViewport& viewport)