From 37bead6fa562a8ed54c1710385527b4ab18930b0 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Fri, 26 Jan 2018 16:36:37 -0500 Subject: [PATCH] Vulkan: transition attachments implicitly --- src/backend/vulkan/CommandBufferVk.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/backend/vulkan/CommandBufferVk.cpp b/src/backend/vulkan/CommandBufferVk.cpp index 65b2c105e8..a4be2a9235 100644 --- a/src/backend/vulkan/CommandBufferVk.cpp +++ b/src/backend/vulkan/CommandBufferVk.cpp @@ -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);