optimized SwapchainModule and SwapchainRenderTarget
This commit is contained in:
@@ -15,6 +15,8 @@ protected:
|
||||
|
||||
VkCommandBuffer cmd_buf;
|
||||
|
||||
bool cmd_begin;
|
||||
|
||||
public:
|
||||
|
||||
GPUCmdBuffer(const GPUDeviceAttribute *attr,VkCommandBuffer cb);
|
||||
@@ -23,9 +25,19 @@ public:
|
||||
operator VkCommandBuffer(){return cmd_buf;}
|
||||
operator const VkCommandBuffer()const{return cmd_buf;}
|
||||
operator const VkCommandBuffer *()const{return &cmd_buf;}
|
||||
|
||||
const bool IsBegin()const{return cmd_begin;}
|
||||
|
||||
bool Begin();
|
||||
bool End(){return(vkEndCommandBuffer(cmd_buf)==VK_SUCCESS);}
|
||||
bool End()
|
||||
{
|
||||
if(!cmd_begin)
|
||||
return(false);
|
||||
|
||||
cmd_begin=false;
|
||||
|
||||
return(vkEndCommandBuffer(cmd_buf)==VK_SUCCESS);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
void SetDebugName(const AnsiString &);
|
||||
|
@@ -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,Semaphore *wait_sem,Semaphore *complete_sem);
|
||||
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
|
||||
|
@@ -131,7 +131,7 @@ public: // Command Buffer
|
||||
if(!data)
|
||||
return(false);
|
||||
|
||||
return data->queue->Submit(*data->cmd_buf,wait_sem,data->render_complete_semaphore);
|
||||
return data->queue->Submit(data->cmd_buf,wait_sem,data->render_complete_semaphore);
|
||||
}
|
||||
|
||||
bool WaitQueue ()override{return data->queue->WaitQueue();}
|
||||
@@ -238,7 +238,7 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
int AcquireNextImage(); ///<获取下一帧的索引
|
||||
RenderCmdBuffer *AcquireNextImage(); ///<获取下一帧的索引
|
||||
|
||||
bool PresentBackbuffer(); ///<推送后台画面到前台
|
||||
|
||||
|
@@ -10,8 +10,6 @@ class RenderPass;
|
||||
|
||||
GRAPH_MODULE_CLASS(SwapchainModule)
|
||||
{
|
||||
Swapchain * swapchain =nullptr;
|
||||
|
||||
TextureManager * tex_manager =nullptr;
|
||||
RenderTargetManager * rt_manager =nullptr;
|
||||
RenderPassManager * rp_manager =nullptr;
|
||||
@@ -20,12 +18,10 @@ GRAPH_MODULE_CLASS(SwapchainModule)
|
||||
|
||||
SwapchainRenderTarget * sc_render_target=nullptr;
|
||||
|
||||
SwapchainImage * current_sc_image=nullptr;
|
||||
|
||||
protected:
|
||||
|
||||
bool CreateSwapchainFBO();
|
||||
bool CreateSwapchain();
|
||||
bool CreateSwapchainFBO(Swapchain *);
|
||||
Swapchain *CreateSwapchain();
|
||||
bool CreateSwapchainRenderTarget();
|
||||
|
||||
public:
|
||||
|
Reference in New Issue
Block a user