From cf11ce6054e062f63159fb64a9755c7d2e3a432a Mon Sep 17 00:00:00 2001 From: hyzboy Date: Sat, 17 Oct 2020 14:18:09 +0800 Subject: [PATCH] Freambuffer deleted VKFramebufferCreateInfo data; --- inc/hgl/graph/vulkan/VKFramebuffer.h | 15 +++++---------- src/RenderDevice/Vulkan/VKFramebuffer.cpp | 21 ++++++++------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/inc/hgl/graph/vulkan/VKFramebuffer.h b/inc/hgl/graph/vulkan/VKFramebuffer.h index be4aca5a..5037460d 100644 --- a/inc/hgl/graph/vulkan/VKFramebuffer.h +++ b/inc/hgl/graph/vulkan/VKFramebuffer.h @@ -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 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 diff --git a/src/RenderDevice/Vulkan/VKFramebuffer.cpp b/src/RenderDevice/Vulkan/VKFramebuffer.cpp index 299feb44..15967925 100644 --- a/src/RenderDevice/Vulkan/VKFramebuffer.cpp +++ b/src/RenderDevice/Vulkan/VKFramebuffer.cpp @@ -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