// Copyright (C) 2017 Jérôme Leclercq // 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_BAKEDFRAMEGRAPH_HPP #define NAZARA_BAKEDFRAMEGRAPH_HPP #include #include #include #include #include #include #include #include #include namespace Nz { class RenderFrame; class NAZARA_GRAPHICS_API BakedFrameGraph { friend class FrameGraph; public: BakedFrameGraph() = default; BakedFrameGraph(const BakedFrameGraph&) = delete; BakedFrameGraph(BakedFrameGraph&&) noexcept = default; ~BakedFrameGraph() = default; void Execute(RenderFrame& renderFrame); const std::shared_ptr& GetAttachmentTexture(std::size_t attachmentIndex) const; const std::shared_ptr& GetRenderPass(std::size_t passIndex) const; bool Resize(unsigned int width, unsigned int height); BakedFrameGraph& operator=(const BakedFrameGraph&) = delete; BakedFrameGraph& operator=(BakedFrameGraph&&) noexcept = default; private: struct PassData; struct TextureData; using AttachmentIdToTextureId = std::unordered_map; using PassIdToPhysicalPassIndex = std::unordered_map; BakedFrameGraph(std::vector passes, std::vector textures, AttachmentIdToTextureId attachmentIdToTextureMapping, PassIdToPhysicalPassIndex passIdToPhysicalPassMapping); struct TextureTransition { std::size_t textureId; MemoryAccessFlags dstAccessMask; MemoryAccessFlags srcAccessMask; PipelineStageFlags dstStageMask; PipelineStageFlags srcStageMask; TextureLayout newLayout; TextureLayout oldLayout; }; struct SubpassData { FramePass::CommandCallback commandCallback; }; struct PassData { CommandBufferPtr commandBuffer; std::shared_ptr framebuffer; std::shared_ptr renderPass; std::string name; std::vector outputTextureIndices; std::vector subpasses; std::vector transitions; FramePass::ExecutionCallback executionCallback; Recti renderRect; bool forceCommandBufferRegeneration = true; }; struct TextureData { std::shared_ptr texture; PixelFormat format; TextureUsageFlags usage; unsigned int width; unsigned int height; }; std::shared_ptr m_commandPool; std::vector m_passes; std::vector m_textures; AttachmentIdToTextureId m_attachmentToTextureMapping; PassIdToPhysicalPassIndex m_passIdToPhysicalPassMapping; unsigned int m_height; unsigned int m_width; }; } #include #endif