2525
2626namespace inexor ::vulkan_renderer {
2727
28- class FrameGraph ;
28+ class RenderGraph ;
2929
30- // / @brief Base class of all frame graph objects (resources and stages)
30+ // / @brief Base class of all render graph objects (resources and stages)
3131// / @note This is just for internal use
32- struct FrameGraphObject {
33- FrameGraphObject () = default ;
34- FrameGraphObject (const FrameGraphObject &) = delete ;
35- FrameGraphObject (FrameGraphObject &&) = delete ;
36- virtual ~FrameGraphObject () = default ;
32+ struct RenderGraphObject {
33+ RenderGraphObject () = default ;
34+ RenderGraphObject (const RenderGraphObject &) = delete ;
35+ RenderGraphObject (RenderGraphObject &&) = delete ;
36+ virtual ~RenderGraphObject () = default ;
3737
38- FrameGraphObject &operator =(const FrameGraphObject &) = delete ;
39- FrameGraphObject &operator =(FrameGraphObject &&) = delete ;
38+ RenderGraphObject &operator =(const RenderGraphObject &) = delete ;
39+ RenderGraphObject &operator =(RenderGraphObject &&) = delete ;
4040
4141 // / @brief Casts this object to type `T`
4242 // / @return The object as type `T` or `nullptr` if the cast failed
@@ -48,10 +48,10 @@ struct FrameGraphObject {
4848 const T *as () const ;
4949};
5050
51- // / @brief A single resource in the frame graph
52- // / @note May become multiple physical (vulkan) resources during frame graph compilation
53- class RenderResource : public FrameGraphObject {
54- friend FrameGraph ;
51+ // / @brief A single resource in the render graph
52+ // / @note May become multiple physical (vulkan) resources during render graph compilation
53+ class RenderResource : public RenderGraphObject {
54+ friend RenderGraph ;
5555
5656private:
5757 const std::string m_name;
@@ -70,7 +70,7 @@ class RenderResource : public FrameGraphObject {
7070
7171enum class BufferUsage {
7272 // / @brief Invalid buffer usage
73- // / @note Leaving a buffer as this usage will cause frame graph compilation to fail!
73+ // / @note Leaving a buffer as this usage will cause render graph compilation to fail!
7474 INVALID,
7575
7676 // / @brief Specifies that the buffer will be used to input index data
@@ -81,13 +81,13 @@ enum class BufferUsage {
8181};
8282
8383class BufferResource : public RenderResource {
84- friend FrameGraph ;
84+ friend RenderGraph ;
8585
8686private:
8787 BufferUsage m_usage{BufferUsage::INVALID};
8888 std::vector<VkVertexInputAttributeDescription> m_vertex_attributes;
8989
90- // Data to upload during frame graph compilation.
90+ // Data to upload during render graph compilation.
9191 const void *m_data{nullptr };
9292 std::size_t m_data_size{0 };
9393 std::size_t m_element_size{0 };
@@ -106,7 +106,7 @@ class BufferResource : public RenderResource {
106106 // / @note Calling this function is only valid on buffers of type BufferUsage::VERTEX_BUFFER!
107107 void add_vertex_attribute (VkFormat format, std::uint32_t offset);
108108
109- // / @brief Specifies that data should be uploaded to this buffer during frame graph compilation
109+ // / @brief Specifies that data should be uploaded to this buffer during render graph compilation
110110 // / @param count The number of elements (not bytes) to upload from CPU memory to GPU memory
111111 // / @param data A pointer to a contiguous block of memory that is at least `count * sizeof(T)` bytes long
112112 // TODO: Use std::span when we switch to C++ 20.
@@ -122,10 +122,10 @@ class BufferResource : public RenderResource {
122122
123123enum class TextureUsage {
124124 // / @brief Invalid texture usage
125- // / @note Leaving a texture as this usage will cause frame graph compilation to fail!
125+ // / @note Leaving a texture as this usage will cause render graph compilation to fail!
126126 INVALID,
127127
128- // / @brief Specifies that this texture is the result of the frame graph
128+ // / @brief Specifies that this texture is the result of the render graph
129129 // TODO: Refactor back buffer system more (remove need for BACK_BUFFER texture usage)
130130 BACK_BUFFER,
131131
@@ -138,7 +138,7 @@ enum class TextureUsage {
138138};
139139
140140class TextureResource : public RenderResource {
141- friend FrameGraph ;
141+ friend RenderGraph ;
142142
143143private:
144144 VkFormat m_format{VK_FORMAT_UNDEFINED};
@@ -161,10 +161,10 @@ class TextureResource : public RenderResource {
161161 }
162162};
163163
164- // / @brief A single render stage in the frame graph
164+ // / @brief A single render stage in the render graph
165165// / @note Not to be confused with a vulkan render pass!
166- class RenderStage : public FrameGraphObject {
167- friend FrameGraph ;
166+ class RenderStage : public RenderGraphObject {
167+ friend RenderGraph ;
168168
169169private:
170170 const std::string m_name;
@@ -193,7 +193,7 @@ class RenderStage : public FrameGraphObject {
193193
194194 // / @brief Binds a descriptor set layout to this render stage
195195 // / @note This function will soon be removed
196- // TODO: Refactor descriptor management in the frame graph
196+ // TODO: Refactor descriptor management in the render graph
197197 void add_descriptor_layout (VkDescriptorSetLayout layout) {
198198 m_descriptor_layouts.push_back (layout);
199199 }
@@ -207,7 +207,7 @@ class RenderStage : public FrameGraphObject {
207207};
208208
209209class GraphicsStage : public RenderStage {
210- friend FrameGraph ;
210+ friend RenderGraph ;
211211
212212private:
213213 bool m_clears_screen{false };
@@ -237,8 +237,8 @@ class GraphicsStage : public RenderStage {
237237};
238238
239239// TODO: Add wrapper::Allocation that can be made by doing `device->make<Allocation>(...)`.
240- class PhysicalResource : public FrameGraphObject {
241- friend FrameGraph ;
240+ class PhysicalResource : public RenderGraphObject {
241+ friend RenderGraph ;
242242
243243protected:
244244 // TODO: Add OOP device functions (see above todo) and only store a wrapper::Device here.
@@ -258,7 +258,7 @@ class PhysicalResource : public FrameGraphObject {
258258};
259259
260260class PhysicalBuffer : public PhysicalResource {
261- friend FrameGraph ;
261+ friend RenderGraph ;
262262
263263private:
264264 VkBuffer m_buffer{VK_NULL_HANDLE};
@@ -274,7 +274,7 @@ class PhysicalBuffer : public PhysicalResource {
274274};
275275
276276class PhysicalImage : public PhysicalResource {
277- friend FrameGraph ;
277+ friend RenderGraph ;
278278
279279private:
280280 VkImage m_image{VK_NULL_HANDLE};
@@ -291,7 +291,7 @@ class PhysicalImage : public PhysicalResource {
291291};
292292
293293class PhysicalBackBuffer : public PhysicalResource {
294- friend FrameGraph ;
294+ friend RenderGraph ;
295295
296296private:
297297 const wrapper::Swapchain &m_swapchain;
@@ -307,8 +307,8 @@ class PhysicalBackBuffer : public PhysicalResource {
307307 PhysicalBackBuffer &operator =(PhysicalBackBuffer &&) = delete ;
308308};
309309
310- class PhysicalStage : public FrameGraphObject {
311- friend FrameGraph ;
310+ class PhysicalStage : public RenderGraphObject {
311+ friend RenderGraph ;
312312
313313private:
314314 std::vector<wrapper::CommandBuffer> m_command_buffers;
@@ -331,14 +331,14 @@ class PhysicalStage : public FrameGraphObject {
331331 PhysicalStage &operator =(PhysicalStage &&) = delete ;
332332
333333 // / @brief Retrieve the pipeline layout of this physical stage
334- // TODO: This can be removed once descriptors are properly implemented in the frame graph.
334+ // TODO: This can be removed once descriptors are properly implemented in the render graph.
335335 [[nodiscard]] VkPipelineLayout pipeline_layout () const {
336336 return m_pipeline_layout;
337337 }
338338};
339339
340340class PhysicalGraphicsStage : public PhysicalStage {
341- friend FrameGraph ;
341+ friend RenderGraph ;
342342
343343private:
344344 VkRenderPass m_render_pass{VK_NULL_HANDLE};
@@ -354,12 +354,12 @@ class PhysicalGraphicsStage : public PhysicalStage {
354354 PhysicalGraphicsStage &operator =(PhysicalGraphicsStage &&) = delete ;
355355};
356356
357- class FrameGraph {
357+ class RenderGraph {
358358private:
359359 const wrapper::Device &m_device;
360360 VkCommandPool m_command_pool{VK_NULL_HANDLE};
361361 const wrapper::Swapchain &m_swapchain;
362- std::shared_ptr<spdlog::logger> m_log{spdlog::default_logger ()->clone (" frame -graph" )};
362+ std::shared_ptr<spdlog::logger> m_log{spdlog::default_logger ()->clone (" render -graph" )};
363363
364364 // Vectors of render resources and stages. These own the memory. Note that unique_ptr must be used as Render* is
365365 // just an inheritable base class.
@@ -376,7 +376,7 @@ class FrameGraph {
376376 // Stage to physical stage map.
377377 std::unordered_map<const RenderStage *, std::unique_ptr<PhysicalStage>> m_stage_map;
378378
379- // Helper function used to create a physical resource during frame graph compilation.
379+ // Helper function used to create a physical resource during render graph compilation.
380380 // TODO: Use concepts when we switch to C++ 20.
381381 template <typename T, typename ... Args, std::enable_if_t <std::is_base_of_v<PhysicalResource, T>, int > = 0 >
382382 T *create (const RenderResource *resource, Args &&... args) {
@@ -386,7 +386,7 @@ class FrameGraph {
386386 return ret;
387387 }
388388
389- // Helper function used to create a physical stage during frame graph compilation.
389+ // Helper function used to create a physical stage during render graph compilation.
390390 // TODO: Use concepts when we switch to C++ 20.
391391 template <typename T, typename ... Args, std::enable_if_t <std::is_base_of_v<PhysicalStage, T>, int > = 0 >
392392 T *create (const RenderStage *stage, Args &&... args) {
@@ -411,10 +411,10 @@ class FrameGraph {
411411 void build_graphics_pipeline (const GraphicsStage *, PhysicalGraphicsStage *) const ;
412412
413413public:
414- FrameGraph (const wrapper::Device &device, VkCommandPool command_pool, const wrapper::Swapchain &swapchain)
414+ RenderGraph (const wrapper::Device &device, VkCommandPool command_pool, const wrapper::Swapchain &swapchain)
415415 : m_device(device), m_command_pool(command_pool), m_swapchain(swapchain) {}
416416
417- // / @brief Adds either a render resource or render stage to the frame graph
417+ // / @brief Adds either a render resource or render stage to the render graph
418418 // / @return A mutable reference to the just-added resource or stage
419419 template <typename T, typename ... Args>
420420 T &add (Args &&... args) {
@@ -430,7 +430,7 @@ class FrameGraph {
430430 return ret;
431431 }
432432
433- // / @brief Compiles the frame graph resources/stages into physical vulkan objects
433+ // / @brief Compiles the render graph resources/stages into physical vulkan objects
434434 // / @param target The resource to start the depth first search from
435435 void compile (const RenderResource &target);
436436
@@ -441,12 +441,12 @@ class FrameGraph {
441441};
442442
443443template <typename T>
444- T *FrameGraphObject ::as () {
444+ T *RenderGraphObject ::as () {
445445 return dynamic_cast <T *>(this );
446446}
447447
448448template <typename T>
449- const T *FrameGraphObject ::as () const {
449+ const T *RenderGraphObject ::as () const {
450450 return dynamic_cast <const T *>(this );
451451}
452452
0 commit comments