Skip to content

Commit

Permalink
metal: fix backbuffer discarding its contents in some situations.
Browse files Browse the repository at this point in the history
fixes #1975.
  • Loading branch information
slime73 committed Apr 8, 2024
1 parent d40b78b commit 6bc91a0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/modules/graphics/metal/Graphics.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1459,10 +1459,15 @@ static inline void advanceVertexOffsets(const VertexAttributes &attributes, Buff
}

for (size_t i = rts.colors.size(); i < MAX_COLOR_RENDER_TARGETS; i++)
{
passDesc.colorAttachments[i] = nil;
passDesc.colorAttachments[i].loadAction = MTLLoadActionLoad;
}

passDesc.depthAttachment = nil;
passDesc.depthAttachment.loadAction = MTLLoadActionLoad;
passDesc.stencilAttachment = nil;
passDesc.stencilAttachment.loadAction = MTLLoadActionLoad;

auto ds = rts.depthStencil.texture;
if (isbackbuffer && ds == nullptr)
Expand Down

0 comments on commit 6bc91a0

Please sign in to comment.