46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
|
|
#pragma once
|
|
|
|
#if !defined(IWA_COMMAND_HPP_INCLUDED)
|
|
#define IWA_COMMAND_HPP_INCLUDED
|
|
|
|
#include "iwa/object.hpp"
|
|
#include "iwa/vkwrapper.hpp"
|
|
|
|
namespace iwa
|
|
{
|
|
struct CommandPoolCreationArgs
|
|
{
|
|
vk::CommandPoolCreateFlags flags;
|
|
std::uint32_t queueFamilyIndex;
|
|
};
|
|
|
|
struct CommandBufferAllocateArgs
|
|
{
|
|
vk::CommandBufferLevel level = vk::CommandBufferLevel::ePrimary;
|
|
};
|
|
|
|
class CommandPool : public Object<CommandPool, BaseObject, class Device>, public MixinVulkanObject<vk::CommandPool>
|
|
{
|
|
public:
|
|
CommandPool(ObjectPtr<class Device> owner, CommandPoolCreationArgs args);
|
|
~CommandPool() noexcept override;
|
|
|
|
[[nodiscard]] ObjectPtr<class CommandBuffer> allocateCommandBuffer(const CommandBufferAllocateArgs& args = {});
|
|
// [[nodiscard]] std::vector<vk::CommandBuffer> allocateCommandBuffers(std::size_t count, const CommandBufferAllocateArgs& args = {}) const noexcept;
|
|
};
|
|
|
|
class CommandBuffer : public Object<CommandBuffer, BaseObject, CommandPool>, public MixinVulkanObject<vk::CommandBuffer>
|
|
{
|
|
public:
|
|
CommandBuffer(ObjectPtr<CommandPool> owner, vk::CommandBuffer handle);
|
|
~CommandBuffer() noexcept override;
|
|
|
|
void begin(const vk::CommandBufferBeginInfo& beginInfo = {}) const noexcept { getVkHandle().begin(beginInfo); }
|
|
void end() const noexcept { getVkHandle().end(); }
|
|
void reset() const noexcept { getVkHandle().reset(); }
|
|
};
|
|
} // namespace iwa
|
|
|
|
#endif // !defined(IWA_COMMAND_HPP_INCLUDED)
|