remove main_rp value of SwapchainRenderTarget
This commit is contained in:
parent
b4c385c40c
commit
40d91b5992
@ -14,8 +14,8 @@ class RenderTarget:public GPUQueue
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
RenderPass *rp;
|
RenderPass *render_pass;
|
||||||
Framebuffer *fb;
|
Framebuffer *fbo;
|
||||||
|
|
||||||
VkExtent2D extent;
|
VkExtent2D extent;
|
||||||
|
|
||||||
@ -40,15 +40,17 @@ public:
|
|||||||
virtual ~RenderTarget();
|
virtual ~RenderTarget();
|
||||||
|
|
||||||
const VkExtent2D & GetExtent ()const {return extent;}
|
const VkExtent2D & GetExtent ()const {return extent;}
|
||||||
GPUSemaphore * GetCompleteSemaphore(){return render_complete_semaphore;}
|
virtual const VkRenderPass GetRenderPass ()const {return *render_pass;}
|
||||||
GPUCmdBuffer * GetCommandBuffer () {return command_buffer;}
|
virtual const uint32_t GetColorCount ()const {return fbo->GetColorCount();}
|
||||||
virtual const VkRenderPass GetRenderPass ()const {return fb->GetRenderPass();}
|
virtual const VkFramebuffer GetFramebuffer ()const {return fbo->GetFramebuffer();}
|
||||||
virtual const uint32_t GetColorCount ()const {return fb->GetColorCount();}
|
|
||||||
virtual const VkFramebuffer GetFramebuffer ()const {return fb->GetFramebuffer();}
|
|
||||||
|
|
||||||
virtual Texture2D * GetColorTexture (const int index=0){return color_textures[index];}
|
virtual Texture2D * GetColorTexture (const int index=0){return color_textures[index];}
|
||||||
virtual Texture2D * GetDepthTexture (){return depth_texture;}
|
virtual Texture2D * GetDepthTexture (){return depth_texture;}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
GPUSemaphore * GetRenderCompleteSemaphore (){return render_complete_semaphore;}
|
||||||
|
GPUCmdBuffer * GetCommandBuffer (){return command_buffer;}
|
||||||
virtual bool Submit (GPUSemaphore *present_complete_semaphore=nullptr);
|
virtual bool Submit (GPUSemaphore *present_complete_semaphore=nullptr);
|
||||||
};//class RenderTarget
|
};//class RenderTarget
|
||||||
|
|
||||||
@ -63,8 +65,6 @@ class SwapchainRenderTarget:public RenderTarget
|
|||||||
|
|
||||||
GPUSemaphore *present_complete_semaphore=nullptr;
|
GPUSemaphore *present_complete_semaphore=nullptr;
|
||||||
|
|
||||||
RenderPass *main_rp=nullptr;
|
|
||||||
|
|
||||||
uint32_t swap_chain_count;
|
uint32_t swap_chain_count;
|
||||||
|
|
||||||
uint32_t current_frame;
|
uint32_t current_frame;
|
||||||
@ -75,19 +75,20 @@ public:
|
|||||||
SwapchainRenderTarget(GPUDevice *dev,Swapchain *sc);
|
SwapchainRenderTarget(GPUDevice *dev,Swapchain *sc);
|
||||||
~SwapchainRenderTarget();
|
~SwapchainRenderTarget();
|
||||||
|
|
||||||
const VkRenderPass GetRenderPass ()const override {return *main_rp;}
|
|
||||||
const VkFramebuffer GetFramebuffer ()const override {return render_frame[current_frame]->GetFramebuffer();}
|
const VkFramebuffer GetFramebuffer ()const override {return render_frame[current_frame]->GetFramebuffer();}
|
||||||
VkFramebuffer GetFramebuffer (const uint32_t index) {return render_frame[index]->GetFramebuffer();}
|
VkFramebuffer GetFramebuffer (const uint32_t index) {return render_frame[index]->GetFramebuffer();}
|
||||||
|
|
||||||
const uint32_t GetColorCount ()const override {return 1;}
|
const uint32_t GetColorCount ()const override {return 1;}
|
||||||
const uint32_t GetImageCount ()const {return swap_chain_count;}
|
const uint32_t GetImageCount ()const {return swap_chain_count;}
|
||||||
|
|
||||||
const uint32_t GetCurrentFrameIndices()const{return current_frame;}
|
|
||||||
GPUSemaphore * GetPresentCompleteSemaphore(){return present_complete_semaphore;}
|
|
||||||
|
|
||||||
virtual Texture2D * GetColorTexture (const int index=0) override{return swapchain->GetColorTexture(index);}
|
virtual Texture2D * GetColorTexture (const int index=0) override{return swapchain->GetColorTexture(index);}
|
||||||
virtual Texture2D * GetDepthTexture () override{return swapchain->GetDepthTexture();}
|
virtual Texture2D * GetDepthTexture () override{return swapchain->GetDepthTexture();}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
const uint32_t GetCurrentFrameIndices ()const {return current_frame;}
|
||||||
|
GPUSemaphore * GetPresentCompleteSemaphore () {return present_complete_semaphore;}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,12 +7,12 @@
|
|||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
RenderTarget::RenderTarget(GPUDevice *dev,Framebuffer *_fb,GPUCmdBuffer *_cb,const uint32_t fence_count):GPUQueue(dev,dev->GetGraphicsQueue(),fence_count)
|
RenderTarget::RenderTarget(GPUDevice *dev,Framebuffer *_fb,GPUCmdBuffer *_cb,const uint32_t fence_count):GPUQueue(dev,dev->GetGraphicsQueue(),fence_count)
|
||||||
{
|
{
|
||||||
rp=nullptr;
|
render_pass=nullptr;
|
||||||
fb=_fb;
|
fbo=_fb;
|
||||||
command_buffer=_cb;
|
command_buffer=_cb;
|
||||||
|
|
||||||
if(fb)
|
if(fbo)
|
||||||
color_count=fb->GetColorCount();
|
color_count=fbo->GetColorCount();
|
||||||
else
|
else
|
||||||
color_count=0;
|
color_count=0;
|
||||||
|
|
||||||
@ -23,8 +23,8 @@ RenderTarget::RenderTarget(GPUDevice *dev,Framebuffer *_fb,GPUCmdBuffer *_cb,con
|
|||||||
|
|
||||||
RenderTarget::RenderTarget(GPUDevice *dev,RenderPass *_rp,Framebuffer *_fb,GPUCmdBuffer *_cb,Texture2D **ctl,const uint32_t cc,Texture2D *dt,const uint32_t fence_count):GPUQueue(dev,dev->GetGraphicsQueue(),fence_count)
|
RenderTarget::RenderTarget(GPUDevice *dev,RenderPass *_rp,Framebuffer *_fb,GPUCmdBuffer *_cb,Texture2D **ctl,const uint32_t cc,Texture2D *dt,const uint32_t fence_count):GPUQueue(dev,dev->GetGraphicsQueue(),fence_count)
|
||||||
{
|
{
|
||||||
rp=_rp;
|
render_pass=_rp;
|
||||||
fb=_fb;
|
fbo=_fb;
|
||||||
command_buffer=_cb;
|
command_buffer=_cb;
|
||||||
|
|
||||||
depth_texture=dt;
|
depth_texture=dt;
|
||||||
@ -59,8 +59,8 @@ RenderTarget::~RenderTarget()
|
|||||||
|
|
||||||
SAFE_CLEAR(render_complete_semaphore);
|
SAFE_CLEAR(render_complete_semaphore);
|
||||||
SAFE_CLEAR(command_buffer);
|
SAFE_CLEAR(command_buffer);
|
||||||
SAFE_CLEAR(fb);
|
SAFE_CLEAR(fbo);
|
||||||
SAFE_CLEAR(rp);
|
SAFE_CLEAR(render_pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderTarget::Submit(GPUSemaphore *present_complete_semaphore)
|
bool RenderTarget::Submit(GPUSemaphore *present_complete_semaphore)
|
||||||
@ -82,7 +82,7 @@ SwapchainRenderTarget::SwapchainRenderTarget(GPUDevice *dev,Swapchain *sc):Rende
|
|||||||
Texture2D **sc_color=swapchain->GetColorTextures();
|
Texture2D **sc_color=swapchain->GetColorTextures();
|
||||||
Texture2D *sc_depth=swapchain->GetDepthTexture();
|
Texture2D *sc_depth=swapchain->GetDepthTexture();
|
||||||
|
|
||||||
main_rp=device->CreateRenderPass((*sc_color)->GetFormat(),sc_depth->GetFormat(),VK_IMAGE_LAYOUT_PRESENT_SRC_KHR,VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
|
this->render_pass=device->CreateRenderPass((*sc_color)->GetFormat(),sc_depth->GetFormat(),VK_IMAGE_LAYOUT_PRESENT_SRC_KHR,VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
|
||||||
|
|
||||||
swap_chain_count=swapchain->GetImageCount();
|
swap_chain_count=swapchain->GetImageCount();
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ SwapchainRenderTarget::SwapchainRenderTarget(GPUDevice *dev,Swapchain *sc):Rende
|
|||||||
|
|
||||||
for(uint i=0;i<swap_chain_count;i++)
|
for(uint i=0;i<swap_chain_count;i++)
|
||||||
{
|
{
|
||||||
render_frame[i]=device->CreateFramebuffer(main_rp,(*sc_color)->GetImageView(),sc_depth->GetImageView());
|
render_frame[i]=device->CreateFramebuffer(this->render_pass,(*sc_color)->GetImageView(),sc_depth->GetImageView());
|
||||||
++sc_color;
|
++sc_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,6 @@ SwapchainRenderTarget::~SwapchainRenderTarget()
|
|||||||
SAFE_CLEAR_OBJECT_ARRAY(render_frame,swap_chain_count);
|
SAFE_CLEAR_OBJECT_ARRAY(render_frame,swap_chain_count);
|
||||||
|
|
||||||
delete present_complete_semaphore;
|
delete present_complete_semaphore;
|
||||||
delete main_rp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SwapchainRenderTarget::AcquireNextImage()
|
int SwapchainRenderTarget::AcquireNextImage()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user