Skip to content

Commit

Permalink
add: additional debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
SamoZ256 committed Aug 25, 2024
1 parent c905399 commit 96d6168
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
11 changes: 9 additions & 2 deletions src/Cafe/HW/Latte/Renderer/Metal/MetalRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "HW/Latte/Renderer/Metal/MetalCommon.h"
#include "HW/Latte/Renderer/Metal/MetalLayerHandle.h"
#include "HW/Latte/Renderer/Renderer.h"
#include "Metal/MTLDevice.hpp"
#include "Metal/MTLRenderPass.hpp"
#include "imgui.h"

Expand All @@ -39,8 +40,9 @@ MetalRenderer::MetalRenderer()
m_commandQueue = m_device->newCommandQueue();

// Feature support
m_hasUnifiedMemory = m_device->hasUnifiedMemory();
m_isAppleGPU = m_device->supportsFamily(MTL::GPUFamilyApple1);
m_hasUnifiedMemory = m_device->hasUnifiedMemory();
m_supportsMetal3 = m_device->supportsFamily(MTL::GPUFamilyMetal3);
m_recommendedMaxVRAMUsage = m_device->recommendedMaxWorkingSetSize();
m_pixelFormatSupport = MetalPixelFormatSupport(m_device);

Expand Down Expand Up @@ -413,13 +415,18 @@ void MetalRenderer::DeleteFontTextures()

void MetalRenderer::AppendOverlayDebugInfo()
{
ImGui::Text("--- GPU info ---");
ImGui::Text("Is Apple GPU %s", (m_isAppleGPU ? "yes" : "no"));
ImGui::Text("Has unified memory %s", (m_hasUnifiedMemory ? "yes" : "no"));
ImGui::Text("Supports Metal3 %s", (m_supportsMetal3 ? "yes" : "no"));

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);
ImGui::Text("Render passes %u", m_performanceMonitor.m_renderPasses);
}

// TODO: halfZ
Expand Down
12 changes: 9 additions & 3 deletions src/Cafe/HW/Latte/Renderer/Metal/MetalRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,19 @@ class MetalRenderer : public Renderer
void ClearColorTextureInternal(MTL::Texture* mtlTexture, sint32 sliceIndex, sint32 mipIndex, float r, float g, float b, float a);

// Getters
bool IsAppleGPU() const
{
return m_isAppleGPU;
}

bool HasUnifiedMemory() const
{
return m_hasUnifiedMemory;
}

bool IsAppleGPU() const
bool SupportsMetal3() const
{
return m_isAppleGPU;
return m_supportsMetal3;
}

const MetalPixelFormatSupport& GetPixelFormatSupport() const
Expand Down Expand Up @@ -417,8 +422,9 @@ class MetalRenderer : public Renderer
MTL::CommandQueue* m_commandQueue;

// Feature support
bool m_hasUnifiedMemory;
bool m_isAppleGPU;
bool m_hasUnifiedMemory;
bool m_supportsMetal3;
uint32 m_recommendedMaxVRAMUsage;
MetalPixelFormatSupport m_pixelFormatSupport;

Expand Down

0 comments on commit 96d6168

Please sign in to comment.