6#include <vulkan/vulkan.hpp> 
   29                  const std::shared_ptr<vk::Shader>& shader) -> 
PassResources& {
 
 
   56  std::unordered_map<std::string, std::shared_ptr<vk::Shader>> 
shaders_;
 
 
   63  static auto create(
const std::shared_ptr<Context>& ctx,
 
   66                     const std::shared_ptr<RenderTarget>& depth_target,
 
   74                            uint32_t binding, T data);
 
   76                                        size_t size) -> 
void*;
 
   98  RenderPass(
const std::shared_ptr<Context>& ctx, std::string name,
 
  101             const std::shared_ptr<RenderTarget>& depth_target,
 
  124  std::map<std::pair<uint32_t, uint32_t>, std::shared_ptr<vk::Buffer>> 
ubos_;
 
 
  129                                      uint32_t set, uint32_t binding, T data) {
 
  130  if (!
ubos_.contains({set, binding})) {
 
  136             ctx_->graphics_context->allocator(), 
sizeof(data),
 
  137             VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
 
  138             VmaAllocationCreateFlagBits::
 
  139                 VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT)});
 
  142  auto buffer = 
ubos_.at({set, binding});
 
  143  buffer->set_data_raw(&data, 
sizeof(T));
 
  145  ::vk::DescriptorBufferInfo buffer_info(buffer->get(), 0, 
sizeof(T));
 
  146  std::array writes = {::vk::WriteDescriptorSet{
 
  147      {}, binding, 0, ::vk::DescriptorType::eUniformBuffer, {}, buffer_info}};
 
  149  cmd.pushDescriptorSetKHR(::vk::PipelineBindPoint::eGraphics,
 
 
Definition render_pass.hpp:23
 
auto has_colour_target() const
Definition render_pass.hpp:44
 
bool depth_target_
Definition render_pass.hpp:54
 
auto target_prefix() const
Definition render_pass.hpp:47
 
auto has_depth_target() const
Definition render_pass.hpp:45
 
auto shaders() const
Definition render_pass.hpp:48
 
std::string target_prefix_
Definition render_pass.hpp:51
 
std::unordered_map< std::string, std::shared_ptr< vk::Shader > > shaders_
Definition render_pass.hpp:56
 
auto add_shader(const std::string &name, const std::shared_ptr< vk::Shader > &shader) -> PassResources &
Definition render_pass.hpp:28
 
bool colour_target_
Definition render_pass.hpp:53
 
auto add_depth_target() -> PassResources &
Definition render_pass.hpp:39
 
PassResources(std::string target_prefix)
Definition render_pass.hpp:25
 
auto add_colour_target() -> PassResources &
Definition render_pass.hpp:34
 
static auto create(const std::shared_ptr< Context > &ctx, const std::string &name, const PassResources &resources, const std::shared_ptr< RenderTarget > &colour_target, const std::shared_ptr< RenderTarget > &depth_target, const execute_fn_t &fn) -> expected< std::shared_ptr< RenderPass > >
Definition render_pass.cpp:13
 
auto resources() const
Definition render_pass.hpp:85
 
auto output_size() const
Definition render_pass.hpp:82
 
std::string name_
Definition render_pass.hpp:106
 
auto get_command_buffers() const
Definition render_pass.hpp:87
 
std::vector<::vk::CommandBuffer > command_buffers_
Definition render_pass.hpp:117
 
std::shared_ptr< vk::Shader > last_bound_shader_
Definition render_pass.hpp:108
 
std::shared_ptr< Context > ctx_
Definition render_pass.hpp:104
 
::vk::CommandPool command_pool_
Definition render_pass.hpp:116
 
std::shared_ptr< RenderTarget > colour_target_
Definition render_pass.hpp:119
 
::vk::Framebuffer framebuffer_
Definition render_pass.hpp:122
 
auto get_scratch_buffer(uint32_t set, uint32_t binding, size_t size) -> void *
Definition render_pass.cpp:211
 
void execute()
Definition render_pass.cpp:167
 
void recreate_framebuffers(const ::vk::Device &device)
Definition render_pass.cpp:125
 
::vk::RenderPass render_pass_
Definition render_pass.hpp:114
 
void bind_pipeline(const std::string &pipeline_name)
Definition render_pass.cpp:222
 
RenderPass(const std::shared_ptr< Context > &ctx, std::string name, PassResources resources, const std::shared_ptr< RenderTarget > &colour_target, const std::shared_ptr< RenderTarget > &depth_target, execute_fn_t fn)
Definition render_pass.cpp:231
 
math::Vec2f size_
Definition render_pass.hpp:110
 
auto get_framebuffer() const
Definition render_pass.hpp:89
 
auto get() const
Definition render_pass.hpp:95
 
auto colour_target() const
Definition render_pass.hpp:84
 
execute_fn_t execute_fn_
Definition render_pass.hpp:112
 
void on_resource_resized(const std::pair< float, float > &size)
Definition render_pass.cpp:121
 
void write_scratch_buffer(const ::vk::CommandBuffer &cmd, uint32_t set, uint32_t binding, T data)
Definition render_pass.hpp:128
 
PassResources resources_
Definition render_pass.hpp:107
 
std::shared_ptr< RenderTarget > depth_target_
Definition render_pass.hpp:120
 
std::map< std::pair< uint32_t, uint32_t >, std::shared_ptr< vk::Buffer > > ubos_
Definition render_pass.hpp:124
 
std::function< void(RenderPass &, ::vk::CommandBuffer &)> execute_fn_t
Definition render_pass.hpp:61
 
auto resize_target(const math::Vec2f &new_size) -> expected< void >
Definition render_pass.cpp:105
 
static auto create(const VmaAllocator &allocator, size_t size, VkBufferUsageFlags usage, const std::optional< VmaAllocationCreateFlags > &flags={}) -> std::shared_ptr< Buffer >
Definition buffer.cpp:13
 
Definition editor_scene.hpp:5
 
std::expected< T, Err > expected
Definition result.hpp:50
 
Definition context.hpp:13
 
Definition vector.hpp:142