update followed CreateFramebuffer&CreateRenderpass

This commit is contained in:
hyzboy 2020-10-16 19:26:28 +08:00
parent d76de4d623
commit bfec51d0a3
3 changed files with 6 additions and 7 deletions

View File

@ -25,6 +25,7 @@ SET(VK_DEVICE_SOURCE ${RD_INCLUDE_PATH}/VKDevice.h
VKDeviceBuffer.cpp VKDeviceBuffer.cpp
VKDeviceImage.cpp VKDeviceImage.cpp
VKDeviceTexture.cpp VKDeviceTexture.cpp
VKDeviceFramebuffer.cpp
VKDeviceSwapchain.cpp VKDeviceSwapchain.cpp
VKDeviceRenderPass.cpp VKDeviceRenderPass.cpp
VKDeviceRenderTarget.cpp) VKDeviceRenderTarget.cpp)

View File

@ -15,8 +15,8 @@ RenderTarget *Device::CreateRenderTarget( const uint w,const uint h,
const VkImageLayout depth_layout) const VkImageLayout depth_layout)
{ {
if(w<=0||h<=0)return(nullptr); if(w<=0||h<=0)return(nullptr);
if(IsDepthStencilFormat(color_format))return(nullptr);
if(!IsDepthFormat(depth_format))return(nullptr); RenderPass *rp=CreateRenderPass(color_format,depth_format,color_layout,depth_layout); //Renderpass内部会验证格式所以不需要自己处理
if(!CheckTextureFormatSupport(color_format))return(nullptr); if(!CheckTextureFormatSupport(color_format))return(nullptr);
if(!CheckTextureFormatSupport(depth_format))return(nullptr); if(!CheckTextureFormatSupport(depth_format))return(nullptr);
@ -24,9 +24,7 @@ RenderTarget *Device::CreateRenderTarget( const uint w,const uint h,
Texture2D *color_texture=CreateAttachmentTextureColor(color_format,w,h); Texture2D *color_texture=CreateAttachmentTextureColor(color_format,w,h);
Texture2D *depth_texture=CreateAttachmentTextureDepth(depth_format,w,h); Texture2D *depth_texture=CreateAttachmentTextureDepth(depth_format,w,h);
RenderPass *rp=CreateRenderPass(color_format,depth_format,color_layout,depth_layout); Framebuffer *fb=CreateFramebuffer(rp,color_texture->GetImageView(),depth_texture->GetImageView());
Framebuffer *fb=CreateFramebuffer(GetDevice(),rp,color_texture->GetImageView(),depth_texture->GetImageView());
return(CreateRenderTarget(fb)); return(CreateRenderTarget(fb));
} }
@ -83,7 +81,7 @@ RenderTarget *Device::CreateRenderTarget( const uint w,const uint h,
// if(depth_count>0)CreateDepthAttachmentReference(&depth_ref,color_count); // if(depth_count>0)CreateDepthAttachmentReference(&depth_ref,color_count);
// if(color_count>0)CreateColorAttachmentReference(color_ref_list,0,color_count); // if(color_count>0)CreateColorAttachmentReference(color_ref_list,0,color_count);
// //
// CreateAttachment(desc_list,color_format_list,depth_format,VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL); // CreateAttachmentDescription(desc_list,color_format_list,depth_format,VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
// //
// VkSubpassDescription sd; // VkSubpassDescription sd;
// //

View File

@ -124,7 +124,7 @@ SwapchainRenderTarget::SwapchainRenderTarget(Device *dev,Swapchain *sc):RenderTa
for(uint i=0;i<swap_chain_count;i++) for(uint i=0;i<swap_chain_count;i++)
{ {
render_frame.Add(vulkan::CreateFramebuffer(device->GetDevice(),main_rp,(*sc_color)->GetImageView(),sc_depth->GetImageView())); render_frame.Add(device->CreateFramebuffer(main_rp,(*sc_color)->GetImageView(),sc_depth->GetImageView()));
++sc_color; ++sc_color;
} }