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

@@ -0,0 +1,50 @@
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_GRAPHICS_RENDERWINDOW_HPP
#define NAZARA_GRAPHICS_RENDERWINDOW_HPP
#include <NazaraUtils/Prerequisites.hpp>
#include <Nazara/Graphics/Config.hpp>
#include <Nazara/Graphics/RenderTarget.hpp>
#include <Nazara/Renderer/WindowSwapchain.hpp>
namespace Nz
{
class FrameGraph;
class NAZARA_GRAPHICS_API RenderWindow : public RenderTarget
{
public:
inline RenderWindow(Swapchain& swapchain);
RenderWindow(WindowSwapchain& windowSwapchain);
RenderWindow(const RenderWindow&) = delete;
RenderWindow(RenderWindow&&) = delete;
~RenderWindow() = default;
void OnBuildGraph(FrameGraph& graph, std::size_t attachmentIndex) const override;
void OnRenderEnd(RenderFrame& renderFrame, const BakedFrameGraph& frameGraph, std::size_t attachmentId) const override;
const Vector2ui& GetSize() const override;
RenderWindow& operator=(const RenderWindow&) = delete;
RenderWindow& operator=(RenderWindow&&) = delete;
private:
void SetSwapchain(Swapchain* swapchain);
NazaraSlot(Swapchain, OnSwapchainResize, m_onSwapchainResize);
NazaraSlot(WindowSwapchain, OnSwapchainCreated, m_onSwapchainCreated);
NazaraSlot(WindowSwapchain, OnSwapchainDestroy, m_onSwapchainDestroy);
Swapchain* m_swapchain;
WindowSwapchain* m_windowSwapchain;
};
}
#include <Nazara/Graphics/RenderWindow.inl>
#endif // NAZARA_GRAPHICS_RENDERWINDOW_HPP