optimized RenderCmdBuffer::BindFramebuffer

This commit is contained in:
2025-01-26 12:32:24 +08:00
parent 39aa63aa0a
commit 02ac76e5bd
14 changed files with 56 additions and 73 deletions

View File

@@ -17,7 +17,6 @@ protected:
DeviceQueue *queue;
RenderPass *render_pass;
Framebuffer *fbo;
VkExtent2D extent;
@@ -35,7 +34,7 @@ protected:
friend class GPUDevice;
RenderTarget(DeviceQueue *,Semaphore *);
RenderTarget(DeviceQueue *,Semaphore *,RenderPass *_rp,Framebuffer *_fb,Texture2D **color_texture_list,const uint32_t color_count,Texture2D *depth_texture);
RenderTarget(DeviceQueue *,Semaphore *,Framebuffer *_fb,Texture2D **color_texture_list,const uint32_t color_count,Texture2D *depth_texture);
public:
@@ -43,14 +42,12 @@ public:
DeviceQueue * GetQueue () {return queue;}
const VkExtent2D & GetExtent ()const {return extent;}
virtual RenderPass * GetRenderPass () {return render_pass;}
virtual const VkRenderPass GetVkRenderPass ()const {return render_pass->GetVkRenderPass();}
virtual const uint32_t GetColorCount ()const {return fbo->GetColorCount();}
virtual RenderPass * GetRenderPass () {return GetFramebuffer()->GetRenderPass();}
virtual uint32_t GetColorCount () {return GetFramebuffer()->GetColorCount();}
virtual Framebuffer * GetFramebuffer () {return fbo;}
virtual Texture2D * GetColorTexture (const int index=0){return color_textures[index];}
virtual Texture2D * GetDepthTexture (){return depth_texture;}
virtual Texture2D * GetDepthTexture () {return depth_texture;}
public: // command buffer
@@ -76,27 +73,24 @@ class RTSwapchain:public RenderTarget
public:
RTSwapchain(VkDevice dev,Swapchain *sc,DeviceQueue *q,Semaphore *rcs,Semaphore *pcs,RenderPass *rp);
RTSwapchain(VkDevice dev,Swapchain *sc,DeviceQueue *q,Semaphore *rcs,Semaphore *pcs);
~RTSwapchain();
uint32_t GetColorCount () override {return 1;}
uint32_t GetImageCount ()const {return swapchain->image_count;}
uint32_t GetCurrentFrameIndices ()const {return current_frame;}
const uint32_t GetColorCount ()const override {return 1;} ///Swapchain的FBO颜色成份只有一个
const uint32_t GetImageCount ()const {return swapchain->image_count;}
Framebuffer * GetFramebuffer ()override {return swapchain->sc_image[current_frame].fbo;}
Framebuffer * GetFramebuffer (int index) {return swapchain->sc_image[index].fbo;}
virtual Texture2D * GetColorTexture (const int index=0) override{return swapchain->sc_image[current_frame].color;}
virtual Texture2D * GetDepthTexture () override{return swapchain->sc_image[current_frame].depth;}
Framebuffer * GetFramebuffer ()override {return swapchain->sc_image[current_frame].fbo;}
Framebuffer * GetFramebuffer (const int index) {return swapchain->sc_image[index].fbo;}
virtual Texture2D * GetColorTexture (const int index=0) override{return swapchain->sc_image[current_frame].color;}
virtual Texture2D * GetDepthTexture () override{return swapchain->sc_image[current_frame].depth;}
RenderCmdBuffer *GetRenderCmdBuffer(const int index)
{
return swapchain->sc_image[index].cmd_buf;
}
RenderCmdBuffer * GetRenderCmdBuffer (int index) {return swapchain->sc_image[index].cmd_buf;}
public:
const uint32_t GetCurrentFrameIndices ()const {return current_frame;}
Semaphore * GetPresentCompleteSemaphore () {return present_complete_semaphore;}
Semaphore * GetPresentSemaphore () {return present_complete_semaphore;}
public: