release texture upload buffer

This commit is contained in:
Samuliak 2024-11-05 17:06:08 +01:00
parent 27902009c6
commit 07c62d5f95
No known key found for this signature in database
3 changed files with 14 additions and 5 deletions

View File

@ -14,7 +14,7 @@ MetalMemoryManager::~MetalMemoryManager()
} }
} }
void* MetalMemoryManager::GetTextureUploadBuffer(size_t size) void* MetalMemoryManager::AcquireTextureUploadBuffer(size_t size)
{ {
if (m_textureUploadBuffer.size() < size) if (m_textureUploadBuffer.size() < size)
{ {
@ -24,6 +24,12 @@ void* MetalMemoryManager::GetTextureUploadBuffer(size_t size)
return m_textureUploadBuffer.data(); return m_textureUploadBuffer.data();
} }
void MetalMemoryManager::ReleaseTextureUploadBuffer(uint8* mem)
{
cemu_assert_debug(m_textureUploadBuffer.data() == mem);
m_textureUploadBuffer.clear();
}
void MetalMemoryManager::InitBufferCache(size_t size) void MetalMemoryManager::InitBufferCache(size_t size)
{ {
cemu_assert_debug(!m_bufferCache); cemu_assert_debug(!m_bufferCache);

View File

@ -30,7 +30,9 @@ public:
return m_bufferCache; return m_bufferCache;
} }
void* GetTextureUploadBuffer(size_t size); // Texture upload buffer
void* AcquireTextureUploadBuffer(size_t size);
void ReleaseTextureUploadBuffer(uint8* mem);
// Buffer cache // Buffer cache
void InitBufferCache(size_t size); void InitBufferCache(size_t size);

View File

@ -456,9 +456,10 @@ void MetalRenderer::AppendOverlayDebugInfo()
ImGui::Text("Triangle fans %u", m_performanceMonitor.m_triangleFans); ImGui::Text("Triangle fans %u", m_performanceMonitor.m_triangleFans);
} }
// TODO: halfZ
void MetalRenderer::renderTarget_setViewport(float x, float y, float width, float height, float nearZ, float farZ, bool halfZ) void MetalRenderer::renderTarget_setViewport(float x, float y, float width, float height, float nearZ, float farZ, bool halfZ)
{ {
// halfZ is handled in the shader
m_state.m_viewport = MTL::Viewport{x, y, width, height, nearZ, farZ}; m_state.m_viewport = MTL::Viewport{x, y, width, height, nearZ, farZ};
} }
@ -485,12 +486,12 @@ void MetalRenderer::rendertarget_bindFramebufferObject(LatteCachedFBO* cfbo)
void* MetalRenderer::texture_acquireTextureUploadBuffer(uint32 size) void* MetalRenderer::texture_acquireTextureUploadBuffer(uint32 size)
{ {
return m_memoryManager->GetTextureUploadBuffer(size); return m_memoryManager->AcquireTextureUploadBuffer(size);
} }
void MetalRenderer::texture_releaseTextureUploadBuffer(uint8* mem) void MetalRenderer::texture_releaseTextureUploadBuffer(uint8* mem)
{ {
// TODO: should the texture buffer get released? m_memoryManager->ReleaseTextureUploadBuffer(mem);
} }
TextureDecoder* MetalRenderer::texture_chooseDecodedFormat(Latte::E_GX2SURFFMT format, bool isDepth, Latte::E_DIM dim, uint32 width, uint32 height) TextureDecoder* MetalRenderer::texture_chooseDecodedFormat(Latte::E_GX2SURFFMT format, bool isDepth, Latte::E_DIM dim, uint32 width, uint32 height)