sandbox
Loading...
Searching...
No Matches
storage_buffer.hpp
1#ifndef LIBSBX_GRAPHICS_BUFFERS_STORAGE_BUFFER_HPP_
2#define LIBSBX_GRAPHICS_BUFFERS_STORAGE_BUFFER_HPP_
3
4#include <libsbx/units/bytes.hpp>
5
6#include <libsbx/memory/observer_ptr.hpp>
7
8#include <libsbx/graphics/descriptor/descriptor.hpp>
9
10#include <libsbx/graphics/buffers/buffer.hpp>
11
12namespace sbx::graphics {
13
14class storage_buffer : public buffer_base, public descriptor {
15
16public:
17
18 inline static constexpr auto max_size = units::quantity_cast<units::byte>(units::kibibyte{64});
19
20 storage_buffer(VkDeviceSize size, memory::observer_ptr<const void> data = nullptr);
21
22 storage_buffer(VkDeviceSize size, VkBufferUsageFlags additional_usage);
23
24 ~storage_buffer() override;
25
26 auto update(memory::observer_ptr<const void> data, VkDeviceSize size) -> void;
27
28 auto write_descriptor_set(std::uint32_t binding, VkDescriptorType descriptor_type) const noexcept -> graphics::write_descriptor_set override;
29
30 static auto create_descriptor_set_layout_binding(std::uint32_t binding, VkDescriptorType descriptor_type, VkShaderStageFlags stage_flags) noexcept -> VkDescriptorSetLayoutBinding;
31
32private:
33
34 memory::observer_ptr<void> _mapped_memory;
35
36}; // class storage_buffer
37
38} // namespace sbx::graphics
39
40#endif // LIBSBX_GRAPHICS_BUFFERS_STORAGE_BUFFER_HPP_
41
Definition: buffer.hpp:16
Definition: descriptor.hpp:33
Definition: storage_buffer.hpp:14
Definition: descriptor.hpp:12
A non-owning pointer that can be used to observe the value of a pointer.
Definition: observer_ptr.hpp:27
Definition: quantity.hpp:65