1#ifndef LIBSBX_GRAPHICS_DESCRIPTOR_DESCRIPTOR_HANDLER_HPP_
2#define LIBSBX_GRAPHICS_DESCRIPTOR_DESCRIPTOR_HANDLER_HPP_
9#include <libsbx/memory/observer_ptr.hpp>
11#include <libsbx/graphics/render_pass/swapchain.hpp>
13#include <libsbx/graphics/buffers/uniform_handler.hpp>
14#include <libsbx/graphics/buffers/storage_handler.hpp>
15#include <libsbx/graphics/buffers/push_handler.hpp>
17#include <libsbx/graphics/pipeline/pipeline.hpp>
19#include <libsbx/graphics/descriptor/descriptor.hpp>
20#include <libsbx/graphics/descriptor/descriptor_set.hpp>
22namespace sbx::graphics {
28 inline static constexpr auto global_set_id = std::uint32_t{0u};
29 inline static constexpr auto per_draw_call_set_id = std::uint32_t{1u};
37 template<
typename Descriptor>
38 requires (std::is_base_of_v<descriptor, Descriptor>)
39 auto push(
const std::string& name,
const Descriptor&
descriptor) ->
void {
63 struct descriptor_entry {
66 std::uint32_t binding;
69 template<
typename Descriptor>
70 requires (std::is_base_of_v<descriptor, Descriptor>)
71 auto _push(
const std::string& name,
const Descriptor&
descriptor) ->
void {
72 auto binding = _pipeline->find_descriptor_binding(name, _set);
75 throw std::runtime_error(fmt::format(
"Failed to find descriptor binding for descriptor '{}'", name));
78 auto descriptor_type = _pipeline->find_descriptor_type_at_binding(_set, *binding);
80 if (!descriptor_type) {
81 throw std::runtime_error(fmt::format(
"Failed to find descriptor type for descriptor '{}'", name));
93 auto _recreate_descriptor_sets() -> void;
99 std::array<std::unique_ptr<graphics::descriptor_set>, graphics::swapchain::max_frames_in_flight> _descriptor_sets{};
101 std::map<std::string, descriptor_entry> _descriptors{};
Definition: command_buffer.hpp:14
Definition: descriptor_handler.hpp:24
Definition: descriptor_set.hpp:12
Definition: descriptor.hpp:37
Definition: pipeline.hpp:18
Definition: storage_handler.hpp:16
Definition: descriptor.hpp:12
A non-owning pointer that can be used to observe the value of a pointer.
Definition: observer_ptr.hpp:27