Freambuffer deleted VKFramebufferCreateInfo data;
This commit is contained in:
parent
bfa7cf50e1
commit
cf11ce6054
@ -7,36 +7,31 @@ class Framebuffer
|
||||
{
|
||||
VkDevice device;
|
||||
VkFramebuffer frame_buffer;
|
||||
VkFramebufferCreateInfo *fb_info;
|
||||
VkRenderPass render_pass;
|
||||
|
||||
VkExtent2D extent;
|
||||
uint32_t attachment_count;
|
||||
uint32_t color_count;
|
||||
bool has_depth;
|
||||
|
||||
ObjectList<Texture2D> color_texture;
|
||||
Texture2D *depth_texture;
|
||||
|
||||
private:
|
||||
|
||||
friend class Device;
|
||||
|
||||
Framebuffer(VkDevice dev,VkFramebuffer fb,VkFramebufferCreateInfo *fb_create_info,bool depth);
|
||||
Framebuffer(VkDevice,VkFramebuffer,const VkExtent2D &,VkRenderPass,uint32_t color_count,bool depth);
|
||||
|
||||
public:
|
||||
|
||||
~Framebuffer();
|
||||
|
||||
const VkFramebuffer GetFramebuffer ()const{return frame_buffer;}
|
||||
const VkRenderPass GetRenderPass ()const{return fb_info->renderPass;}
|
||||
const VkRenderPass GetRenderPass ()const{return render_pass;}
|
||||
|
||||
const VkExtent2D & GetExtent ()const{return extent;}
|
||||
|
||||
const uint32_t GetAttachmentCount ()const{return fb_info->attachmentCount;} ///<获取渲染目标成分数量
|
||||
const uint32_t GetAttachmentCount ()const{return attachment_count;} ///<获取渲染目标成分数量
|
||||
const uint32_t GetColorCount ()const{return color_count;} ///<取得颜色成分数量
|
||||
const bool HasDepth ()const{return has_depth;} ///<是否包含深度成分
|
||||
|
||||
Texture2D * GetColorTexture (const int index=0){return color_texture[index];}
|
||||
Texture2D * GetDepthTexture (){return depth_texture;}
|
||||
};//class Framebuffer
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_VULKAN_FRAMEBUFFER_INCLUDE
|
||||
|
@ -7,29 +7,24 @@
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
Framebuffer::Framebuffer(VkDevice dev,VkFramebuffer fb,VkFramebufferCreateInfo *fb_create_info,bool depth)
|
||||
Framebuffer::Framebuffer(VkDevice dev,VkFramebuffer fb,const VkExtent2D &ext,VkRenderPass rp,uint32_t cc,bool depth)
|
||||
{
|
||||
device=dev;
|
||||
frame_buffer=fb;
|
||||
fb_info=fb_create_info;
|
||||
|
||||
extent.width=fb_info->width;
|
||||
extent.height=fb_info->height;
|
||||
render_pass=rp;
|
||||
|
||||
extent=ext;
|
||||
color_count=cc;
|
||||
has_depth=depth;
|
||||
if(has_depth)
|
||||
color_count=fb_info->attachmentCount-1;
|
||||
else
|
||||
color_count=fb_info->attachmentCount;
|
||||
|
||||
depth_texture=nullptr;
|
||||
attachment_count=color_count;
|
||||
|
||||
if(has_depth)
|
||||
++attachment_count;
|
||||
}
|
||||
|
||||
Framebuffer::~Framebuffer()
|
||||
{
|
||||
SAFE_CLEAR(depth_texture);
|
||||
color_texture.Clear();
|
||||
|
||||
vkDestroyFramebuffer(device,frame_buffer,nullptr);
|
||||
}
|
||||
VK_NAMESPACE_END
|
||||
|
Loading…
x
Reference in New Issue
Block a user