Graphics/FrameGraph: Reuse memory when building physical passes

This commit is contained in:
SirLynix 2023-09-10 14:46:09 +02:00
parent e1ccb3187d
commit 4723c92a65
1 changed files with 86 additions and 80 deletions

View File

@ -704,13 +704,10 @@ namespace Nz
std::vector<TextureLayout> textureLayouts(m_pending.textures.size(), TextureLayout::Undefined);
std::size_t physicalPassIndex = 0;
for (auto& physicalPass : m_pending.physicalPasses)
{
std::unordered_map<std::size_t /*textureId*/, std::size_t /*attachmentIndex*/> usedTextureAttachments;
std::size_t depthStencilAttachmentId;
// Per-pass data (reuse memory)
std::optional<std::size_t> depthStencilAttachmentIndex;
std::size_t depthStencilAttachmentId;
std::unordered_map<std::size_t /*textureId*/, std::size_t /*attachmentIndex*/> usedTextureAttachments;
std::vector<RenderPass::Attachment> renderPassAttachments;
std::vector<RenderPass::SubpassDescription> subpassesDesc;
std::vector<RenderPass::SubpassDependency> subpassesDeps;
@ -788,6 +785,15 @@ namespace Nz
return depthStencilAttachment;
};
std::size_t physicalPassIndex = 0;
for (auto& physicalPass : m_pending.physicalPasses)
{
depthStencilAttachmentIndex = std::nullopt;
usedTextureAttachments.clear();
renderPassAttachments.clear();
subpassesDesc.clear();
subpassesDeps.clear();
std::size_t subpassIndex = 0;
std::vector<RenderPass::AttachmentReference> colorAttachments;