report manual vertex fetch draws per frame

This commit is contained in:
Samuliak 2024-10-01 18:18:39 +02:00
parent f2096deddd
commit 50175fce66
2 changed files with 19 additions and 13 deletions

View File

@ -8,7 +8,8 @@ public:
// Per frame data // Per frame data
uint32 m_renderPasses = 0; uint32 m_renderPasses = 0;
uint32 m_clears = 0; uint32 m_clears = 0;
uint32 m_vertexBufferRestrides = 0; uint32 m_manualVertexFetchDraws = 0;
uint32 m_meshDraws = 0;
uint32 m_triangleFans = 0; uint32 m_triangleFans = 0;
MetalPerformanceMonitor() = default; MetalPerformanceMonitor() = default;
@ -18,7 +19,8 @@ public:
{ {
m_renderPasses = 0; m_renderPasses = 0;
m_clears = 0; m_clears = 0;
m_vertexBufferRestrides = 0; m_manualVertexFetchDraws = 0;
m_meshDraws = 0;
m_triangleFans = 0; m_triangleFans = 0;
} }
}; };

View File

@ -475,20 +475,20 @@ void MetalRenderer::DeleteFontTextures()
void MetalRenderer::AppendOverlayDebugInfo() void MetalRenderer::AppendOverlayDebugInfo()
{ {
ImGui::Text("--- GPU info ---"); ImGui::Text("--- GPU info ---");
ImGui::Text("Is Apple GPU %s", (m_isAppleGPU ? "yes" : "no")); ImGui::Text("Is Apple GPU %s", (m_isAppleGPU ? "yes" : "no"));
ImGui::Text("Has unified memory %s", (m_hasUnifiedMemory ? "yes" : "no")); ImGui::Text("Has unified memory %s", (m_hasUnifiedMemory ? "yes" : "no"));
ImGui::Text("Supports Metal3 %s", (m_supportsMetal3 ? "yes" : "no")); ImGui::Text("Supports Metal3 %s", (m_supportsMetal3 ? "yes" : "no"));
ImGui::Text("--- Metal info ---"); ImGui::Text("--- Metal info ---");
ImGui::Text("Render pipeline states %zu", m_pipelineCache->GetPipelineCacheSize()); ImGui::Text("Render pipeline states %zu", m_pipelineCache->GetPipelineCacheSize());
ImGui::Text("Buffer allocator memory %zuMB", m_performanceMonitor.m_bufferAllocatorMemory / 1024 / 1024); ImGui::Text("Buffer allocator memory %zuMB", m_performanceMonitor.m_bufferAllocatorMemory / 1024 / 1024);
ImGui::Text("--- Metal info (per frame) ---"); ImGui::Text("--- Metal info (per frame) ---");
ImGui::Text("Command buffers %zu", m_commandBuffers.size()); ImGui::Text("Command buffers %zu", m_commandBuffers.size());
ImGui::Text("Render passes %u", m_performanceMonitor.m_renderPasses); ImGui::Text("Render passes %u", m_performanceMonitor.m_renderPasses);
ImGui::Text("Clears %u", m_performanceMonitor.m_clears); ImGui::Text("Clears %u", m_performanceMonitor.m_clears);
ImGui::Text("Vertex buffer restrides %u", m_performanceMonitor.m_vertexBufferRestrides); ImGui::Text("Manual vertex fetch draws %u (mesh draws: %u)", m_performanceMonitor.m_manualVertexFetchDraws, m_performanceMonitor.m_meshDraws);
ImGui::Text("Triangle fans %u", m_performanceMonitor.m_triangleFans); ImGui::Text("Triangle fans %u", m_performanceMonitor.m_triangleFans);
} }
// TODO: halfZ // TODO: halfZ
@ -975,7 +975,7 @@ void MetalRenderer::draw_execute(uint32 baseVertex, uint32 baseInstance, uint32
bool isPrimitiveRect = (primitiveMode == Latte::LATTE_VGT_PRIMITIVE_TYPE::E_PRIMITIVE_TYPE::RECTS); bool isPrimitiveRect = (primitiveMode == Latte::LATTE_VGT_PRIMITIVE_TYPE::E_PRIMITIVE_TYPE::RECTS);
bool usesGeometryShader = (geometryShader != nullptr || isPrimitiveRect); bool usesGeometryShader = (geometryShader != nullptr || isPrimitiveRect);
//bool fetchVertexManually = (usesGeometryShader || fetchShader->mtlFetchVertexManually); bool fetchVertexManually = (usesGeometryShader || fetchShader->mtlFetchVertexManually);
// Index buffer // Index buffer
Renderer::INDEX_TYPE hostIndexType; Renderer::INDEX_TYPE hostIndexType;
@ -1299,6 +1299,10 @@ void MetalRenderer::draw_execute(uint32 baseVertex, uint32 baseInstance, uint32
LatteStreamout_FinishDrawcall(false); LatteStreamout_FinishDrawcall(false);
// Debug // Debug
if (fetchVertexManually)
m_performanceMonitor.m_manualVertexFetchDraws++;
if (usesGeometryShader)
m_performanceMonitor.m_meshDraws++;
if (primitiveMode == LattePrimitiveMode::TRIANGLE_FAN) if (primitiveMode == LattePrimitiveMode::TRIANGLE_FAN)
m_performanceMonitor.m_triangleFans++; m_performanceMonitor.m_triangleFans++;