mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-12-02 05:54:18 +01:00
use more efficient cpu cache mode when possible
This commit is contained in:
parent
be0a69a5e2
commit
9bb7479d16
@ -11,6 +11,7 @@ LatteTextureMtl::LatteTextureMtl(class MetalRenderer* mtlRenderer, Latte::E_DIM
|
|||||||
{
|
{
|
||||||
MTL::TextureDescriptor* desc = MTL::TextureDescriptor::alloc()->init();
|
MTL::TextureDescriptor* desc = MTL::TextureDescriptor::alloc()->init();
|
||||||
desc->setStorageMode(m_mtlr->HasUnifiedMemory() ? MTL::StorageModeShared : MTL::StorageModePrivate);
|
desc->setStorageMode(m_mtlr->HasUnifiedMemory() ? MTL::StorageModeShared : MTL::StorageModePrivate);
|
||||||
|
desc->setCpuCacheMode(MTL::CPUCacheModeWriteCombined);
|
||||||
|
|
||||||
sint32 effectiveBaseWidth = width;
|
sint32 effectiveBaseWidth = width;
|
||||||
sint32 effectiveBaseHeight = height;
|
sint32 effectiveBaseHeight = height;
|
||||||
|
@ -69,7 +69,7 @@ public:
|
|||||||
|
|
||||||
// If no free range was found, allocate a new buffer
|
// If no free range was found, allocate a new buffer
|
||||||
m_allocationSize = std::max(m_allocationSize, size);
|
m_allocationSize = std::max(m_allocationSize, size);
|
||||||
MTL::Buffer* buffer = m_mtlr->GetDevice()->newBuffer(m_allocationSize, m_storageMode);
|
MTL::Buffer* buffer = m_mtlr->GetDevice()->newBuffer(m_allocationSize, m_storageMode | MTL::ResourceCPUCacheModeWriteCombined);
|
||||||
#ifdef CEMU_DEBUG_ASSERT
|
#ifdef CEMU_DEBUG_ASSERT
|
||||||
buffer->setLabel(GetLabel("Buffer from buffer allocator", buffer));
|
buffer->setLabel(GetLabel("Buffer from buffer allocator", buffer));
|
||||||
#endif
|
#endif
|
||||||
|
@ -132,7 +132,7 @@ void MetalMemoryManager::InitBufferCache(size_t size)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bufferCache = m_mtlr->GetDevice()->newBuffer(size, m_mtlr->GetOptimalResourceStorageMode());
|
m_bufferCache = m_mtlr->GetDevice()->newBuffer(size, m_mtlr->GetOptimalResourceStorageMode() | MTL::ResourceCPUCacheModeWriteCombined);
|
||||||
#ifdef CEMU_DEBUG_ASSERT
|
#ifdef CEMU_DEBUG_ASSERT
|
||||||
m_bufferCache->setLabel(GetLabel("Buffer cache", m_bufferCache));
|
m_bufferCache->setLabel(GetLabel("Buffer cache", m_bufferCache));
|
||||||
#endif
|
#endif
|
||||||
|
@ -73,7 +73,7 @@ MetalRenderer::MetalRenderer()
|
|||||||
m_samplerCache = new MetalSamplerCache(this);
|
m_samplerCache = new MetalSamplerCache(this);
|
||||||
|
|
||||||
// Texture readback
|
// Texture readback
|
||||||
m_readbackBuffer = m_device->newBuffer(TEXTURE_READBACK_SIZE, MTL::StorageModeShared);
|
m_readbackBuffer = m_device->newBuffer(TEXTURE_READBACK_SIZE, MTL::ResourceStorageModeShared);
|
||||||
#ifdef CEMU_DEBUG_ASSERT
|
#ifdef CEMU_DEBUG_ASSERT
|
||||||
m_readbackBuffer->setLabel(GetLabel("Texture readback buffer", m_readbackBuffer));
|
m_readbackBuffer->setLabel(GetLabel("Texture readback buffer", m_readbackBuffer));
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user