Renderer: Refactor transient resources (allow access at any time)

This commit is contained in:
SirLynix
2023-07-21 08:51:39 +02:00
committed by Jérôme Leclercq
parent de68033a0e
commit 4db5b59ec9
21 changed files with 265 additions and 240 deletions

View File

@@ -1,44 +0,0 @@
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - Renderer module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/RenderFrame.hpp>
#include <Nazara/Renderer/RenderImage.hpp>
#include <stdexcept>
#include <Nazara/Renderer/Debug.hpp>
namespace Nz
{
void RenderFrame::Execute(const FunctionRef<void(CommandBufferBuilder& builder)>& callback, QueueTypeFlags queueTypeFlags)
{
if (!m_image)
throw std::runtime_error("frame is either invalid or has already been presented");
return m_image->Execute(callback, queueTypeFlags);
}
UploadPool& RenderFrame::GetUploadPool()
{
if (!m_image)
throw std::runtime_error("frame is either invalid or has already been presented");
return m_image->GetUploadPool();
}
void RenderFrame::Present()
{
if (!m_image)
throw std::runtime_error("frame is either invalid or has already been presented");
m_image->Present();
m_image = nullptr;
}
void RenderFrame::SubmitCommandBuffer(CommandBuffer* commandBuffer, QueueTypeFlags queueTypeFlags)
{
if (!m_image)
throw std::runtime_error("frame is either invalid or has already been presented");
m_image->SubmitCommandBuffer(commandBuffer, queueTypeFlags);
}
}

View File

@@ -2,15 +2,15 @@
// This file is part of the "Nazara Engine - Renderer module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/RenderImage.hpp>
#include <Nazara/Renderer/TransientResources.hpp>
#include <Nazara/Renderer/Debug.hpp>
namespace Nz
{
RenderImage::~RenderImage()
TransientResources::~TransientResources()
{
FlushReleaseQueue();
}
RenderImage::Releasable::~Releasable() = default;
TransientResources::Releasable::~Releasable() = default;
}