report total vram correctly

This commit is contained in:
Samuliak 2024-08-24 17:06:50 +02:00
parent 7499c3fbe7
commit c4a26d4c70
2 changed files with 4 additions and 1 deletions

View File

@ -40,6 +40,7 @@ MetalRenderer::MetalRenderer()
// Feature support // Feature support
m_hasUnifiedMemory = m_device->hasUnifiedMemory(); m_hasUnifiedMemory = m_device->hasUnifiedMemory();
m_isAppleGPU = m_device->supportsFamily(MTL::GPUFamilyApple1); m_isAppleGPU = m_device->supportsFamily(MTL::GPUFamilyApple1);
m_recommendedMaxVRAMUsage = m_device->recommendedMaxWorkingSetSize();
m_pixelFormatSupport = MetalPixelFormatSupport(m_device); m_pixelFormatSupport = MetalPixelFormatSupport(m_device);
// Resources // Resources
@ -213,7 +214,8 @@ bool MetalRenderer::IsPadWindowActive()
bool MetalRenderer::GetVRAMInfo(int& usageInMB, int& totalInMB) const bool MetalRenderer::GetVRAMInfo(int& usageInMB, int& totalInMB) const
{ {
usageInMB = m_device->currentAllocatedSize() / 1024 / 1024; usageInMB = m_device->currentAllocatedSize() / 1024 / 1024;
totalInMB = usageInMB; // TODO: get the total VRAM size? Though would be pretty useless on Apple Silicon
totalInMB = m_recommendedMaxVRAMUsage / 1024 / 1024;
return true; return true;
} }

View File

@ -414,6 +414,7 @@ private:
// Feature support // Feature support
bool m_hasUnifiedMemory; bool m_hasUnifiedMemory;
bool m_isAppleGPU; bool m_isAppleGPU;
uint32 m_recommendedMaxVRAMUsage;
MetalPixelFormatSupport m_pixelFormatSupport; MetalPixelFormatSupport m_pixelFormatSupport;
// Managers and caches // Managers and caches