From c3aac9026951e2a6e35e76b9c7d36e114a281453 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Tue, 5 May 2026 00:43:54 +0200 Subject: Remove old api and move api-test content to src and include dirs --- include/vk-command-buffer.hpp | 75 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 include/vk-command-buffer.hpp (limited to 'include/vk-command-buffer.hpp') diff --git a/include/vk-command-buffer.hpp b/include/vk-command-buffer.hpp new file mode 100644 index 0000000..82d5439 --- /dev/null +++ b/include/vk-command-buffer.hpp @@ -0,0 +1,75 @@ +#pragma once + +#include "handle.hpp" +#include "vk-device-types.hpp" +#include "vec3.hpp" + +struct device_texture; +struct device_buffer; +struct device_pipeline; + +struct dispatch_params { + handle pipeline; + vec3u group_size; + vec3u local_group_size; +}; + +struct renderpass_params { +private: + struct rect { + int32_t x; + int32_t y; + uint32_t width; + uint32_t height; + }; + +public: + rect render_area; + std::span> color_attachments; +}; + +struct draw_params { + handle pipeline; + handle index_buffer; + uint32_t vertex_count; + uint32_t vertex_offset; + uint32_t instance_count; +}; + +struct draw_indexed_params { + handle pipeline; + handle index_buffer; + uint32_t vertex_count; + uint32_t vertex_offset; + uint32_t index_offset; + uint32_t instance_count; +}; + +struct command_buffer { + void start() const; + void stop() const; + + void barrier(handle texture_handle, VkPipelineStageFlags2 stage, VkAccessFlags2 access, VkImageLayout layout) const; + + void copy(handle buffer_handle, handle texture_handle, uint64_t offset = 0) const; + + VkCommandBuffer vk_command_buffer; + QueueType queue_type; +}; + +// General purpose queue +struct graphics_command_buffer: public command_buffer { + void dispatch(const dispatch_params& params) const; + + void begin_renderpass(const renderpass_params& params) const; + void draw(const draw_params& params) const; + void draw_indexed(const draw_indexed_params& params) const; + void end_renderpass() const; +}; + +struct compute_command_buffer: public command_buffer { + void dispatch(const dispatch_params& params); +}; + +struct transfer_command_buffer: public command_buffer { +}; -- cgit v1.3