implement vertex descriptors & draw

This commit is contained in:
Samuliak 2024-07-27 21:26:26 +02:00
parent e5395277a7
commit cb525b22ff
9 changed files with 247 additions and 30 deletions

View file

@ -0,0 +1,26 @@
#include "Cafe/HW/Latte/Renderer/Metal/MetalRenderer.h"
void* MetalMemoryManager::GetTextureUploadBuffer(size_t size)
{
if (m_textureUploadBuffer.size() < size)
{
m_textureUploadBuffer.resize(size);
}
return m_textureUploadBuffer.data();
}
// TODO: optimize this
MetalBufferAllocation MetalMemoryManager::GetBufferAllocation(size_t size)
{
MTL::Buffer* buffer = m_mtlr->GetDevice()->newBuffer(size, MTL::ResourceStorageModeShared);
MetalBufferAllocation allocation;
allocation.bufferIndex = m_buffers.size();
allocation.bufferOffset = 0;
allocation.data = buffer->contents();
m_buffers.push_back(buffer);
return allocation;
}