1#ifndef LIBSBX_GRAPHICS_COMMANDS_COMMAND_BUFFER_HPP_
2#define LIBSBX_GRAPHICS_COMMANDS_COMMAND_BUFFER_HPP_
6#include <vulkan/vulkan.hpp>
8#include <libsbx/graphics/devices/logical_device.hpp>
10#include <libsbx/graphics/commands/command_pool.hpp>
12namespace sbx::graphics {
19 VkSemaphore semaphore;
20 VkPipelineStageFlags stage;
24 std::vector<VkBuffer> buffers;
25 VkPipelineStageFlags src_stage_mask;
26 VkPipelineStageFlags dst_stage_mask;
27 VkAccessFlags src_access_mask;
28 VkAccessFlags dst_access_mask;
29 std::uint32_t src_queue_family;
30 std::uint32_t dst_queue_family;
34 VkPipelineStageFlags2 src_stage_mask;
35 VkAccessFlags2 src_access_mask;
36 std::uint32_t src_queue_family;
37 std::uint32_t dst_queue_family;
39 VkDeviceSize size{VK_WHOLE_SIZE};
40 VkDeviceSize offset{0};
44 VkPipelineStageFlags2 dst_stage_mask;
45 VkAccessFlags2 dst_access_mask;
46 std::uint32_t src_queue_family;
47 std::uint32_t dst_queue_family;
49 VkDeviceSize size{VK_WHOLE_SIZE};
50 VkDeviceSize offset{0};
53 command_buffer(
bool should_begin =
true, VkQueueFlagBits queue_type = VK_QUEUE_GRAPHICS_BIT, VkCommandBufferLevel buffer_level = VK_COMMAND_BUFFER_LEVEL_PRIMARY);
65 auto handle() const noexcept -> VkCommandBuffer;
67 operator VkCommandBuffer() const noexcept;
69 auto is_running() const noexcept ->
bool;
71 auto begin(VkCommandBufferUsageFlags usage = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT) ->
void;
75 auto submit_idle() ->
void;
77 auto submit(const std::vector<
wait_data>&
wait_data = {},
const VkSemaphore &signal_semaphore =
nullptr,
const VkFence& fence =
nullptr) ->
void;
79 auto copy_buffer(
const VkBuffer& source,
const VkBuffer& destination,
const VkBufferCopy& region) -> void;
81 auto buffer_barrier(
const buffer_barrier_data& buffer_barrier_data) -> void;
83 auto memory_dependency(
const VkMemoryBarrier2& memory_barrier) -> void;
85 auto release_ownership(
const std::vector<release_ownership_data>& releases) -> void;
87 auto acquire_ownership(
const std::vector<acquire_ownership_data>& acquires) -> void;
89 auto set_viewport(
const VkViewport&
viewport) -> void;
91 auto set_scissor(
const VkRect2D& scissor) -> void;
93 auto bind_vertex_buffer(std::uint32_t first_binding,
const VkBuffer&
buffer) -> void;
95 auto bind_index_buffer(
const VkBuffer&
buffer, VkDeviceSize offset, VkIndexType index_type) -> void;
97 auto draw(std::uint32_t vertex_count, std::uint32_t instance_count, std::uint32_t first_vertex, std::uint32_t first_instance) -> void;
99 auto draw_indexed(std::uint32_t index_count, std::uint32_t instance_count, std::uint32_t first_index, std::int32_t vertex_offset, std::uint32_t first_instance) -> void;
101 auto draw_indirect(VkBuffer
buffer, std::uint32_t offset, std::uint32_t count) -> void;
103 auto draw_indexed_indirect(VkBuffer
buffer, std::uint32_t offset, std::uint32_t count) -> void;
105 auto begin_render_pass(
const VkRenderPassBeginInfo& renderpass_begin_info, VkSubpassContents subpass_contents) -> void;
107 auto end_render_pass() -> void;
109 auto fill_buffer(
const VkBuffer&
buffer, VkDeviceSize offset, VkDeviceSize size, std::uint32_t data) -> void;
113 auto _queue() const -> const graphics::
queue&;
117 VkCommandBuffer _handle{};
118 VkQueueFlagBits _queue_type{};
Definition: buffer.hpp:20
Definition: command_buffer.hpp:14
Definition: command_pool.hpp:12
Definition: logical_device.hpp:18
Definition: render_stage.hpp:123
Definition: command_buffer.hpp:43
Definition: command_buffer.hpp:23
Definition: command_buffer.hpp:33
Definition: command_buffer.hpp:18