ColorTextures and Framebuffer use arrays at RenderTarget class.
This commit is contained in:
parent
6c869916df
commit
377fb5718d
@ -23,7 +23,8 @@ protected:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
ObjectList<Texture2D> color_texture;
|
uint32_t color_count;
|
||||||
|
Texture2D **color_textures;
|
||||||
Texture2D *depth_texture;
|
Texture2D *depth_texture;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -44,7 +45,7 @@ public:
|
|||||||
virtual const uint32_t GetColorCount ()const {return fb->GetColorCount();}
|
virtual const uint32_t GetColorCount ()const {return fb->GetColorCount();}
|
||||||
virtual const VkFramebuffer GetFramebuffer ()const {return fb->GetFramebuffer();}
|
virtual const VkFramebuffer GetFramebuffer ()const {return fb->GetFramebuffer();}
|
||||||
|
|
||||||
virtual Texture2D * GetColorTexture (const int index=0){return color_texture[index];}
|
virtual Texture2D * GetColorTexture (const int index=0){return color_textures[index];}
|
||||||
virtual Texture2D * GetDepthTexture (){return depth_texture;}
|
virtual Texture2D * GetDepthTexture (){return depth_texture;}
|
||||||
|
|
||||||
virtual bool Submit (GPUSemaphore *present_complete_semaphore=nullptr);
|
virtual bool Submit (GPUSemaphore *present_complete_semaphore=nullptr);
|
||||||
@ -66,7 +67,7 @@ class SwapchainRenderTarget:public RenderTarget
|
|||||||
uint32_t swap_chain_count;
|
uint32_t swap_chain_count;
|
||||||
|
|
||||||
uint32_t current_frame;
|
uint32_t current_frame;
|
||||||
ObjectList<Framebuffer> render_frame;
|
Framebuffer **render_frame;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -15,6 +15,12 @@ RenderTarget::RenderTarget(Device *dev,Framebuffer *_fb,CommandBuffer *_cb,const
|
|||||||
fb=_fb;
|
fb=_fb;
|
||||||
command_buffer=_cb;
|
command_buffer=_cb;
|
||||||
|
|
||||||
|
if(fb)
|
||||||
|
color_count=fb->GetColorCount();
|
||||||
|
else
|
||||||
|
color_count=0;
|
||||||
|
|
||||||
|
color_textures=nullptr;
|
||||||
depth_texture=nullptr;
|
depth_texture=nullptr;
|
||||||
render_complete_semaphore=dev->CreateSemaphore();
|
render_complete_semaphore=dev->CreateSemaphore();
|
||||||
}
|
}
|
||||||
@ -24,7 +30,17 @@ RenderTarget::RenderTarget(Device *dev,Framebuffer *_fb,CommandBuffer *_cb,Textu
|
|||||||
fb=_fb;
|
fb=_fb;
|
||||||
command_buffer=_cb;
|
command_buffer=_cb;
|
||||||
|
|
||||||
color_texture.Add(ctl,cc);
|
color_count=cc;
|
||||||
|
if(color_count>0)
|
||||||
|
{
|
||||||
|
color_textures=new Texture2D *[color_count];
|
||||||
|
hgl_cpy<Texture2D *>(color_textures,ctl,color_count);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
color_textures=nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
depth_texture=dt;
|
depth_texture=dt;
|
||||||
render_complete_semaphore=dev->CreateSemaphore();
|
render_complete_semaphore=dev->CreateSemaphore();
|
||||||
}
|
}
|
||||||
@ -32,7 +48,7 @@ RenderTarget::RenderTarget(Device *dev,Framebuffer *_fb,CommandBuffer *_cb,Textu
|
|||||||
RenderTarget::~RenderTarget()
|
RenderTarget::~RenderTarget()
|
||||||
{
|
{
|
||||||
SAFE_CLEAR(depth_texture);
|
SAFE_CLEAR(depth_texture);
|
||||||
color_texture.Clear();
|
SAFE_CLEAR_OBJECT_ARRAY(color_textures,color_count);
|
||||||
|
|
||||||
SAFE_CLEAR(render_complete_semaphore);
|
SAFE_CLEAR(render_complete_semaphore);
|
||||||
SAFE_CLEAR(command_buffer);
|
SAFE_CLEAR(command_buffer);
|
||||||
@ -63,9 +79,11 @@ SwapchainRenderTarget::SwapchainRenderTarget(Device *dev,Swapchain *sc):RenderTa
|
|||||||
|
|
||||||
extent=swapchain->GetExtent();
|
extent=swapchain->GetExtent();
|
||||||
|
|
||||||
|
render_frame=new Framebuffer *[swap_chain_count];
|
||||||
|
|
||||||
for(uint i=0;i<swap_chain_count;i++)
|
for(uint i=0;i<swap_chain_count;i++)
|
||||||
{
|
{
|
||||||
render_frame.Add(device->CreateFramebuffer(main_rp,(*sc_color)->GetImageView(),sc_depth->GetImageView()));
|
render_frame[i]=device->CreateFramebuffer(main_rp,(*sc_color)->GetImageView(),sc_depth->GetImageView());
|
||||||
++sc_color;
|
++sc_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +94,7 @@ SwapchainRenderTarget::SwapchainRenderTarget(Device *dev,Swapchain *sc):RenderTa
|
|||||||
|
|
||||||
SwapchainRenderTarget::~SwapchainRenderTarget()
|
SwapchainRenderTarget::~SwapchainRenderTarget()
|
||||||
{
|
{
|
||||||
render_frame.Clear();
|
SAFE_CLEAR_OBJECT_ARRAY(render_frame,swap_chain_count);
|
||||||
|
|
||||||
delete present_complete_semaphore;
|
delete present_complete_semaphore;
|
||||||
delete main_rp;
|
delete main_rp;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user