mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-09 00:11:17 +12:00
46 lines
1.5 KiB
C++
46 lines
1.5 KiB
C++
#include "Cafe/HW/Latte/Renderer/Metal/CachedFBOMtl.h"
|
|
#include "Cafe/HW/Latte/Renderer/Metal/LatteTextureViewMtl.h"
|
|
#include "Metal/MTLRenderPass.hpp"
|
|
|
|
void CachedFBOMtl::CreateRenderPass()
|
|
{
|
|
m_renderPassDescriptor = MTL::RenderPassDescriptor::alloc()->init();
|
|
|
|
for (int i = 0; i < 8; ++i)
|
|
{
|
|
const auto& buffer = colorBuffer[i];
|
|
auto textureView = (LatteTextureViewMtl*)buffer.texture;
|
|
if (!textureView)
|
|
{
|
|
continue;
|
|
}
|
|
auto colorAttachment = m_renderPassDescriptor->colorAttachments()->object(i);
|
|
colorAttachment->setTexture(textureView->GetRGBAView());
|
|
colorAttachment->setLoadAction(MTL::LoadActionLoad);
|
|
colorAttachment->setStoreAction(MTL::StoreActionStore);
|
|
}
|
|
|
|
// setup depth attachment
|
|
if (depthBuffer.texture)
|
|
{
|
|
auto textureView = static_cast<LatteTextureViewMtl*>(depthBuffer.texture);
|
|
auto depthAttachment = m_renderPassDescriptor->depthAttachment();
|
|
depthAttachment->setTexture(textureView->GetRGBAView());
|
|
depthAttachment->setLoadAction(MTL::LoadActionLoad);
|
|
depthAttachment->setStoreAction(MTL::StoreActionStore);
|
|
|
|
// setup stencil attachment
|
|
if (depthBuffer.hasStencil)
|
|
{
|
|
auto stencilAttachment = m_renderPassDescriptor->stencilAttachment();
|
|
stencilAttachment->setTexture(textureView->GetRGBAView());
|
|
stencilAttachment->setLoadAction(MTL::LoadActionLoad);
|
|
stencilAttachment->setStoreAction(MTL::StoreActionStore);
|
|
}
|
|
}
|
|
}
|
|
|
|
CachedFBOMtl::~CachedFBOMtl()
|
|
{
|
|
m_renderPassDescriptor->release();
|
|
}
|