1#ifndef LIBSBX_GRAPHICS_RENDERER_HPP_
2#define LIBSBX_GRAPHICS_RENDERER_HPP_
8#include <easy/profiler.h>
10#include <libsbx/utility/noncopyable.hpp>
11#include <libsbx/utility/concepts.hpp>
14#include <libsbx/graphics/commands/command_buffer.hpp>
16#include <libsbx/graphics/pipeline/pipeline.hpp>
18#include <libsbx/graphics/task.hpp>
19#include <libsbx/graphics/subrenderer.hpp>
20#include <libsbx/graphics/render_graph.hpp>
21#include <libsbx/graphics/draw_list.hpp>
22#include <libsbx/graphics/viewport.hpp>
24namespace sbx::graphics {
38 if (
auto entry = _subrenderers.find(pass_name); entry != _subrenderers.end()) {
39 for (auto& subrenderer : entry->second) {
40 subrenderer->render(command_buffer);
47 for (
const auto&
task : _tasks) {
52 auto resize(
const viewport::type flags) ->
void {
56 auto attachment(
const std::string& name)
const ->
const descriptor& {
57 return _graph.attachment(name);
62 template<
typename Type,
typename... Args>
63 requires (std::is_constructible_v<Type,
const render_graph::graphics_pass&, Args...>)
64 auto add_subrenderer(
const render_graph::graphics_pass& pass, Args&&... args) -> Type& {
65 auto& subrenderers = _subrenderers[pass.name()];
67 subrenderers.emplace_back(std::make_unique<Type>(pass, std::forward<Args>(args)...));
69 return *
static_cast<Type*
>(subrenderers.back().get());
72 template<
typename Type,
typename... Args>
73 requires (std::is_constructible_v<Type, Args...>)
74 auto add_draw_list(
const utility::hashed_string& name, Args&&... args) -> Type& {
75 return _graph.add_draw_list<Type>(name, std::forward<Args>(args)...);
78 template<
typename... Callables>
79 requires (
sizeof...(Callables) > 1u)
80 auto create_graph(Callables&&... callables) ->
decltype(
auto) {
81 auto passes = _graph.emplace(std::forward<Callables>(callables)...);
98 std::vector<std::unique_ptr<graphics::task>> _tasks;
100 std::unordered_map<utility::hashed_string, std::vector<std::unique_ptr<subrenderer>>> _subrenderers;
Definition: command_buffer.hpp:14
Definition: renderer.hpp:26
Definition: swapchain.hpp:12
Definition: noncopyable.hpp:6