Skip to content

Commit

Permalink
Add missing store action on Metal
Browse files Browse the repository at this point in the history
  • Loading branch information
mogemimi committed Aug 8, 2018
1 parent 57a1c94 commit 466f8c9
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/RenderSystem.Metal/GraphicsContextMetal.mm
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,6 @@ void CheckUnbindingRenderTargetsError(
MTLRenderPassDescriptor* renderPassDescriptor = [[MTLRenderPassDescriptor alloc] init];
POMDOG_ASSERT(renderPassDescriptor != nil);

renderPassDescriptor.depthAttachment.loadAction = MTLLoadActionDontCare;
renderPassDescriptor.stencilAttachment.loadAction = MTLLoadActionDontCare;

int renderTargetIndex = 0;
for (const auto& renderTargetView: renderPass.RenderTargets) {
auto & renderTarget = std::get<0>(renderTargetView);
Expand All @@ -493,6 +490,8 @@ void CheckUnbindingRenderTargetsError(
else {
renderPassDescriptor.colorAttachments[renderTargetIndex].loadAction = MTLLoadActionDontCare;
}

renderPassDescriptor.colorAttachments[renderTargetIndex].storeAction = MTLStoreActionStore;
++renderTargetIndex;
}

Expand All @@ -514,6 +513,15 @@ void CheckUnbindingRenderTargetsError(
}
}

if (renderPassDescriptor.depthAttachment.texture != nil) {
renderPassDescriptor.depthAttachment.loadAction = MTLLoadActionLoad;
renderPassDescriptor.depthAttachment.storeAction = MTLStoreActionStore;
}
if (renderPassDescriptor.stencilAttachment.texture != nil) {
renderPassDescriptor.stencilAttachment.loadAction = MTLLoadActionLoad;
renderPassDescriptor.stencilAttachment.storeAction = MTLStoreActionStore;
}

if (renderPass.ClearDepth) {
renderPassDescriptor.depthAttachment.loadAction = MTLLoadActionClear;
renderPassDescriptor.depthAttachment.clearDepth = *renderPass.ClearDepth;
Expand Down

0 comments on commit 466f8c9

Please sign in to comment.