// 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 #pragma once #ifndef NAZARA_RENDERER_RENDERPASS_HPP #define NAZARA_RENDERER_RENDERPASS_HPP #include #include #include #include #include #include #include namespace Nz { class NAZARA_RENDERER_API RenderPass { public: struct Attachment; struct SubpassDependency; struct SubpassDescription; inline RenderPass(std::vector attachments, std::vector subpassDescriptions, std::vector subpassDependencies); RenderPass(const RenderPass&) = delete; RenderPass(RenderPass&&) noexcept = default; virtual ~RenderPass(); inline const Attachment& GetAttachment(std::size_t attachmentIndex) const; inline std::size_t GetAttachmentCount() const; inline const std::vector& GetAttachments() const; inline const std::vector& GetSubpassDescriptions() const; inline const std::vector& GetSubpassDependencies() const; virtual void UpdateDebugName(std::string_view name) = 0; RenderPass& operator=(const RenderPass&) = delete; RenderPass& operator=(RenderPass&&) noexcept = default; struct Attachment { PixelFormat format; AttachmentLoadOp loadOp = AttachmentLoadOp::Load; AttachmentLoadOp stencilLoadOp = AttachmentLoadOp::Load; AttachmentStoreOp storeOp = AttachmentStoreOp::Store; AttachmentStoreOp stencilStoreOp = AttachmentStoreOp::Store; TextureLayout initialLayout = TextureLayout::Undefined; TextureLayout finalLayout = TextureLayout::Present; }; struct AttachmentReference { std::size_t attachmentIndex; TextureLayout attachmentLayout = TextureLayout::ColorInput; }; struct SubpassDependency { std::size_t fromSubpassIndex; PipelineStageFlags fromStages; MemoryAccessFlags fromAccessFlags; std::size_t toSubpassIndex; PipelineStageFlags toStages; MemoryAccessFlags toAccessFlags; bool tilable = false; }; struct SubpassDescription { std::vector colorAttachment; std::vector inputAttachments; std::vector preserveAttachments; std::optional depthStencilAttachment; }; static constexpr std::size_t ExternalSubpassIndex = std::numeric_limits::max(); protected: std::vector m_attachments; std::vector m_subpassDependencies; std::vector m_subpassDescriptions; }; } #include #endif // NAZARA_RENDERER_RENDERPASS_HPP