From 7f37a7ddbecf2b775ad7c523ee94cee5a3ffa150 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Mon, 8 Apr 2024 22:10:11 -0300 Subject: [PATCH] metal: fix texture uploads in the middle of a render pass stopping the pass' subsequent draws from working. --- src/modules/graphics/metal/Graphics.mm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/modules/graphics/metal/Graphics.mm b/src/modules/graphics/metal/Graphics.mm index 0c2380073..76acee379 100644 --- a/src/modules/graphics/metal/Graphics.mm +++ b/src/modules/graphics/metal/Graphics.mm @@ -743,16 +743,22 @@ void Graphics::submitRenderEncoder(SubmitType type) for (int i = 0; i < MAX_COLOR_RENDER_TARGETS; i++) { passDesc.colorAttachments[i].loadAction = MTLLoadActionLoad; - passDesc.colorAttachments[i].texture = nil; - passDesc.colorAttachments[i].resolveTexture = nil; + if (type == SUBMIT_DONE) + { + passDesc.colorAttachments[i].texture = nil; + passDesc.colorAttachments[i].resolveTexture = nil; + } } passDesc.depthAttachment.loadAction = MTLLoadActionLoad; - passDesc.depthAttachment.texture = nil; - passDesc.depthAttachment.resolveTexture = nil; passDesc.stencilAttachment.loadAction = MTLLoadActionLoad; - passDesc.stencilAttachment.texture = nil; - passDesc.stencilAttachment.resolveTexture = nil; + if (type == SUBMIT_DONE) + { + passDesc.depthAttachment.texture = nil; + passDesc.depthAttachment.resolveTexture = nil; + passDesc.stencilAttachment.texture = nil; + passDesc.stencilAttachment.resolveTexture = nil; + } } }