mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 22:53:34 +00:00
removing texture library
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/06 18:26:06 by maldavid #+# #+# */
|
||||
/* Updated: 2023/04/02 18:13:38 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/04/21 13:24:56 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -19,11 +19,16 @@ namespace mlx
|
||||
{
|
||||
void CmdBuffer::init(CmdManager* manager)
|
||||
{
|
||||
_manager = manager;
|
||||
init(&manager->getCmdPool());
|
||||
}
|
||||
|
||||
void CmdBuffer::init(CmdPool* pool)
|
||||
{
|
||||
_pool = pool;
|
||||
|
||||
VkCommandBufferAllocateInfo allocInfo{};
|
||||
allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
|
||||
allocInfo.commandPool = manager->getCmdPool().get();
|
||||
allocInfo.commandPool = pool->get();
|
||||
allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
|
||||
allocInfo.commandBufferCount = 1;
|
||||
|
||||
@@ -57,6 +62,26 @@ namespace mlx
|
||||
_is_recording = false;
|
||||
}
|
||||
|
||||
void CmdBuffer::submitIdle() noexcept
|
||||
{
|
||||
auto device = Render_Core::get().getDevice().get();
|
||||
|
||||
VkSubmitInfo submitInfo = {};
|
||||
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
||||
submitInfo.commandBufferCount = 1;
|
||||
submitInfo.pCommandBuffers = &_cmd_buffer;
|
||||
|
||||
VkFenceCreateInfo fenceCreateInfo = {};
|
||||
fenceCreateInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
|
||||
|
||||
VkFence fence;
|
||||
vkCreateFence(device, &fenceCreateInfo, nullptr, &fence);
|
||||
vkResetFences(device, 1, &fence);
|
||||
vkQueueSubmit(Render_Core::get().getQueue().getGraphic(), 1, &submitInfo, fence);
|
||||
vkWaitForFences(device, 1, &fence, VK_TRUE, UINT64_MAX);
|
||||
vkDestroyFence(device, fence, nullptr);
|
||||
}
|
||||
|
||||
void CmdBuffer::submit(Semaphore& semaphores) noexcept
|
||||
{
|
||||
VkSemaphore signalSemaphores[] = { semaphores.getRenderImageSemaphore() };
|
||||
@@ -79,7 +104,6 @@ namespace mlx
|
||||
|
||||
void CmdBuffer::destroy() noexcept
|
||||
{
|
||||
vkFreeCommandBuffers(Render_Core::get().getDevice().get(), _manager->getCmdPool().get(), 1, &_cmd_buffer);
|
||||
_fence.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/06 18:25:42 by maldavid #+# #+# */
|
||||
/* Updated: 2023/04/02 17:57:26 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/04/21 13:20:49 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -22,23 +22,27 @@ namespace mlx
|
||||
{
|
||||
public:
|
||||
void init(class CmdManager* manager);
|
||||
void init(class CmdPool* pool);
|
||||
void destroy() noexcept;
|
||||
|
||||
void beginRecord(VkCommandBufferUsageFlags usage = 0);
|
||||
void submit(class Semaphore& semaphores) noexcept;
|
||||
void submitIdle() noexcept;
|
||||
inline void waitForExecution() noexcept { _fence.waitAndReset(); }
|
||||
inline void reset() noexcept { vkResetCommandBuffer(_cmd_buffer, 0); }
|
||||
void endRecord();
|
||||
|
||||
inline bool isRecording() const noexcept { return _is_recording; }
|
||||
inline bool isInit() const noexcept { return _cmd_buffer != VK_NULL_HANDLE; }
|
||||
|
||||
inline VkCommandBuffer& operator()() noexcept { return _cmd_buffer; }
|
||||
inline VkCommandBuffer& get() noexcept { return _cmd_buffer; }
|
||||
inline Fence& getFence() noexcept { return _fence; }
|
||||
|
||||
private:
|
||||
Fence _fence;
|
||||
VkCommandBuffer _cmd_buffer = VK_NULL_HANDLE;
|
||||
class CmdManager* _manager = nullptr;
|
||||
class CmdPool* _pool = nullptr;
|
||||
bool _is_recording = false;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user