ULRE/inc/hgl/graph/VKQueue.h

49 lines
1.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef HGL_GRAPH_VULKAN_SUBMIT_QUEUE_INCLUDE
#define HGL_GRAPH_VULKAN_SUBMIT_QUEUE_INCLUDE
#include<hgl/graph/VK.h>
#include<hgl/graph/VKFence.h>
VK_NAMESPACE_BEGIN
class DeviceQueue
{
protected:
VkDevice device;
VkQueue queue;
uint32_t current_fence;
Fence **fence_list;
uint32_t fence_count;
SubmitInfo submit_info;
private:
friend class GPUDevice;
DeviceQueue(VkDevice dev,VkQueue q,Fence **,const uint32_t fc);
public:
virtual ~DeviceQueue();
operator VkQueue(){return queue;}
VkResult Present(const VkPresentInfoKHR *pi){return vkQueuePresentKHR(queue,pi);}
/**
* 等待Submit的队列完成操作。这个操作会阻塞当前线程所以在Submit后请不要立即使用它。而是在下一次队列提交前再做这个操作。
*/
bool WaitQueue();
/**
* 等待Queue命令执行完成的fence信号
*/
bool WaitFence(const bool wait_all=true,const uint64_t time_out=HGL_NANO_SEC_PER_SEC);
bool Submit(const VkCommandBuffer *cmd_buf,const uint32_t count,Semaphore *wait_sem,Semaphore *complete_sem);
bool Submit(GPUCmdBuffer *cmd_buf,Semaphore *wait_sem,Semaphore *complete_sem);
};//class DeviceQueue
VK_NAMESPACE_END
#endif//HGL_GRAPH_VULKAN_SUBMIT_QUEUE_INCLUDE