diff --git a/src/modules/graphics/metal/Graphics.mm b/src/modules/graphics/metal/Graphics.mm index 78efeeaf8..baaade4f1 100644 --- a/src/modules/graphics/metal/Graphics.mm +++ b/src/modules/graphics/metal/Graphics.mm @@ -1341,7 +1341,25 @@ void Graphics::clear(const std::vector &colors, OptionalInt sten void Graphics::discard(const std::vector &colorbuffers, bool depthstencil) { flushBatchedDraws(); + // TODO + if (renderEncoder != nil) + return; + + size_t maxcolor = isRenderTargetActive() ? states.back().renderTargets.colors.size() : 1; + size_t ncolor = std::min(maxcolor, colorbuffers.size()); + + for (size_t i = 0; i < ncolor; i++) + { + if (colorbuffers[i]) + passDesc.colorAttachments[i].loadAction = MTLLoadActionDontCare; + } + + if (depthstencil) + { + passDesc.stencilAttachment.loadAction = MTLLoadActionDontCare; + passDesc.depthAttachment.loadAction = MTLLoadActionDontCare; + } } void Graphics::present(void *screenshotCallbackData)