mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-01-07 15:48:15 +01:00
correctly report memory usage for host buffer cache
This commit is contained in:
parent
e00d244e0d
commit
fbea328b9b
@ -33,9 +33,8 @@ void MetalMemoryManager::InitBufferCache(size_t size)
|
||||
if (m_bufferCacheType == BufferCacheType::Host && m_mtlr->IsAppleGPU())
|
||||
{
|
||||
m_importedMemBaseAddress = 0x10000000;
|
||||
size_t hostAllocationSize = 0x40000000ull;
|
||||
// TODO: get size of allocation
|
||||
m_bufferCache = m_mtlr->GetDevice()->newBuffer(memory_getPointerFromVirtualOffset(m_importedMemBaseAddress), hostAllocationSize, MTL::ResourceStorageModeShared, nullptr);
|
||||
m_hostAllocationSize = 0x40000000ull; // TODO: get size of allocation
|
||||
m_bufferCache = m_mtlr->GetDevice()->newBuffer(memory_getPointerFromVirtualOffset(m_importedMemBaseAddress), m_hostAllocationSize, MTL::ResourceStorageModeShared, nullptr);
|
||||
if (!m_bufferCache)
|
||||
{
|
||||
cemuLog_logDebug(LogType::Force, "Failed to import host memory as a buffer");
|
||||
|
@ -48,6 +48,11 @@ public:
|
||||
return m_importedMemBaseAddress;
|
||||
}
|
||||
|
||||
size_t GetHostAllocationSize() const
|
||||
{
|
||||
return m_hostAllocationSize;
|
||||
}
|
||||
|
||||
private:
|
||||
class MetalRenderer* m_mtlr;
|
||||
|
||||
@ -60,4 +65,5 @@ private:
|
||||
MTL::Buffer* m_bufferCache = nullptr;
|
||||
BufferCacheType m_bufferCacheType;
|
||||
MPTR m_importedMemBaseAddress;
|
||||
size_t m_hostAllocationSize = 0;
|
||||
};
|
||||
|
@ -204,7 +204,8 @@ bool MetalRenderer::IsPadWindowActive()
|
||||
|
||||
bool MetalRenderer::GetVRAMInfo(int& usageInMB, int& totalInMB) const
|
||||
{
|
||||
usageInMB = m_device->currentAllocatedSize() / 1024 / 1024;
|
||||
// Subtract host memory from total VRAM, since it's shared with the CPU
|
||||
usageInMB = (m_device->currentAllocatedSize() - m_memoryManager->GetHostAllocationSize()) / 1024 / 1024;
|
||||
totalInMB = m_recommendedMaxVRAMUsage / 1024 / 1024;
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user