mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-12-01 21:44:17 +01:00
add: basic debug overlay
This commit is contained in:
parent
6bf3406793
commit
b105a383aa
@ -567,6 +567,7 @@ if(ENABLE_METAL)
|
|||||||
HW/Latte/Renderer/Metal/MetalSamplerCache.h
|
HW/Latte/Renderer/Metal/MetalSamplerCache.h
|
||||||
HW/Latte/Renderer/Metal/MetalHybridComputePipeline.cpp
|
HW/Latte/Renderer/Metal/MetalHybridComputePipeline.cpp
|
||||||
HW/Latte/Renderer/Metal/MetalHybridComputePipeline.h
|
HW/Latte/Renderer/Metal/MetalHybridComputePipeline.h
|
||||||
|
HW/Latte/Renderer/Metal/MetalPerformanceMonitor.h
|
||||||
HW/Latte/Renderer/Metal/UtilityShaderSource.h
|
HW/Latte/Renderer/Metal/UtilityShaderSource.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -93,6 +93,9 @@ public:
|
|||||||
m_freeBufferRanges.push_back(range);
|
m_freeBufferRanges.push_back(range);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debug
|
||||||
|
m_mtlr->GetPerformanceMonitor().m_bufferAllocatorMemory += m_allocationSize;
|
||||||
|
|
||||||
// Increase the allocation size for the next buffer
|
// Increase the allocation size for the next buffer
|
||||||
if (m_allocationSize < 128 * 1024 * 1024)
|
if (m_allocationSize < 128 * 1024 * 1024)
|
||||||
m_allocationSize *= 2;
|
m_allocationSize *= 2;
|
||||||
|
18
src/Cafe/HW/Latte/Renderer/Metal/MetalPerformanceMonitor.h
Normal file
18
src/Cafe/HW/Latte/Renderer/Metal/MetalPerformanceMonitor.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class MetalPerformanceMonitor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
size_t m_bufferAllocatorMemory = 0;
|
||||||
|
|
||||||
|
// Per frame data
|
||||||
|
uint32 m_renderPasses = 0;
|
||||||
|
|
||||||
|
MetalPerformanceMonitor() = default;
|
||||||
|
~MetalPerformanceMonitor() = default;
|
||||||
|
|
||||||
|
void ResetPerFrameData()
|
||||||
|
{
|
||||||
|
m_renderPasses = 0;
|
||||||
|
}
|
||||||
|
};
|
@ -20,6 +20,9 @@ public:
|
|||||||
|
|
||||||
MTL::RenderPipelineState* GetMeshPipelineState(const LatteFetchShader* fetchShader, const LatteDecompilerShader* vertexShader, const LatteDecompilerShader* geometryShader, const LatteDecompilerShader* pixelShader, class CachedFBOMtl* activeFBO, const LatteContextRegister& lcr, Renderer::INDEX_TYPE hostIndexType);
|
MTL::RenderPipelineState* GetMeshPipelineState(const LatteFetchShader* fetchShader, const LatteDecompilerShader* vertexShader, const LatteDecompilerShader* geometryShader, const LatteDecompilerShader* pixelShader, class CachedFBOMtl* activeFBO, const LatteContextRegister& lcr, Renderer::INDEX_TYPE hostIndexType);
|
||||||
|
|
||||||
|
// Debug
|
||||||
|
size_t GetPipelineCacheSize() const { return m_pipelineCache.size(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class MetalRenderer* m_mtlr;
|
class MetalRenderer* m_mtlr;
|
||||||
|
|
||||||
|
@ -395,7 +395,13 @@ void MetalRenderer::DeleteFontTextures()
|
|||||||
|
|
||||||
void MetalRenderer::AppendOverlayDebugInfo()
|
void MetalRenderer::AppendOverlayDebugInfo()
|
||||||
{
|
{
|
||||||
// TODO: implement
|
ImGui::Text("--- Metal info ---");
|
||||||
|
ImGui::Text("Render pipeline states %zu", m_pipelineCache->GetPipelineCacheSize());
|
||||||
|
ImGui::Text("Buffer allocator memory %zuMB", m_performanceMonitor.m_bufferAllocatorMemory / 1024 / 1024);
|
||||||
|
|
||||||
|
ImGui::Text("--- Metal info (per frame) ---");
|
||||||
|
ImGui::Text("Command buffers %zu", m_commandBuffers.size());
|
||||||
|
ImGui::Text("Render passes %u", m_performanceMonitor.m_renderPasses);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: halfZ
|
// TODO: halfZ
|
||||||
@ -1725,6 +1731,9 @@ void MetalRenderer::SwapBuffer(bool mainWindow)
|
|||||||
{
|
{
|
||||||
debug_printf("skipped present!\n");
|
debug_printf("skipped present!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debug
|
||||||
|
m_performanceMonitor.ResetPerFrameData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetalRenderer::EnsureImGuiBackend()
|
void MetalRenderer::EnsureImGuiBackend()
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "Cafe/HW/Latte/Renderer/Renderer.h"
|
#include "Cafe/HW/Latte/Renderer/Renderer.h"
|
||||||
|
|
||||||
#include "Cafe/HW/Latte/Renderer/Metal/MetalLayerHandle.h"
|
#include "Cafe/HW/Latte/Renderer/Metal/MetalLayerHandle.h"
|
||||||
|
#include "Cafe/HW/Latte/Renderer/Metal/MetalPerformanceMonitor.h"
|
||||||
|
|
||||||
struct MetalBufferAllocation
|
struct MetalBufferAllocation
|
||||||
{
|
{
|
||||||
@ -312,6 +313,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
|
MetalPerformanceMonitor& GetPerformanceMonitor() { return m_performanceMonitor; }
|
||||||
|
|
||||||
MTL::CommandBuffer* GetCurrentCommandBuffer()
|
MTL::CommandBuffer* GetCurrentCommandBuffer()
|
||||||
{
|
{
|
||||||
cemu_assert_debug(m_commandBuffers.size() != 0);
|
cemu_assert_debug(m_commandBuffers.size() != 0);
|
||||||
@ -407,6 +410,8 @@ private:
|
|||||||
MetalLayerHandle m_mainLayer;
|
MetalLayerHandle m_mainLayer;
|
||||||
MetalLayerHandle m_padLayer;
|
MetalLayerHandle m_padLayer;
|
||||||
|
|
||||||
|
MetalPerformanceMonitor m_performanceMonitor;
|
||||||
|
|
||||||
// Metal objects
|
// Metal objects
|
||||||
MTL::Device* m_device;
|
MTL::Device* m_device;
|
||||||
MTL::CommandQueue* m_commandQueue;
|
MTL::CommandQueue* m_commandQueue;
|
||||||
|
Loading…
Reference in New Issue
Block a user