ULRE/src/RenderDevice/Vulkan/VKFramebuffer.cpp

36 lines
834 B
C++
Raw Normal View History

#include<hgl/graph/vulkan/VKFramebuffer.h>
#include<hgl/graph/vulkan/VKDevice.h>
#include<hgl/graph/vulkan/VKImageView.h>
#include<hgl/graph/vulkan/VKRenderPass.h>
#include<hgl/graph/vulkan/VKTexture.h>
2019-06-19 17:25:23 +08:00
#include<hgl/type/Smart.h>
2019-04-18 21:42:22 +08:00
VK_NAMESPACE_BEGIN
Framebuffer::Framebuffer(VkDevice dev,VkFramebuffer fb,VkFramebufferCreateInfo *fb_create_info,bool depth)
{
device=dev;
frame_buffer=fb;
fb_info=fb_create_info;
extent.width=fb_info->width;
extent.height=fb_info->height;
has_depth=depth;
if(has_depth)
color_count=fb_info->attachmentCount-1;
else
color_count=fb_info->attachmentCount;
depth_texture=nullptr;
}
2019-04-18 21:42:22 +08:00
Framebuffer::~Framebuffer()
{
SAFE_CLEAR(depth_texture);
color_texture.Clear();
2019-04-18 21:42:22 +08:00
vkDestroyFramebuffer(device,frame_buffer,nullptr);
}
VK_NAMESPACE_END