From 834b737e1a2c15dd8e1490f8add65b91d7255cfe Mon Sep 17 00:00:00 2001 From: hyzboy Date: Sat, 17 Oct 2020 16:25:59 +0800 Subject: [PATCH] fix a bug, it don't check the Texture before get extent --- src/RenderDevice/Vulkan/VKDeviceFramebuffer.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/RenderDevice/Vulkan/VKDeviceFramebuffer.cpp b/src/RenderDevice/Vulkan/VKDeviceFramebuffer.cpp index 23c2345b..2a7b6120 100644 --- a/src/RenderDevice/Vulkan/VKDeviceFramebuffer.cpp +++ b/src/RenderDevice/Vulkan/VKDeviceFramebuffer.cpp @@ -41,13 +41,16 @@ Framebuffer *Device::CreateFramebuffer(RenderPass *rp,ImageView **color_list,con if(*cf!=(*iv)->GetFormat()) return(nullptr); - attachments[i]=**iv; + *ap=**iv; + ++ap; ++cf; ++iv; } } + VkExtent2D extent; + if(depth) { if(rp->GetDepthFormat()!=depth->GetFormat()) @@ -57,11 +60,15 @@ Framebuffer *Device::CreateFramebuffer(RenderPass *rp,ImageView **color_list,con } attachments[color_count]=*depth; - } - VkExtent2D extent; - extent.width=depth->GetExtent().width; - extent.height=depth->GetExtent().height; + extent.width=depth->GetExtent().width; + extent.height=depth->GetExtent().height; + } + else + { + extent.width=color_list[0]->GetExtent().width; + extent.height=color_list[0]->GetExtent().height; + } VkFramebuffer fbo=CreateVulkanFramebuffer(GetDevice(),rp,extent,attachments,att_count);