removed render_pass from RenderTarget, use RenderTarget::fbo->render_pass

This commit is contained in:
hyzboy 2025-01-26 12:12:13 +08:00
parent 99f833ef42
commit e24286a87f
2 changed files with 15 additions and 17 deletions

View File

@ -36,7 +36,6 @@ protected:
DeviceQueue *queue; DeviceQueue *queue;
RenderPass *render_pass;
Framebuffer *fbo; Framebuffer *fbo;
VkExtent2D extent; VkExtent2D extent;
@ -55,7 +54,7 @@ protected:
friend class RenderTargetManager; friend class RenderTargetManager;
RenderTarget(DeviceQueue *,Semaphore *); 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: public:
@ -63,9 +62,8 @@ public:
DeviceQueue * GetQueue () {return queue;} DeviceQueue * GetQueue () {return queue;}
const VkExtent2D & GetExtent ()const {return extent;} const VkExtent2D & GetExtent ()const {return extent;}
virtual RenderPass * GetRenderPass () {return render_pass;} virtual const VkRenderPass GetVkRenderPass ()const {return fbo->GetRenderPass();}
virtual const VkRenderPass GetVkRenderPass ()const {return render_pass->GetVkRenderPass();} virtual uint32_t GetColorCount ()const {return fbo->GetColorCount();}
virtual const uint32_t GetColorCount ()const {return fbo->GetColorCount();}
virtual Framebuffer * GetFramebuffer () {return fbo;} virtual Framebuffer * GetFramebuffer () {return fbo;}
virtual Texture2D * GetColorTexture (const int index=0){return color_textures[index];} virtual Texture2D * GetColorTexture (const int index=0){return color_textures[index];}
@ -98,19 +96,21 @@ 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,RenderPass *rp);
~RTSwapchain(); ~RTSwapchain();
Framebuffer * GetFramebuffer ()override {return swapchain->sc_image[current_frame].fbo;} uint32_t GetColorCount ()const override {return 1;}
Framebuffer * GetFramebuffer (const uint32_t index) {return swapchain->sc_image[index].fbo;} uint32_t GetImageCount ()const {return swapchain->image_count;}
uint32_t GetCurrentFrameIndices ()const {return current_frame;}
const uint32_t GetColorCount ()const override {return 1;} Framebuffer * GetFramebuffer ()override {return swapchain->sc_image[current_frame].fbo;}
const uint32_t GetImageCount ()const {return swapchain->image_count;} 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 * GetColorTexture (const int index=0) override{return swapchain->sc_image[current_frame].color;}
virtual Texture2D * GetDepthTexture () override{return swapchain->sc_image[current_frame].depth;} virtual Texture2D * GetDepthTexture () override{return swapchain->sc_image[current_frame].depth;}
RenderCmdBuffer * GetRenderCmdBuffer (int index) {return swapchain->sc_image[index].cmd_buf;}
public: public:
const uint32_t GetCurrentFrameIndices ()const {return current_frame;} Semaphore * GetPresentSemaphore () {return present_complete_semaphore;}
Semaphore * GetPresentCompleteSemaphore () {return present_complete_semaphore;}
public: public:

View File

@ -9,7 +9,6 @@ VK_NAMESPACE_BEGIN
RenderTarget::RenderTarget(DeviceQueue *q,Semaphore *s) RenderTarget::RenderTarget(DeviceQueue *q,Semaphore *s)
{ {
queue=q; queue=q;
render_pass=nullptr;
fbo=nullptr; fbo=nullptr;
color_count=0; color_count=0;
@ -18,10 +17,9 @@ RenderTarget::RenderTarget(DeviceQueue *q,Semaphore *s)
render_complete_semaphore=s; render_complete_semaphore=s;
} }
RenderTarget::RenderTarget(DeviceQueue *q,Semaphore *s,RenderPass *_rp,Framebuffer *_fb,Texture2D **ctl,const uint32_t cc,Texture2D *dt) RenderTarget::RenderTarget(DeviceQueue *q,Semaphore *s,Framebuffer *_fb,Texture2D **ctl,const uint32_t cc,Texture2D *dt)
{ {
queue=q; queue=q;
render_pass=_rp;
fbo=_fb; fbo=_fb;
depth_texture=dt; depth_texture=dt;