Vulkan: transition attachments implicitly

This commit is contained in:
Corentin Wallez 2018-01-26 16:36:37 -05:00 committed by Corentin Wallez
parent 407233390b
commit 37bead6fa5
1 changed files with 10 additions and 0 deletions

View File

@ -122,6 +122,16 @@ namespace backend { namespace vulkan {
Framebuffer* framebuffer = ToBackend(cmd->framebuffer.Get());
RenderPass* renderPass = ToBackend(cmd->renderPass.Get());
// NXT has an implicit transition to color attachment on subpasses. Transition
// the attachments now before we start the render pass.
for (uint32_t i = 0; i < renderPass->GetAttachmentCount(); ++i) {
Texture* attachment =
ToBackend(framebuffer->GetTextureView(i)->GetTexture());
attachment->RecordBarrier(commands, attachment->GetUsage(),
nxt::TextureUsageBit::OutputAttachment);
attachment->UpdateUsageInternal(nxt::TextureUsageBit::OutputAttachment);
}
ASSERT(renderPass->GetSubpassCount() == 1);
ASSERT(renderPass->GetAttachmentCount() <= kMaxColorAttachments + 1);