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:
@@ -80,6 +80,9 @@
|
||||
#include <Nazara/Graphics/RenderQueueRegistry.hpp>
|
||||
#include <Nazara/Graphics/RenderSpriteChain.hpp>
|
||||
#include <Nazara/Graphics/RenderSubmesh.hpp>
|
||||
#include <Nazara/Graphics/RenderTarget.hpp>
|
||||
#include <Nazara/Graphics/RenderTexture.hpp>
|
||||
#include <Nazara/Graphics/RenderWindow.hpp>
|
||||
#include <Nazara/Graphics/ShaderReflection.hpp>
|
||||
#include <Nazara/Graphics/ShadowViewer.hpp>
|
||||
#include <Nazara/Graphics/SkeletonInstance.hpp>
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Graphics/Enums.hpp>
|
||||
#include <Nazara/Graphics/PipelineViewer.hpp>
|
||||
#include <Nazara/Graphics/RenderTarget.hpp>
|
||||
#include <Nazara/Graphics/ViewerInstance.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
#include <Nazara/Renderer/RenderTarget.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -22,8 +22,8 @@ namespace Nz
|
||||
class NAZARA_GRAPHICS_API Camera : public PipelineViewer
|
||||
{
|
||||
public:
|
||||
inline Camera(const RenderTarget* renderTarget, std::shared_ptr<PipelinePassList> pipelinePasses, ProjectionType projectionType = ProjectionType::Perspective);
|
||||
Camera(const RenderTarget* renderTarget, ProjectionType projectionType = ProjectionType::Perspective);
|
||||
inline Camera(std::shared_ptr<const RenderTarget> renderTarget, std::shared_ptr<PipelinePassList> pipelinePasses, ProjectionType projectionType = ProjectionType::Perspective);
|
||||
Camera(std::shared_ptr<const RenderTarget> renderTarget, ProjectionType projectionType = ProjectionType::Perspective);
|
||||
inline Camera(const Camera& camera);
|
||||
inline Camera(Camera&& camera) noexcept;
|
||||
~Camera() = default;
|
||||
@@ -53,7 +53,7 @@ namespace Nz
|
||||
inline void UpdateRenderMask(UInt32 renderMask);
|
||||
inline void UpdateRenderOrder(Int32 renderOrder);
|
||||
inline void UpdateSize(const Vector2f& size);
|
||||
void UpdateTarget(const RenderTarget* framebuffer);
|
||||
void UpdateTarget(std::shared_ptr<const RenderTarget> renderTarget);
|
||||
inline void UpdateTargetRegion(const Rectf& targetRegion);
|
||||
inline void UpdateViewport(const Recti& viewport);
|
||||
inline void UpdateZFar(float zFar);
|
||||
@@ -71,7 +71,7 @@ namespace Nz
|
||||
NazaraSlot(RenderTarget, OnRenderTargetSizeChange, m_onRenderTargetSizeChange);
|
||||
|
||||
std::shared_ptr<PipelinePassList> m_framePipelinePasses;
|
||||
const RenderTarget* m_renderTarget;
|
||||
std::shared_ptr<const RenderTarget> m_renderTarget;
|
||||
Color m_clearColor;
|
||||
DegreeAnglef m_fov;
|
||||
Int32 m_renderOrder;
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline Camera::Camera(const RenderTarget* renderTarget, std::shared_ptr<PipelinePassList> pipelinePasses, ProjectionType projectionType) :
|
||||
inline Camera::Camera(std::shared_ptr<const RenderTarget> renderTarget, std::shared_ptr<PipelinePassList> pipelinePasses, ProjectionType projectionType) :
|
||||
m_framePipelinePasses(std::move(pipelinePasses)),
|
||||
m_renderTarget(nullptr),
|
||||
m_clearColor(Color::Black()),
|
||||
m_fov(90.f),
|
||||
m_renderOrder(0),
|
||||
@@ -21,12 +20,11 @@ namespace Nz
|
||||
m_zFar((projectionType == ProjectionType::Perspective) ? 1000.f : 1.f),
|
||||
m_zNear((projectionType == ProjectionType::Perspective) ? 1.f : -1.f)
|
||||
{
|
||||
UpdateTarget(renderTarget);
|
||||
UpdateTarget(std::move(renderTarget));
|
||||
}
|
||||
|
||||
inline Camera::Camera(const Camera& camera) :
|
||||
m_framePipelinePasses(camera.m_framePipelinePasses),
|
||||
m_renderTarget(nullptr),
|
||||
m_clearColor(camera.m_clearColor),
|
||||
m_fov(camera.m_fov),
|
||||
m_renderOrder(camera.m_renderOrder),
|
||||
@@ -44,7 +42,6 @@ namespace Nz
|
||||
|
||||
inline Camera::Camera(Camera&& camera) noexcept :
|
||||
m_framePipelinePasses(std::move(camera.m_framePipelinePasses)),
|
||||
m_renderTarget(nullptr),
|
||||
m_clearColor(camera.m_clearColor),
|
||||
m_fov(camera.m_fov),
|
||||
m_renderOrder(camera.m_renderOrder),
|
||||
@@ -57,7 +54,7 @@ namespace Nz
|
||||
m_zFar(camera.m_zFar),
|
||||
m_zNear(camera.m_zNear)
|
||||
{
|
||||
UpdateTarget(camera.m_renderTarget);
|
||||
UpdateTarget(std::move(camera.m_renderTarget));
|
||||
}
|
||||
|
||||
inline float Camera::GetAspectRatio() const
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Nz
|
||||
ForwardFramePipeline& operator=(ForwardFramePipeline&&) = delete;
|
||||
|
||||
private:
|
||||
BakedFrameGraph BuildFrameGraph(RenderFrame& renderFrame);
|
||||
BakedFrameGraph BuildFrameGraph();
|
||||
|
||||
void RegisterMaterialInstance(MaterialInstance* materialPass);
|
||||
void UnregisterMaterialInstance(MaterialInstance* material);
|
||||
|
||||
@@ -39,10 +39,11 @@ namespace Nz
|
||||
inline std::size_t AddAttachmentCubeFace(std::size_t attachmentId, CubemapFace face);
|
||||
inline std::size_t AddAttachmentProxy(std::string name, std::size_t attachmentId);
|
||||
inline FramePass& AddPass(std::string name);
|
||||
inline void AddBackbufferOutput(std::size_t attachmentIndex);
|
||||
|
||||
BakedFrameGraph Bake();
|
||||
|
||||
inline void MarkAsFinalOutput(std::size_t attachmentIndex);
|
||||
inline void BindAttachmentToExternalTexture(std::size_t attachmentIndex, std::shared_ptr<Texture> texture);
|
||||
|
||||
FrameGraph& operator=(const FrameGraph&) = delete;
|
||||
FrameGraph& operator=(FrameGraph&&) noexcept = default;
|
||||
@@ -139,9 +140,10 @@ namespace Nz
|
||||
|
||||
using AttachmentType = std::variant<FramePassAttachment, AttachmentProxy, AttachmentArray, AttachmentCube, AttachmentLayer>;
|
||||
|
||||
std::vector<std::size_t> m_finalOutputs;
|
||||
std::vector<std::size_t> m_backbufferOutputs;
|
||||
std::vector<FramePass> m_framePasses;
|
||||
std::vector<AttachmentType> m_attachments;
|
||||
std::unordered_map<std::size_t, std::shared_ptr<Texture>> m_externalTextures;
|
||||
WorkData m_pending;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -84,9 +84,14 @@ namespace Nz
|
||||
return m_framePasses.emplace_back(*this, id, std::move(name));
|
||||
}
|
||||
|
||||
inline void FrameGraph::MarkAsFinalOutput(std::size_t attachmentIndex)
|
||||
inline void FrameGraph::AddBackbufferOutput(std::size_t attachmentIndex)
|
||||
{
|
||||
m_finalOutputs.push_back(attachmentIndex);
|
||||
m_backbufferOutputs.push_back(attachmentIndex);
|
||||
}
|
||||
|
||||
inline void FrameGraph::BindAttachmentToExternalTexture(std::size_t attachmentIndex, std::shared_ptr<Texture> texture)
|
||||
{
|
||||
m_externalTextures[attachmentIndex] = std::move(texture);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class Texture;
|
||||
|
||||
struct FrameGraphTextureData
|
||||
{
|
||||
struct ViewData
|
||||
@@ -25,6 +27,7 @@ namespace Nz
|
||||
};
|
||||
|
||||
std::optional<ViewData> viewData;
|
||||
std::shared_ptr<Texture> externalTexture;
|
||||
std::string name;
|
||||
ImageType type;
|
||||
PixelFormat format;
|
||||
|
||||
@@ -97,8 +97,8 @@ namespace Nz
|
||||
|
||||
struct Output
|
||||
{
|
||||
std::size_t attachmentId;
|
||||
std::optional<Color> clearColor;
|
||||
std::size_t attachmentId;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,32 +1,35 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// 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_RENDERER_RENDERTARGET_HPP
|
||||
#define NAZARA_RENDERER_RENDERTARGET_HPP
|
||||
#ifndef NAZARA_GRAPHICS_RENDERTARGET_HPP
|
||||
#define NAZARA_GRAPHICS_RENDERTARGET_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Graphics/Config.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
#include <Nazara/Renderer/Config.hpp>
|
||||
#include <NazaraUtils/Signal.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class BakedFrameGraph;
|
||||
class CommandBufferBuilder;
|
||||
class Framebuffer;
|
||||
class FrameGraph;
|
||||
class RenderFrame;
|
||||
class RenderPass;
|
||||
class Texture;
|
||||
|
||||
class NAZARA_RENDERER_API RenderTarget
|
||||
class NAZARA_GRAPHICS_API RenderTarget
|
||||
{
|
||||
public:
|
||||
RenderTarget() = default;
|
||||
virtual ~RenderTarget();
|
||||
|
||||
virtual void BlitTexture(RenderFrame& renderFrame, CommandBufferBuilder& builder, const Texture& texture) const = 0;
|
||||
virtual void OnBuildGraph(FrameGraph& frameGraph, std::size_t attachmentIndex) const = 0;
|
||||
virtual void OnRenderEnd(RenderFrame& renderFrame, const BakedFrameGraph& frameGraph, std::size_t finalAttachment) const = 0;
|
||||
|
||||
virtual const Vector2ui& GetSize() const = 0;
|
||||
|
||||
@@ -35,6 +38,6 @@ namespace Nz
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/RenderTarget.inl>
|
||||
#include <Nazara/Graphics/RenderTarget.inl>
|
||||
|
||||
#endif // NAZARA_RENDERER_RENDERTARGET_HPP
|
||||
#endif // NAZARA_GRAPHICS_RENDERTARGET_HPP
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// This file is part of the "Nazara Engine - Graphics module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Renderer/Debug.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/DebugOff.hpp>
|
||||
#include <Nazara/Graphics/DebugOff.hpp>
|
||||
@@ -1,22 +1,22 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// 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_RENDERER_RENDERTEXTURE_HPP
|
||||
#define NAZARA_RENDERER_RENDERTEXTURE_HPP
|
||||
#ifndef NAZARA_GRAPHICS_RENDERTEXTURE_HPP
|
||||
#define NAZARA_GRAPHICS_RENDERTEXTURE_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Renderer/Config.hpp>
|
||||
#include <Nazara/Graphics/Config.hpp>
|
||||
#include <Nazara/Graphics/RenderTarget.hpp>
|
||||
#include <Nazara/Renderer/Enums.hpp>
|
||||
#include <Nazara/Renderer/RenderTarget.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class Texture;
|
||||
|
||||
class NAZARA_RENDERER_API RenderTexture : public RenderTarget
|
||||
class NAZARA_GRAPHICS_API RenderTexture : public RenderTarget
|
||||
{
|
||||
public:
|
||||
inline RenderTexture(std::shared_ptr<Texture> targetTexture);
|
||||
@@ -25,7 +25,8 @@ namespace Nz
|
||||
RenderTexture(RenderTexture&&) = delete;
|
||||
~RenderTexture() = default;
|
||||
|
||||
void BlitTexture(RenderFrame& renderFrame, CommandBufferBuilder& builder, const Texture& texture) const override;
|
||||
void OnBuildGraph(FrameGraph& graph, std::size_t attachmentIndex) const override;
|
||||
void OnRenderEnd(RenderFrame& renderFrame, const BakedFrameGraph& frameGraph, std::size_t finalAttachment) const override;
|
||||
|
||||
const Vector2ui& GetSize() const override;
|
||||
|
||||
@@ -41,6 +42,6 @@ namespace Nz
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/RenderTexture.inl>
|
||||
#include <Nazara/Graphics/RenderTexture.inl>
|
||||
|
||||
#endif // NAZARA_RENDERER_RENDERTEXTURE_HPP
|
||||
#endif // NAZARA_GRAPHICS_RENDERTEXTURE_HPP
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// This file is part of the "Nazara Engine - Graphics module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Renderer/RenderTexture.hpp>
|
||||
#include <Nazara/Renderer/Debug.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -13,4 +12,4 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/DebugOff.hpp>
|
||||
#include <Nazara/Graphics/DebugOff.hpp>
|
||||
50
include/Nazara/Graphics/RenderWindow.hpp
Normal file
50
include/Nazara/Graphics/RenderWindow.hpp
Normal 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
|
||||
16
include/Nazara/Graphics/RenderWindow.inl
Normal file
16
include/Nazara/Graphics/RenderWindow.inl
Normal file
@@ -0,0 +1,16 @@
|
||||
// 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
|
||||
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline RenderWindow::RenderWindow(Swapchain& swapchain) :
|
||||
m_swapchain(&swapchain),
|
||||
m_windowSwapchain(nullptr)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Graphics/DebugOff.hpp>
|
||||
@@ -51,8 +51,6 @@
|
||||
#include <Nazara/Renderer/RenderPipeline.hpp>
|
||||
#include <Nazara/Renderer/RenderPipelineLayout.hpp>
|
||||
#include <Nazara/Renderer/RenderStates.hpp>
|
||||
#include <Nazara/Renderer/RenderTarget.hpp>
|
||||
#include <Nazara/Renderer/RenderTexture.hpp>
|
||||
#include <Nazara/Renderer/ShaderBinding.hpp>
|
||||
#include <Nazara/Renderer/ShaderModule.hpp>
|
||||
#include <Nazara/Renderer/Swapchain.hpp>
|
||||
|
||||
@@ -12,16 +12,17 @@
|
||||
#include <Nazara/Renderer/Config.hpp>
|
||||
#include <Nazara/Renderer/RenderFrame.hpp>
|
||||
#include <Nazara/Renderer/RenderPass.hpp>
|
||||
#include <Nazara/Renderer/RenderTarget.hpp>
|
||||
#include <NazaraUtils/Signal.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class CommandPool;
|
||||
class Framebuffer;
|
||||
class RenderDevice;
|
||||
class TransientResources;
|
||||
|
||||
class NAZARA_RENDERER_API Swapchain : public RenderTarget
|
||||
class NAZARA_RENDERER_API Swapchain
|
||||
{
|
||||
public:
|
||||
Swapchain() = default;
|
||||
@@ -29,14 +30,13 @@ namespace Nz
|
||||
|
||||
virtual RenderFrame AcquireFrame() = 0;
|
||||
|
||||
void BlitTexture(RenderFrame& renderFrame, CommandBufferBuilder& builder, const Texture& texture) const override;
|
||||
|
||||
virtual std::shared_ptr<CommandPool> CreateCommandPool(QueueType queueType) = 0;
|
||||
|
||||
virtual const Framebuffer& GetFramebuffer(std::size_t i) const = 0;
|
||||
virtual std::size_t GetFramebufferCount() const = 0;
|
||||
virtual PresentMode GetPresentMode() const = 0;
|
||||
virtual const RenderPass& GetRenderPass() const = 0;
|
||||
virtual const Vector2ui& GetSize() const = 0;
|
||||
virtual PresentModeFlags GetSupportedPresentModes() const = 0;
|
||||
|
||||
virtual void NotifyResize(const Vector2ui& newSize) = 0;
|
||||
@@ -45,6 +45,8 @@ namespace Nz
|
||||
|
||||
virtual TransientResources& Transient() = 0;
|
||||
|
||||
NazaraSignal(OnSwapchainResize, Swapchain* /*swapchain*/, const Vector2ui& /*newSize*/);
|
||||
|
||||
protected:
|
||||
static void BuildRenderPass(PixelFormat colorFormat, PixelFormat depthFormat, std::vector<RenderPass::Attachment>& attachments, std::vector<RenderPass::SubpassDescription>& subpassDescriptions, std::vector<RenderPass::SubpassDependency>& subpassDependencies);
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -7,11 +7,6 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline WindowSwapchain::~WindowSwapchain()
|
||||
{
|
||||
OnRenderTargetRelease(this);
|
||||
}
|
||||
|
||||
inline RenderFrame WindowSwapchain::AcquireFrame()
|
||||
{
|
||||
if (m_isMinimized || (!m_hasFocus && m_renderOnlyIfFocused))
|
||||
@@ -20,11 +15,6 @@ namespace Nz
|
||||
return m_swapchain->AcquireFrame();
|
||||
}
|
||||
|
||||
inline void WindowSwapchain::BlitTexture(RenderFrame& renderFrame, CommandBufferBuilder& builder, const Texture& texture) const
|
||||
{
|
||||
return m_swapchain->BlitTexture(renderFrame, builder, texture);
|
||||
}
|
||||
|
||||
inline bool WindowSwapchain::DoesRenderOnlyIfFocused() const
|
||||
{
|
||||
return m_renderOnlyIfFocused;
|
||||
@@ -53,14 +43,14 @@ namespace Nz
|
||||
return m_swapchain->GetRenderPass();
|
||||
}
|
||||
|
||||
inline Swapchain& WindowSwapchain::GetSwapchain()
|
||||
inline Swapchain* WindowSwapchain::GetSwapchain()
|
||||
{
|
||||
return *m_swapchain;
|
||||
return m_swapchain.get();
|
||||
}
|
||||
|
||||
inline const Swapchain& WindowSwapchain::GetSwapchain() const
|
||||
inline const Swapchain* WindowSwapchain::GetSwapchain() const
|
||||
{
|
||||
return *m_swapchain;
|
||||
return m_swapchain.get();
|
||||
}
|
||||
|
||||
inline TransientResources& WindowSwapchain::Transient()
|
||||
|
||||
Reference in New Issue
Block a user