diff --git a/example/Vulkan/DeferredRender.cpp b/example/Vulkan/DeferredRender.cpp index 8c2ba79c..21f1c8d4 100644 --- a/example/Vulkan/DeferredRender.cpp +++ b/example/Vulkan/DeferredRender.cpp @@ -59,7 +59,7 @@ private: public: - bool Submit(GPUSemaphore *sem) + bool Submit(Semaphore *sem) { return rt->Submit(cmd,sem); } diff --git a/inc/hgl/graph/VK.h b/inc/hgl/graph/VK.h index bab38faf..0c8ec122 100644 --- a/inc/hgl/graph/VK.h +++ b/inc/hgl/graph/VK.h @@ -33,7 +33,7 @@ class VulkanInstance; class GPUPhysicalDevice; class GPUDevice; struct GPUDeviceAttribute; -class GPUQueue; +class Queue; class ImageView; class Framebuffer; struct Swapchain; @@ -68,7 +68,7 @@ class RenderPass; class DeviceRenderPassManage; class Fence; -class GPUSemaphore; +class Semaphore; enum class DescriptorSetsType { diff --git a/inc/hgl/graph/VKDevice.h b/inc/hgl/graph/VKDevice.h index 734df5e2..24e4c607 100644 --- a/inc/hgl/graph/VKDevice.h +++ b/inc/hgl/graph/VKDevice.h @@ -43,7 +43,7 @@ class GPUDevice { GPUDeviceAttribute *attr; - GPUQueue *texture_queue; + Queue *texture_queue; TextureCmdBuffer *texture_cmd_buf; private: @@ -241,9 +241,9 @@ public: RenderPass * AcquireRenderPass( const RenderbufferInfo *,const uint subpass_count=2); Fence * CreateFence(bool); - GPUSemaphore * CreateGPUSemaphore(); + Semaphore * CreateGPUSemaphore(); - GPUQueue * CreateQueue(const uint32_t fence_count=1,const bool create_signaled=false); + Queue * CreateQueue(const uint32_t fence_count=1,const bool create_signaled=false); public: //FrameBuffer相关 diff --git a/inc/hgl/graph/VKQueue.h b/inc/hgl/graph/VKQueue.h index 0459abfc..70e48710 100644 --- a/inc/hgl/graph/VKQueue.h +++ b/inc/hgl/graph/VKQueue.h @@ -4,7 +4,7 @@ #include #include VK_NAMESPACE_BEGIN -class GPUQueue +class Queue { protected: @@ -21,11 +21,11 @@ private: friend class GPUDevice; - GPUQueue(VkDevice dev,VkQueue q,Fence **,const uint32_t fc); + Queue(VkDevice dev,VkQueue q,Fence **,const uint32_t fc); public: - virtual ~GPUQueue(); + virtual ~Queue(); operator VkQueue(){return queue;} @@ -33,8 +33,8 @@ public: bool WaitQueue(); bool WaitFence(const bool wait_all=true,const uint64_t time_out=HGL_NANO_SEC_PER_SEC); - bool Submit(const VkCommandBuffer &cmd_buf,GPUSemaphore *wait_sem,GPUSemaphore *complete_sem); - bool Submit(const VkCommandBuffer *cmd_buf,const uint32_t count,GPUSemaphore *wait_sem,GPUSemaphore *complete_sem); + bool Submit(const VkCommandBuffer &cmd_buf,Semaphore *wait_sem,Semaphore *complete_sem); + bool Submit(const VkCommandBuffer *cmd_buf,const uint32_t count,Semaphore *wait_sem,Semaphore *complete_sem); };//class SumbitQueue VK_NAMESPACE_END #endif//HGL_GRAPH_VULKAN_SUBMIT_QUEUE_INCLUDE diff --git a/inc/hgl/graph/VKRenderTarget.h b/inc/hgl/graph/VKRenderTarget.h index 634700cd..49a4c5bb 100644 --- a/inc/hgl/graph/VKRenderTarget.h +++ b/inc/hgl/graph/VKRenderTarget.h @@ -15,14 +15,14 @@ class RenderTarget { protected: - GPUQueue *queue; + Queue *queue; RenderPass *render_pass; Framebuffer *fbo; VkExtent2D extent; - GPUSemaphore *render_complete_semaphore =nullptr; + Semaphore *render_complete_semaphore =nullptr; protected: @@ -34,14 +34,14 @@ protected: friend class GPUDevice; - RenderTarget(GPUQueue *,GPUSemaphore *); - RenderTarget(GPUQueue *,GPUSemaphore *,RenderPass *_rp,Framebuffer *_fb,Texture2D **color_texture_list,const uint32_t color_count,Texture2D *depth_texture); + RenderTarget(Queue *,Semaphore *); + RenderTarget(Queue *,Semaphore *,RenderPass *_rp,Framebuffer *_fb,Texture2D **color_texture_list,const uint32_t color_count,Texture2D *depth_texture); public: virtual ~RenderTarget(); - GPUQueue * GetQueue () {return queue;} + Queue * GetQueue () {return queue;} const VkExtent2D & GetExtent ()const {return extent;} virtual RenderPass * GetRenderPass () {return render_pass;} virtual const VkRenderPass GetVkRenderPass ()const {return render_pass->GetVkRenderPass();} @@ -53,8 +53,8 @@ public: public: // command buffer - GPUSemaphore * GetRenderCompleteSemaphore (){return render_complete_semaphore;} - virtual bool Submit (RenderCmdBuffer *,GPUSemaphore *present_complete_semaphore=nullptr); + Semaphore * GetRenderCompleteSemaphore (){return render_complete_semaphore;} + virtual bool Submit (RenderCmdBuffer *,Semaphore *present_complete_semaphore=nullptr); bool WaitQueue(){return queue->WaitQueue();} bool WaitFence(){return queue->WaitFence();} @@ -69,13 +69,13 @@ class SwapchainRenderTarget:public RenderTarget Swapchain *swapchain; PresentInfo present_info; - GPUSemaphore *present_complete_semaphore=nullptr; + Semaphore *present_complete_semaphore=nullptr; uint32_t current_frame; public: - SwapchainRenderTarget(VkDevice dev,Swapchain *sc,GPUQueue *q,GPUSemaphore *rcs,GPUSemaphore *pcs,RenderPass *rp); + SwapchainRenderTarget(VkDevice dev,Swapchain *sc,Queue *q,Semaphore *rcs,Semaphore *pcs,RenderPass *rp); ~SwapchainRenderTarget(); Framebuffer * GetFramebuffer ()override {return swapchain->render_frame[current_frame];} @@ -90,7 +90,7 @@ public: public: const uint32_t GetCurrentFrameIndices ()const {return current_frame;} - GPUSemaphore * GetPresentCompleteSemaphore () {return present_complete_semaphore;} + Semaphore * GetPresentCompleteSemaphore () {return present_complete_semaphore;} public: @@ -109,7 +109,7 @@ public: bool PresentBackbuffer(); bool Submit(VkCommandBuffer); - bool Submit(VkCommandBuffer,GPUSemaphore *); + bool Submit(VkCommandBuffer,Semaphore *); };//class SwapchainRenderTarget:public RenderTarget VK_NAMESPACE_END #endif//HGL_GRAPH_VULKAN_RENDER_TARGET_INCLUDE diff --git a/inc/hgl/graph/VKSemaphore.h b/inc/hgl/graph/VKSemaphore.h index f9f3d0b5..ea6f9d91 100644 --- a/inc/hgl/graph/VKSemaphore.h +++ b/inc/hgl/graph/VKSemaphore.h @@ -3,7 +3,7 @@ #include VK_NAMESPACE_BEGIN -class GPUSemaphore +class Semaphore { VkDevice device; VkSemaphore sem; @@ -12,7 +12,7 @@ private: friend class GPUDevice; - GPUSemaphore(VkDevice d,VkSemaphore s) + Semaphore(VkDevice d,VkSemaphore s) { device=d; sem=s; @@ -20,11 +20,11 @@ private: public: - ~GPUSemaphore(); + ~Semaphore(); operator VkSemaphore(){return sem;} operator const VkSemaphore *()const{return &sem;} -};//class GPUSemaphore +};//class Semaphore VK_NAMESPACE_END #endif//HGL_GRAPH_VULKAN_SEMAPHORE_INCLUDE diff --git a/src/SceneGraph/Vulkan/VKDevice.cpp b/src/SceneGraph/Vulkan/VKDevice.cpp index a2f8030d..eaea650d 100644 --- a/src/SceneGraph/Vulkan/VKDevice.cpp +++ b/src/SceneGraph/Vulkan/VKDevice.cpp @@ -128,7 +128,7 @@ Fence *GPUDevice::CreateFence(bool create_signaled) return(new Fence(attr->device,fence)); } -GPUSemaphore *GPUDevice::CreateGPUSemaphore() +Semaphore *GPUDevice::CreateGPUSemaphore() { SemaphoreCreateInfo SemaphoreCreateInfo; @@ -137,10 +137,10 @@ GPUSemaphore *GPUDevice::CreateGPUSemaphore() if(vkCreateSemaphore(attr->device, &SemaphoreCreateInfo, nullptr, &sem)!=VK_SUCCESS) return(nullptr); - return(new GPUSemaphore(attr->device,sem)); + return(new Semaphore(attr->device,sem)); } -GPUQueue *GPUDevice::CreateQueue(const uint32_t fence_count,const bool create_signaled) +Queue *GPUDevice::CreateQueue(const uint32_t fence_count,const bool create_signaled) { if(fence_count<=0)return(nullptr); @@ -149,6 +149,6 @@ GPUQueue *GPUDevice::CreateQueue(const uint32_t fence_count,const bool create_si for(uint32_t i=0;idevice,attr->graphics_queue,fence_list,fence_count)); + return(new Queue(attr->device,attr->graphics_queue,fence_list,fence_count)); } VK_NAMESPACE_END diff --git a/src/SceneGraph/Vulkan/VKDeviceRenderTarget.cpp b/src/SceneGraph/Vulkan/VKDeviceRenderTarget.cpp index 82853f72..76defd49 100644 --- a/src/SceneGraph/Vulkan/VKDeviceRenderTarget.cpp +++ b/src/SceneGraph/Vulkan/VKDeviceRenderTarget.cpp @@ -33,8 +33,8 @@ RenderTarget *GPUDevice::CreateRenderTarget(const FramebufferInfo *fbi,RenderPas if(fb) { - GPUQueue *q=CreateQueue(fence_count,false); - GPUSemaphore *render_complete_semaphore=CreateGPUSemaphore(); + Queue *q=CreateQueue(fence_count,false); + Semaphore *render_complete_semaphore=CreateGPUSemaphore(); RenderTarget *rt=new RenderTarget(q,render_complete_semaphore,rp,fb,color_texture_list,color_count,depth_texture); @@ -64,9 +64,9 @@ SwapchainRenderTarget *GPUDevice::CreateSwapchainRenderTarget() if(!sc) return(false); - GPUQueue *q=CreateQueue(sc->color_count,false); - GPUSemaphore *render_complete_semaphore=CreateGPUSemaphore(); - GPUSemaphore *present_complete_semaphore=CreateGPUSemaphore(); + Queue *q=CreateQueue(sc->color_count,false); + Semaphore *render_complete_semaphore=CreateGPUSemaphore(); + Semaphore *present_complete_semaphore=CreateGPUSemaphore(); SwapchainRenderTarget *srt=new SwapchainRenderTarget( attr->device, sc, diff --git a/src/SceneGraph/Vulkan/VKQueue.cpp b/src/SceneGraph/Vulkan/VKQueue.cpp index 50b02b1f..580d9443 100644 --- a/src/SceneGraph/Vulkan/VKQueue.cpp +++ b/src/SceneGraph/Vulkan/VKQueue.cpp @@ -7,7 +7,7 @@ namespace const VkPipelineStageFlags pipe_stage_flags=VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; }//namespace -GPUQueue::GPUQueue(VkDevice dev,VkQueue q,Fence **fl,const uint32_t fc) +Queue::Queue(VkDevice dev,VkQueue q,Fence **fl,const uint32_t fc) { device=dev; queue=q; @@ -19,12 +19,12 @@ GPUQueue::GPUQueue(VkDevice dev,VkQueue q,Fence **fl,const uint32_t fc) submit_info.pWaitDstStageMask = &pipe_stage_flags; } -GPUQueue::~GPUQueue() +Queue::~Queue() { SAFE_CLEAR_OBJECT_ARRAY(fence_list,fence_count) } -bool GPUQueue::WaitQueue() +bool Queue::WaitQueue() { VkResult result=vkQueueWaitIdle(queue); @@ -34,7 +34,7 @@ bool GPUQueue::WaitQueue() return(true); } -bool GPUQueue::WaitFence(const bool wait_all,uint64_t time_out) +bool Queue::WaitFence(const bool wait_all,uint64_t time_out) { VkResult result; VkFence fence=*fence_list[current_fence]; @@ -48,7 +48,7 @@ bool GPUQueue::WaitFence(const bool wait_all,uint64_t time_out) return(true); } -bool GPUQueue::Submit(const VkCommandBuffer *cmd_buf,const uint32_t cb_count,GPUSemaphore *wait_sem,GPUSemaphore *complete_sem) +bool Queue::Submit(const VkCommandBuffer *cmd_buf,const uint32_t cb_count,Semaphore *wait_sem,Semaphore *complete_sem) { VkSemaphore ws; VkSemaphore cs; @@ -91,7 +91,7 @@ bool GPUQueue::Submit(const VkCommandBuffer *cmd_buf,const uint32_t cb_count,GPU return(result==VK_SUCCESS); } -bool GPUQueue::Submit(const VkCommandBuffer &cmd_buf,GPUSemaphore *wait_sem,GPUSemaphore *complete_sem) +bool Queue::Submit(const VkCommandBuffer &cmd_buf,Semaphore *wait_sem,Semaphore *complete_sem) { return Submit(&cmd_buf,1,wait_sem,complete_sem); } diff --git a/src/SceneGraph/Vulkan/VKRenderTarget.cpp b/src/SceneGraph/Vulkan/VKRenderTarget.cpp index 2e61bc50..02e9258b 100644 --- a/src/SceneGraph/Vulkan/VKRenderTarget.cpp +++ b/src/SceneGraph/Vulkan/VKRenderTarget.cpp @@ -6,7 +6,7 @@ #include VK_NAMESPACE_BEGIN -RenderTarget::RenderTarget(GPUQueue *q,GPUSemaphore *s) +RenderTarget::RenderTarget(Queue *q,Semaphore *s) { queue=q; render_pass=nullptr; @@ -18,7 +18,7 @@ RenderTarget::RenderTarget(GPUQueue *q,GPUSemaphore *s) render_complete_semaphore=s; } -RenderTarget::RenderTarget(GPUQueue *q,GPUSemaphore *s,RenderPass *_rp,Framebuffer *_fb,Texture2D **ctl,const uint32_t cc,Texture2D *dt) +RenderTarget::RenderTarget(Queue *q,Semaphore *s,RenderPass *_rp,Framebuffer *_fb,Texture2D **ctl,const uint32_t cc,Texture2D *dt) { queue=q; render_pass=_rp; @@ -59,7 +59,7 @@ RenderTarget::~RenderTarget() SAFE_CLEAR(fbo); } -bool RenderTarget::Submit(RenderCmdBuffer *command_buffer,GPUSemaphore *present_complete_semaphore) +bool RenderTarget::Submit(RenderCmdBuffer *command_buffer,Semaphore *present_complete_semaphore) { return queue->Submit(*command_buffer,present_complete_semaphore,render_complete_semaphore); } diff --git a/src/SceneGraph/Vulkan/VKSemaphore.cpp b/src/SceneGraph/Vulkan/VKSemaphore.cpp index 81eaa6ac..f565c42c 100644 --- a/src/SceneGraph/Vulkan/VKSemaphore.cpp +++ b/src/SceneGraph/Vulkan/VKSemaphore.cpp @@ -1,6 +1,6 @@ #include VK_NAMESPACE_BEGIN -GPUSemaphore::~GPUSemaphore() +Semaphore::~Semaphore() { vkDestroySemaphore(device,sem,nullptr); } diff --git a/src/SceneGraph/Vulkan/VKSwapchainRenderTarget.cpp b/src/SceneGraph/Vulkan/VKSwapchainRenderTarget.cpp index 2b185b35..e32a1b0d 100644 --- a/src/SceneGraph/Vulkan/VKSwapchainRenderTarget.cpp +++ b/src/SceneGraph/Vulkan/VKSwapchainRenderTarget.cpp @@ -3,7 +3,7 @@ #include VK_NAMESPACE_BEGIN -SwapchainRenderTarget::SwapchainRenderTarget(VkDevice dev,Swapchain *sc,GPUQueue *q,GPUSemaphore *rcs,GPUSemaphore *pcs,RenderPass *rp):RenderTarget(q,rcs) +SwapchainRenderTarget::SwapchainRenderTarget(VkDevice dev,Swapchain *sc,Queue *q,Semaphore *rcs,Semaphore *pcs,RenderPass *rp):RenderTarget(q,rcs) { device=dev; @@ -70,7 +70,7 @@ bool SwapchainRenderTarget::Submit(VkCommandBuffer cb) return queue->Submit(cb,present_complete_semaphore,render_complete_semaphore); } -bool SwapchainRenderTarget::Submit(VkCommandBuffer cb,GPUSemaphore *pce) +bool SwapchainRenderTarget::Submit(VkCommandBuffer cb,Semaphore *pce) { return queue->Submit(cb,pce,render_complete_semaphore); }