mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 07:03:34 +00:00
working on better command buffers management
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/06 18:25:42 by maldavid #+# #+# */
|
||||
/* Updated: 2023/12/16 18:44:48 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/12/17 20:01:55 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
class Buffer;
|
||||
class Image;
|
||||
|
||||
class CmdBuffer
|
||||
{
|
||||
public:
|
||||
@@ -31,9 +34,15 @@ namespace mlx
|
||||
submitted, // buffer has been submitted
|
||||
};
|
||||
|
||||
enum class kind
|
||||
{
|
||||
single_time = 0,
|
||||
long_time
|
||||
};
|
||||
|
||||
public:
|
||||
void init(class CmdManager* manager);
|
||||
void init(class CmdPool* pool);
|
||||
void init(kind type, class CmdManager* manager);
|
||||
void init(kind type, class CmdPool* pool);
|
||||
void destroy() noexcept;
|
||||
|
||||
void beginRecord(VkCommandBufferUsageFlags usage = 0);
|
||||
@@ -43,6 +52,12 @@ namespace mlx
|
||||
inline void reset() noexcept { vkResetCommandBuffer(_cmd_buffer, 0); }
|
||||
void endRecord();
|
||||
|
||||
void bindVertexBuffer(Buffer& buffer) const noexcept;
|
||||
void bindIndexBuffer(Buffer& buffer) const noexcept;
|
||||
void copyBuffer(Buffer& dst, Buffer& src) const noexcept;
|
||||
void copyBufferToImage(Buffer& buffer, Image& image) const noexcept;
|
||||
void copyImagetoBuffer(Image& image, Buffer& buffer) const noexcept;
|
||||
|
||||
inline bool isInit() const noexcept { return _state != state::uninit; }
|
||||
inline bool isReadyToBeUsed() const noexcept { return _state == state::ready; }
|
||||
inline bool isRecording() const noexcept { return _state == state::recording; }
|
||||
@@ -58,6 +73,7 @@ namespace mlx
|
||||
VkCommandBuffer _cmd_buffer = VK_NULL_HANDLE;
|
||||
class CmdPool* _pool = nullptr;
|
||||
state _state = state::uninit;
|
||||
kind _type;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user