2025-01-28 20:03:44 +08:00
|
|
|
|
#ifndef HGL_GRAPH_VULKAN_SUBMIT_QUEUE_INCLUDE
|
2020-10-17 14:16:52 +08:00
|
|
|
|
#define HGL_GRAPH_VULKAN_SUBMIT_QUEUE_INCLUDE
|
|
|
|
|
|
2020-10-21 11:43:18 +08:00
|
|
|
|
#include<hgl/graph/VK.h>
|
|
|
|
|
#include<hgl/graph/VKFence.h>
|
2020-10-17 14:16:52 +08:00
|
|
|
|
VK_NAMESPACE_BEGIN
|
2023-03-02 20:19:25 +08:00
|
|
|
|
class DeviceQueue
|
2020-10-17 14:16:52 +08:00
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
|
2021-12-15 19:56:44 +08:00
|
|
|
|
VkDevice device;
|
2020-10-17 14:16:52 +08:00
|
|
|
|
VkQueue queue;
|
|
|
|
|
|
|
|
|
|
uint32_t current_fence;
|
2022-10-14 19:27:29 +08:00
|
|
|
|
Fence **fence_list;
|
2021-12-15 19:56:44 +08:00
|
|
|
|
uint32_t fence_count;
|
2020-10-17 14:16:52 +08:00
|
|
|
|
|
|
|
|
|
SubmitInfo submit_info;
|
|
|
|
|
|
2021-12-15 19:56:44 +08:00
|
|
|
|
private:
|
|
|
|
|
|
2025-05-17 20:26:36 +08:00
|
|
|
|
friend class VulkanDevice;
|
2021-12-15 19:56:44 +08:00
|
|
|
|
|
2023-03-02 20:19:25 +08:00
|
|
|
|
DeviceQueue(VkDevice dev,VkQueue q,Fence **,const uint32_t fc);
|
2021-12-15 19:56:44 +08:00
|
|
|
|
|
2020-10-17 14:16:52 +08:00
|
|
|
|
public:
|
|
|
|
|
|
2023-03-02 20:19:25 +08:00
|
|
|
|
virtual ~DeviceQueue();
|
2022-09-27 19:41:28 +08:00
|
|
|
|
|
|
|
|
|
operator VkQueue(){return queue;}
|
2020-10-17 14:16:52 +08:00
|
|
|
|
|
2021-12-15 19:56:44 +08:00
|
|
|
|
VkResult Present(const VkPresentInfoKHR *pi){return vkQueuePresentKHR(queue,pi);}
|
|
|
|
|
|
2025-01-28 20:03:44 +08:00
|
|
|
|
/**
|
|
|
|
|
* 等待Submit的队列完成操作。这个操作会阻塞当前线程,所以在Submit后请不要立即使用它。而是在下一次队列提交前再做这个操作。
|
|
|
|
|
*/
|
2020-10-18 13:53:43 +08:00
|
|
|
|
bool WaitQueue();
|
2025-01-28 20:03:44 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 等待Queue命令执行完成的fence信号
|
|
|
|
|
*/
|
2020-10-18 13:53:43 +08:00
|
|
|
|
bool WaitFence(const bool wait_all=true,const uint64_t time_out=HGL_NANO_SEC_PER_SEC);
|
2025-01-28 20:03:44 +08:00
|
|
|
|
|
2022-10-14 19:40:16 +08:00
|
|
|
|
bool Submit(const VkCommandBuffer *cmd_buf,const uint32_t count,Semaphore *wait_sem,Semaphore *complete_sem);
|
2025-05-17 20:26:36 +08:00
|
|
|
|
bool Submit(VulkanCmdBuffer *cmd_buf,Semaphore *wait_sem,Semaphore *complete_sem);
|
2023-03-02 20:19:25 +08:00
|
|
|
|
};//class DeviceQueue
|
2020-10-17 14:16:52 +08:00
|
|
|
|
VK_NAMESPACE_END
|
|
|
|
|
#endif//HGL_GRAPH_VULKAN_SUBMIT_QUEUE_INCLUDE
|