Graphics: Rework RenderTargets

- RenderTarget have been moved to the Graphics module and are now lightweight objects between the target of rendering (swapchain or texture)
- RenderTexture no longer require a blit between the framegraph texture and the target texture (the target texture is now directly rendered onto using a new feature of the framegraph)
- ForwardFramePipeline viewers are now properly ordered by render order
This commit is contained in:
SirLynix
2023-11-20 23:00:06 +01:00
parent d06f9bda89
commit 938ba09d45
41 changed files with 445 additions and 254 deletions

View File

@@ -9,28 +9,26 @@
#include <NazaraUtils/Prerequisites.hpp>
#include <Nazara/Platform/WindowEventHandler.hpp>
#include <Nazara/Renderer/RenderTarget.hpp>
#include <Nazara/Renderer/Swapchain.hpp>
#include <Nazara/Renderer/SwapchainParameters.hpp>
#include <memory>
namespace Nz
{
class Framebuffer;
class RenderDevice;
class Window;
class NAZARA_RENDERER_API WindowSwapchain : public RenderTarget
class NAZARA_RENDERER_API WindowSwapchain
{
public:
WindowSwapchain(std::shared_ptr<RenderDevice> renderDevice, Window& window, SwapchainParameters parameters = SwapchainParameters());
WindowSwapchain(const WindowSwapchain&) = delete;
WindowSwapchain(WindowSwapchain&&) = delete;
inline ~WindowSwapchain();
~WindowSwapchain() = default;
inline RenderFrame AcquireFrame();
inline void BlitTexture(RenderFrame& renderFrame, CommandBufferBuilder& builder, const Texture& texture) const override;
inline bool DoesRenderOnlyIfFocused() const;
inline void EnableRenderOnlyIfFocused(bool enable = true);
@@ -38,15 +36,18 @@ namespace Nz
inline const Framebuffer& GetFramebuffer(std::size_t i) const;
inline std::size_t GetFramebufferCount() const;
inline const RenderPass& GetRenderPass() const;
const Vector2ui& GetSize() const override;
inline Swapchain& GetSwapchain();
inline const Swapchain& GetSwapchain() const;
const Vector2ui& GetSize() const;
inline Swapchain* GetSwapchain();
inline const Swapchain* GetSwapchain() const;
inline TransientResources& Transient();
WindowSwapchain& operator=(const WindowSwapchain&) = delete;
WindowSwapchain& operator=(WindowSwapchain&& windowSwapchain) = delete;
NazaraSignal(OnSwapchainCreated, WindowSwapchain* /*swapchain*/, Swapchain& /*swapchain*/);
NazaraSignal(OnSwapchainDestroy, WindowSwapchain* /*swapchain*/);
private:
void ConnectSignals();
inline void DisconnectSignals();