moved few codes to SwapchainModule

This commit is contained in:
2024-11-09 00:10:27 +08:00
parent 75fb0dd672
commit 336688b4f0
5 changed files with 95 additions and 202 deletions

View File

@@ -40,10 +40,6 @@ private:
DeviceRenderPassManage *render_pass_manage;
RenderPass *device_render_pass;
RTSwapchain *sc_rt;
RTSwapchain *CreateSwapchainRenderTarget();
void InitRenderPassManage();
void ClearRenderPassManage();
@@ -77,10 +73,6 @@ public:
RenderPass * GetRenderPass () {return device_render_pass;}
RTSwapchain * GetSwapchainRT () {return sc_rt;}
const VkExtent2D & GetSwapchainSize ()const {return sc_rt->GetExtent();}
void WaitIdle ()const {vkDeviceWaitIdle(attr->device);}
DebugUtils * GetDebugUtils (){return attr->debug_utils;}
@@ -182,18 +174,6 @@ public:
Semaphore * CreateGPUSemaphore();
DeviceQueue *CreateQueue(const uint32_t fence_count=1,const bool create_signaled=false);
public: //FrameBuffer相关
Framebuffer *CreateFBO(RenderPass *rp,ImageView **color_list,const uint color_count,ImageView *depth);
// Framebuffer *CreateFBO(RenderPass *,List<ImageView *> &color,ImageView *depth);
Framebuffer *CreateFBO(RenderPass *,ImageView *color,ImageView *depth);
Framebuffer *CreateFBO(RenderPass *,ImageView *);
public:
RenderTarget *CreateRT( const FramebufferInfo *fbi,RenderPass *,const uint32_t fence_count=1);
RenderTarget *CreateRT( const FramebufferInfo *fbi,const uint32_t fence_count=1);
};//class GPUDevice
VK_NAMESPACE_END
#endif//HGL_GRAPH_VULKAN_DEVICE_INCLUDE

View File

@@ -11,8 +11,6 @@ public:
VkDevice device =VK_NULL_HANDLE;
VkExtent2D extent;
VkSwapchainKHR swap_chain =VK_NULL_HANDLE;
uint32_t color_count =0;

View File

@@ -10,18 +10,25 @@ class SwapchainModule:public GraphModule
RTSwapchain *swapchain_rt=nullptr;
private:
protected:
bool CreateSwapchain();
bool CreateSwapchainRenderTarget();
bool CreateSwapchainFBO(Swapchain *);
Swapchain *CreateSwapchain(const VkExtent2D &acquire_extent);
public:
GRAPH_MODULE_CONSTRUCT(Swapchain)
GRAPH_MODULE_CONSTRUCT(SwapchainModule)
virtual ~SwapchainModule()=default;
bool Init() override;
};//class SwapchainModule:public RenderModule
RTSwapchain * GetRenderTarget () {return swapchain_rt;}
const VkExtent2D & GetSwapchainSize()const {return swapchain_rt->GetExtent();}
};//class SwapchainModule:public GraphModule
VK_NAMESPACE_END