diff --git a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp index c198aa4a44..213b8d6d2d 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp @@ -447,6 +447,8 @@ void D3D12GSRender::OnReset() void D3D12GSRender::Clear(u32 cmd) { + std::chrono::time_point startDuration = std::chrono::system_clock::now(); + PrepareRenderTargets(getCurrentResourceStorage().m_currentCommandList); assert(cmd == NV4097_CLEAR_SURFACE); PrepareRenderTargets(getCurrentResourceStorage().m_currentCommandList); @@ -516,10 +518,15 @@ void D3D12GSRender::Clear(u32 cmd) LOG_ERROR(RSX, "Bad surface color target: %d", m_surface_color_target); } } + + std::chrono::time_point endDuration = std::chrono::system_clock::now(); + m_timers.m_drawCallDuration += std::chrono::duration_cast(endDuration - startDuration).count(); + m_timers.m_drawCallCount++; } void D3D12GSRender::Draw() { + std::chrono::time_point startDuration = std::chrono::system_clock::now(); PrepareRenderTargets(getCurrentResourceStorage().m_currentCommandList); // Init vertex count @@ -547,7 +554,7 @@ void D3D12GSRender::Draw() } } - std::chrono::time_point startVertexTime = std::chrono::system_clock::now(); + if (m_indexed_array.m_count || m_draw_array_count) { const std::vector &vertexBufferViews = UploadVertexBuffers(m_indexed_array.m_count ? true : false); @@ -556,8 +563,6 @@ void D3D12GSRender::Draw() if (m_renderingInfo.m_indexed) getCurrentResourceStorage().m_currentCommandList->IASetIndexBuffer(&indexBufferView); } - std::chrono::time_point endVertexTime = std::chrono::system_clock::now(); - m_timers.m_vertexUploadDuration += std::chrono::duration_cast(endVertexTime - startVertexTime).count(); if (!LoadProgram()) { @@ -593,7 +598,6 @@ void D3D12GSRender::Draw() if (m_PSO->second > 0) { - std::chrono::time_point startTextureTime = std::chrono::system_clock::now(); size_t usedTexture = UploadTextures(getCurrentResourceStorage().m_currentCommandList); // Fill empty slots @@ -638,8 +642,6 @@ void D3D12GSRender::Draw() getCurrentResourceStorage().m_currentTextureIndex += usedTexture; getCurrentResourceStorage().m_currentSamplerIndex += usedTexture; - std::chrono::time_point endTextureTime = std::chrono::system_clock::now(); - m_timers.m_textureUploadDuration += std::chrono::duration_cast(endTextureTime - startTextureTime).count(); } size_t numRTT; @@ -724,6 +726,9 @@ void D3D12GSRender::Draw() getCurrentResourceStorage().m_currentCommandList->DrawInstanced((UINT)m_renderingInfo.m_count, 1, (UINT)m_renderingInfo.m_baseVertex, 0); m_indexed_array.Reset(); + std::chrono::time_point endDuration = std::chrono::system_clock::now(); + m_timers.m_drawCallDuration += std::chrono::duration_cast(endDuration - startDuration).count(); + m_timers.m_drawCallCount++; } static bool @@ -955,8 +960,8 @@ void D3D12GSRender::Flip() void D3D12GSRender::ResetTimer() { - m_timers.m_textureUploadDuration = 0; - m_timers.m_vertexUploadDuration = 0; + m_timers.m_drawCallCount = 0; + m_timers.m_drawCallDuration = 0; } D3D12GSRender::ResourceStorage& D3D12GSRender::getCurrentResourceStorage() diff --git a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.h b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.h index 77ca698f8d..60d31eea3f 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.h +++ b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.h @@ -261,8 +261,8 @@ private: struct { - size_t m_vertexUploadDuration; - size_t m_textureUploadDuration; + size_t m_drawCallDuration; + size_t m_drawCallCount; } m_timers; void ResetTimer();