Class RenderGraph

Class Documentation

class inexor::vulkan_renderer::RenderGraph

Public Functions

inline RenderGraph(const wrapper::Device &device, VkCommandPool command_pool, const wrapper::Swapchain &swapchain)
template<typename T, typename ...Args>
inline T *add(Args&&... args)

Adds either a render resource or render stage to the render graph.


A mutable reference to the just-added resource or stage

void compile(const RenderResource *target)

Compiles the render graph resources/stages into physical vulkan objects.


target – The target resource of the render graph (usually the back buffer)

VkSemaphore render(std::uint32_t image_index, VkSemaphore wait_semaphore, VkQueue graphics_queue, VkFence signal_fence)

Submits the command frame’s command buffers for drawing.

  • image_index – The current image index, retrieved from Swapchain::acquire_next_image

  • wait_semaphore

    The semaphore to wait on before rendering, typically some kind of “swapchain image

    available” semaphore

  • graphics_queue – The graphics queue to push rendering commands to

  • signal_fence – The fence to signal on completion of the whole frame

Private Functions

void build_buffer(const BufferResource&, PhysicalBuffer&) const
void build_image(const TextureResource&, PhysicalImage&, VmaAllocationCreateInfo*) const
void build_image_view(const TextureResource&, PhysicalImage&) const
void build_pipeline_layout(const RenderStage*, PhysicalStage&) const
void record_command_buffer(const RenderStage*, PhysicalStage&, std::uint32_t image_index) const
void build_render_pass(const GraphicsStage*, PhysicalGraphicsStage&) const
void build_graphics_pipeline(const GraphicsStage*, PhysicalGraphicsStage&) const

Private Members

const wrapper::Device &m_device
VkCommandPool m_command_pool = {VK_NULL_HANDLE}
const wrapper::Swapchain &m_swapchain
std::shared_ptr<spdlog::logger> m_log = {spdlog::default_logger()->clone("render-graph")}
std::vector<std::unique_ptr<BufferResource>> m_buffer_resources
std::vector<std::unique_ptr<TextureResource>> m_texture_resources
std::vector<std::unique_ptr<RenderStage>> m_stages
std::vector<RenderStage*> m_stage_stack