d3d12: add implicit transition for subpass attachments

This commit is contained in:
Kai Ninomiya
2017-08-29 17:57:27 -07:00
committed by Kai Ninomiya
parent ee7b6b1b62
commit 720a5d9366
2 changed files with 11 additions and 1 deletions

View File

@@ -277,6 +277,16 @@ namespace d3d12 {
uint32_t attachmentSlot = subpass.colorAttachments[location];
const auto& attachmentInfo = currentRenderPass->GetAttachmentInfo(attachmentSlot);
Texture* texture = ToBackend(currentFramebuffer->GetTextureView(attachmentSlot)->GetTexture());
constexpr auto usage = nxt::TextureUsageBit::OutputAttachment;
if (!texture->IsFrozen()) {
D3D12_RESOURCE_BARRIER barrier;
if (texture->GetResourceTransitionBarrier(texture->GetUsage(), usage, &barrier)) {
commandList->ResourceBarrier(1, &barrier);
}
texture->UpdateUsageInternal(usage);
}
// Only perform load op on first use
if (attachmentInfo.firstSubpass == currentSubpass) {
// Load op - color