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 {
20 VkPipelineStageFlags stage;
23 command_buffer(
bool should_begin =
true, VkQueueFlagBits queue_type = VK_QUEUE_GRAPHICS_BIT, VkCommandBufferLevel buffer_level = VK_COMMAND_BUFFER_LEVEL_PRIMARY);
27 auto handle() const noexcept -> const VkCommandBuffer&;
29 operator const VkCommandBuffer&() const noexcept;
31 auto is_running() const noexcept ->
bool;
33 auto begin(VkCommandBufferUsageFlags usage = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT) ->
void;
37 auto submit_idle() ->
void;
39 auto submit(const std::vector<
wait_data>&
wait_data = {},
const VkSemaphore &signal_semaphore =
nullptr,
const VkFence&
fence =
nullptr) ->
void;
41 auto copy_buffer(
const VkBuffer& source,
const VkBuffer& destination,
const VkBufferCopy& region) -> void;
43 auto set_viewport(
const VkViewport&
viewport) -> void;
45 auto set_scissor(
const VkRect2D& scissor) -> void;
47 auto bind_vertex_buffer(std::uint32_t first_binding,
const VkBuffer& buffer) -> void;
49 auto bind_index_buffer(
const VkBuffer& buffer, VkDeviceSize offset, VkIndexType index_type) -> void;
51 auto draw(std::uint32_t vertex_count, std::uint32_t instance_count, std::uint32_t first_vertex, std::uint32_t first_instance) -> void;
53 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;
55 auto begin_render_pass(
const VkRenderPassBeginInfo& renderpass_begin_info, VkSubpassContents subpass_contents) -> void;
57 auto end_render_pass() -> void;
61 auto _queue() const -> const graphics::
queue&;
65 VkCommandBuffer _handle{};
66 VkQueueFlagBits _queue_type{};
Definition: command_buffer.hpp:14
Definition: command_pool.hpp:12
Definition: logical_device.hpp:17
Definition: semaphore.hpp:8
Definition: render_stage.hpp:125
Definition: command_buffer.hpp:18