Graphics/BakedFrameGraph: Don't release in flight resources

This commit is contained in:
Jérôme Leclercq 2021-07-17 20:57:36 +02:00
parent 40ecdda3cd
commit f61deabe92
2 changed files with 6 additions and 5 deletions

View File

@ -36,7 +36,7 @@ namespace Nz
const std::shared_ptr<Texture>& GetAttachmentTexture(std::size_t attachmentIndex) const;
const std::shared_ptr<RenderPass>& GetRenderPass(std::size_t passIndex) const;
bool Resize(unsigned int width, unsigned int height);
bool Resize(RenderFrame& renderFrame);
BakedFrameGraph& operator=(const BakedFrameGraph&) = delete;
BakedFrameGraph& operator=(BakedFrameGraph&&) noexcept = default;

View File

@ -123,8 +123,9 @@ namespace Nz
return m_passes[physicalPassIndex].renderPass;
}
bool BakedFrameGraph::Resize(unsigned int width, unsigned int height)
bool BakedFrameGraph::Resize(RenderFrame& renderFrame)
{
auto [width, height] = renderFrame.GetSize();
if (m_width == width && m_height == height)
return false;
@ -133,12 +134,12 @@ namespace Nz
// Delete previous textures to make some room in VRAM
for (auto& passData : m_passes)
{
passData.commandBuffer.reset();
passData.framebuffer.reset();
renderFrame.PushForRelease(std::move(passData.commandBuffer));
renderFrame.PushForRelease(std::move(passData.framebuffer));
}
for (auto& textureData : m_textures)
textureData.texture.reset();
renderFrame.PushForRelease(std::move(textureData.texture));
for (auto& textureData : m_textures)
{