wren
Vulkan-based game engine
Loading...
Searching...
No Matches
wren::Renderer Class Reference

#include <renderer.hpp>

Collaboration diagram for wren::Renderer:

Public Member Functions

void draw ()
 
auto set_graph_builder (const GraphBuilder &builder)
 
auto get_graph () const
 
auto swapchain_images_views () const
 
auto render_targets () const
 Get the swapchain's targets.
 
auto add_target (const std::string &name, const std::shared_ptr< RenderTarget > &target)
 
auto submit_command_buffer (const std::function< void(::vk::CommandBuffer &)> &cmd_buf) -> expected< void >
 

Static Public Member Functions

static auto create (const std::shared_ptr< Context > &ctx) -> expected< std::shared_ptr< Renderer > >
 

Private Member Functions

 Renderer (const std::shared_ptr< Context > &ctx)
 
auto begin_frame () -> expected< uint32_t >
 
void end_frame (uint32_t image_index)
 
auto recreate_swapchain () -> expected< void >
 
auto choose_swapchain_format (const std::vector<::vk::SurfaceFormatKHR > &formats) -> ::vk::SurfaceFormatKHR
 
auto choose_swapchain_presentation_mode (const std::vector<::vk::PresentModeKHR > &formats) -> ::vk::PresentModeKHR
 
auto choose_swapchain_extent (const ::vk::SurfaceCapabilitiesKHR &surface_capabilities) -> ::vk::Extent2D
 

Private Attributes

std::unordered_map< std::string, std::shared_ptr< Pipeline > > pipelines_
 
std::shared_ptr< Contextctx_
 
::vk::SwapchainKHR swapchain_
 
std::vector<::vk::Image > swapchain_images_
 
std::vector<::vk::ImageView > swapchain_image_views_
 
std::unordered_map< std::string, std::shared_ptr< RenderTarget > > render_targets_
 
::vk::Format swapchain_image_format_ = ::vk::Format::eB8G8R8Srgb
 
::vk::Extent2D swapchain_extent_
 
::vk::Semaphore image_available
 
::vk::Semaphore render_finished
 
::vk::Fence in_flight_fence
 
::vk::CommandPool command_pool_
 
::vk::CommandBuffer one_time_cmd_buffer
 
Graph render_graph
 
Mesh m
 

Static Private Attributes

static constexpr std::string_view kSwapchainRendertargetName
 

Constructor & Destructor Documentation

◆ Renderer()

wren::Renderer::Renderer ( const std::shared_ptr< Context > & ctx)
explicitprivate
Here is the call graph for this function:

Member Function Documentation

◆ add_target()

auto wren::Renderer::add_target ( const std::string & name,
const std::shared_ptr< RenderTarget > & target )
inline

◆ begin_frame()

auto wren::Renderer::begin_frame ( ) -> expected<uint32_t>
private
Here is the caller graph for this function:

◆ choose_swapchain_extent()

auto wren::Renderer::choose_swapchain_extent ( const ::vk::SurfaceCapabilitiesKHR & surface_capabilities) -> ::vk::Extent2D
private

◆ choose_swapchain_format()

auto wren::Renderer::choose_swapchain_format ( const std::vector<::vk::SurfaceFormatKHR > & formats) -> ::vk::SurfaceFormatKHR
private

◆ choose_swapchain_presentation_mode()

auto wren::Renderer::choose_swapchain_presentation_mode ( const std::vector<::vk::PresentModeKHR > & formats) -> ::vk::PresentModeKHR
private

◆ create()

auto wren::Renderer::create ( const std::shared_ptr< Context > & ctx) -> expected<std::shared_ptr<Renderer>>
static
Here is the caller graph for this function:

◆ draw()

void wren::Renderer::draw ( )
Here is the call graph for this function:

◆ end_frame()

void wren::Renderer::end_frame ( uint32_t image_index)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_graph()

auto wren::Renderer::get_graph ( ) const
inline

◆ recreate_swapchain()

auto wren::Renderer::recreate_swapchain ( ) -> expected<void>
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ render_targets()

auto wren::Renderer::render_targets ( ) const
inline

Get the swapchain's targets.

Returns
The Swapchain's render_targets

◆ set_graph_builder()

auto wren::Renderer::set_graph_builder ( const GraphBuilder & builder)
inline
Here is the call graph for this function:

◆ submit_command_buffer()

auto wren::Renderer::submit_command_buffer ( const std::function< void(::vk::CommandBuffer &)> & cmd_buf) -> expected<void>

◆ swapchain_images_views()

auto wren::Renderer::swapchain_images_views ( ) const
inline

Member Data Documentation

◆ command_pool_

::vk::CommandPool wren::Renderer::command_pool_
private

◆ ctx_

std::shared_ptr<Context> wren::Renderer::ctx_
private

◆ image_available

::vk::Semaphore wren::Renderer::image_available
private

◆ in_flight_fence

::vk::Fence wren::Renderer::in_flight_fence
private

◆ kSwapchainRendertargetName

constexpr std::string_view wren::Renderer::kSwapchainRendertargetName
staticconstexprprivate
Initial value:
=
"swapchain_target"

◆ m

Mesh wren::Renderer::m
private

◆ one_time_cmd_buffer

::vk::CommandBuffer wren::Renderer::one_time_cmd_buffer
private

◆ pipelines_

std::unordered_map<std::string, std::shared_ptr<Pipeline> > wren::Renderer::pipelines_
private

◆ render_finished

::vk::Semaphore wren::Renderer::render_finished
private

◆ render_graph

Graph wren::Renderer::render_graph
private

◆ render_targets_

std::unordered_map<std::string, std::shared_ptr<RenderTarget> > wren::Renderer::render_targets_
private

◆ swapchain_

::vk::SwapchainKHR wren::Renderer::swapchain_
private

◆ swapchain_extent_

::vk::Extent2D wren::Renderer::swapchain_extent_
private

◆ swapchain_image_format_

::vk::Format wren::Renderer::swapchain_image_format_ = ::vk::Format::eB8G8R8Srgb
private

◆ swapchain_image_views_

std::vector<::vk::ImageView> wren::Renderer::swapchain_image_views_
private

◆ swapchain_images_

std::vector<::vk::Image> wren::Renderer::swapchain_images_
private

The documentation for this class was generated from the following files: