mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 07:03:34 +00:00
new branch for error 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/15 20:19:42 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/12/16 18:44:48 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -21,6 +21,16 @@ namespace mlx
|
||||
{
|
||||
class CmdBuffer
|
||||
{
|
||||
public:
|
||||
enum class state
|
||||
{
|
||||
uninit = 0, // buffer not initialized or destroyed
|
||||
ready, // buffer ready to be used after having been submitted
|
||||
idle, // buffer has recorded informations but has not been submitted
|
||||
recording, // buffer is currently recording
|
||||
submitted, // buffer has been submitted
|
||||
};
|
||||
|
||||
public:
|
||||
void init(class CmdManager* manager);
|
||||
void init(class CmdPool* pool);
|
||||
@@ -29,13 +39,15 @@ namespace mlx
|
||||
void beginRecord(VkCommandBufferUsageFlags usage = 0);
|
||||
void submit(class Semaphore& semaphores) noexcept;
|
||||
void submitIdle() noexcept;
|
||||
inline void waitForExecution() noexcept { _fence.waitAndReset(); }
|
||||
inline void waitForExecution() noexcept { _fence.waitAndReset(); _state = state::ready; }
|
||||
inline void reset() noexcept { vkResetCommandBuffer(_cmd_buffer, 0); }
|
||||
inline bool isReadyToBeUsed() const noexcept { return _fence.isReady(); }
|
||||
void endRecord();
|
||||
|
||||
inline bool isRecording() const noexcept { return _is_recording; }
|
||||
inline bool isInit() const noexcept { return _cmd_buffer != VK_NULL_HANDLE; }
|
||||
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; }
|
||||
inline bool hasBeenSubmitted() const noexcept { return _state == state::submitted; }
|
||||
inline state getCurrentState() const noexcept { return _state; }
|
||||
|
||||
inline VkCommandBuffer& operator()() noexcept { return _cmd_buffer; }
|
||||
inline VkCommandBuffer& get() noexcept { return _cmd_buffer; }
|
||||
@@ -45,7 +57,7 @@ namespace mlx
|
||||
Fence _fence;
|
||||
VkCommandBuffer _cmd_buffer = VK_NULL_HANDLE;
|
||||
class CmdPool* _pool = nullptr;
|
||||
bool _is_recording = false;
|
||||
state _state = state::uninit;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user