mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-16 18:59:48 +12:00
implement clearBuffer for color render targets
This commit is contained in:
parent
940f05bb85
commit
3be48c7c0c
1 changed files with 25 additions and 2 deletions
|
@ -209,8 +209,31 @@ void RendererMTL::initGraphicsContext(SDL_Window* window) {
|
|||
}
|
||||
|
||||
void RendererMTL::clearBuffer(u32 startAddress, u32 endAddress, u32 value, u32 control) {
|
||||
// TODO: implement
|
||||
Helpers::warn("RendererMTL::clearBuffer not implemented");
|
||||
createCommandBufferIfNeeded();
|
||||
|
||||
const auto color = colorRenderTargetCache.findFromAddress(startAddress);
|
||||
if (color) {
|
||||
const float r = Helpers::getBits<24, 8>(value) / 255.0f;
|
||||
const float g = Helpers::getBits<16, 8>(value) / 255.0f;
|
||||
const float b = Helpers::getBits<8, 8>(value) / 255.0f;
|
||||
const float a = (value & 0xff) / 255.0f;
|
||||
|
||||
MTL::RenderPassDescriptor* passDescriptor = MTL::RenderPassDescriptor::alloc()->init();
|
||||
MTL::RenderPassColorAttachmentDescriptor* colorAttachment = passDescriptor->colorAttachments()->object(0);
|
||||
colorAttachment->setTexture(color->get().texture);
|
||||
colorAttachment->setClearColor(MTL::ClearColor(r, g, b, a));
|
||||
colorAttachment->setLoadAction(MTL::LoadActionClear);
|
||||
colorAttachment->setStoreAction(MTL::StoreActionStore);
|
||||
|
||||
MTL::RenderCommandEncoder* renderEncoder = commandBuffer->renderCommandEncoder(passDescriptor);
|
||||
renderEncoder->endEncoding();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Implement depth and stencil buffers
|
||||
|
||||
Helpers::warn("[RendererGL::ClearBuffer] No buffer found!\n");
|
||||
}
|
||||
|
||||
void RendererMTL::displayTransfer(u32 inputAddr, u32 outputAddr, u32 inputSize, u32 outputSize, u32 flags) {
|
||||
|
|
Loading…
Add table
Reference in a new issue