59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
#pragma once
|
|
#include "vulkan/basalt_pipeline.h"
|
|
|
|
namespace basalt
|
|
{
|
|
class CommandPool;
|
|
|
|
class CommandBuffer
|
|
{
|
|
public:
|
|
CommandBuffer(const CommandBuffer&) = delete;
|
|
CommandBuffer& operator =(const CommandBuffer&) = delete;
|
|
CommandBuffer(CommandBuffer&& other) noexcept;
|
|
CommandBuffer& operator =(CommandBuffer&& other) noexcept;
|
|
|
|
CommandBuffer(VkCommandBuffer buffer, CommandPool* pool);
|
|
~CommandBuffer();
|
|
|
|
// TODO:
|
|
// Break renderpass stuff out of start/end and into its own start/end function
|
|
void start(basalt::RenderPass& render_pass, VkFramebuffer framebuffer, VkRect2D render_area);
|
|
void bind_pipeline(basalt::Pipeline& pipeline, VkPipelineBindPoint bind);
|
|
void set_viewport(VkViewport port);
|
|
void set_scissor(VkRect2D scissor);
|
|
void stop (void);
|
|
void reset(void);
|
|
|
|
VkCommandBuffer vk = VK_NULL_HANDLE;
|
|
CommandPool* pool = nullptr;
|
|
bool should_free = true;
|
|
};
|
|
|
|
|
|
class CommandPool
|
|
{
|
|
public:
|
|
CommandPool(const CommandPool&) = delete;
|
|
CommandPool& operator =(const CommandPool&) = delete;
|
|
CommandPool(CommandPool&&) noexcept;
|
|
CommandPool& operator =(CommandPool&&) noexcept;
|
|
|
|
|
|
CommandPool(basalt::Device& device, u32 index);
|
|
~CommandPool();
|
|
|
|
// TODO:
|
|
//void get_buffers(VkCommandBufferLevel level, u32 num_buffers, CommandBuffer** buffers_out);
|
|
//basalt::darray<CommandBuffer> get_buffers(VkCommandBufferLevel level, u32 num_buffers);
|
|
CommandBuffer get_buffer(VkCommandBufferLevel level);
|
|
|
|
basalt::Device* device;
|
|
VkCommandPool vk;
|
|
u32 index;
|
|
u32 num_active_buffers : 31;
|
|
u32 should_free : 1;
|
|
};
|
|
|
|
|
|
} |