renamed to sc_fbo from render_frame

This commit is contained in:
hyzboy 2023-05-11 00:55:44 +08:00
parent e1cfc1e5b8
commit a97440e1fc
No known key found for this signature in database
GPG Key ID: 067EE4525D4FB6D3
4 changed files with 11 additions and 11 deletions

View File

@ -78,8 +78,8 @@ public:
SwapchainRenderTarget(VkDevice dev,Swapchain *sc,DeviceQueue *q,Semaphore *rcs,Semaphore *pcs,RenderPass *rp); SwapchainRenderTarget(VkDevice dev,Swapchain *sc,DeviceQueue *q,Semaphore *rcs,Semaphore *pcs,RenderPass *rp);
~SwapchainRenderTarget(); ~SwapchainRenderTarget();
Framebuffer * GetFramebuffer ()override {return swapchain->render_frame[current_frame];} Framebuffer * GetFramebuffer ()override {return swapchain->sc_fbo[current_frame];}
Framebuffer * GetFramebuffer (const uint32_t index) {return swapchain->render_frame[index];} Framebuffer * GetFramebuffer (const uint32_t index) {return swapchain->sc_fbo[index];}
const uint32_t GetColorCount ()const override {return 1;} const uint32_t GetColorCount ()const override {return 1;}
const uint32_t GetImageCount ()const {return swapchain->color_count;} const uint32_t GetImageCount ()const {return swapchain->color_count;}

View File

@ -15,12 +15,12 @@ public:
VkSwapchainKHR swap_chain =VK_NULL_HANDLE; VkSwapchainKHR swap_chain =VK_NULL_HANDLE;
uint32_t color_count=0; uint32_t color_count =0;
Texture2D ** sc_color =nullptr; Texture2D ** sc_color =nullptr;
Texture2D * sc_depth =nullptr; Texture2D * sc_depth =nullptr;
Framebuffer ** render_frame =nullptr; Framebuffer ** sc_fbo =nullptr;
public: public:

View File

@ -78,13 +78,13 @@ bool GPUDevice::CreateSwapchainFBO(Swapchain *swapchain)
if(vkGetSwapchainImagesKHR(attr->device,swapchain->swap_chain,&(swapchain->color_count),sc_images)!=VK_SUCCESS) if(vkGetSwapchainImagesKHR(attr->device,swapchain->swap_chain,&(swapchain->color_count),sc_images)!=VK_SUCCESS)
return(false); return(false);
swapchain->sc_depth =CreateTexture2D(new SwapchainDepthTextureCreateInfo(attr->physical_device->GetDepthFormat(),swapchain->extent)); swapchain->sc_depth =CreateTexture2D(new SwapchainDepthTextureCreateInfo(attr->physical_device->GetDepthFormat(),swapchain->extent));
if(!swapchain->sc_depth) if(!swapchain->sc_depth)
return(false); return(false);
swapchain->sc_color =hgl_zero_new<Texture2D *>(swapchain->color_count); swapchain->sc_color =hgl_zero_new<Texture2D *>(swapchain->color_count);
swapchain->render_frame =hgl_zero_new<Framebuffer *>(swapchain->color_count); swapchain->sc_fbo =hgl_zero_new<Framebuffer *>(swapchain->color_count);
for(uint32_t i=0;i<swapchain->color_count;i++) for(uint32_t i=0;i<swapchain->color_count;i++)
{ {
@ -93,9 +93,9 @@ bool GPUDevice::CreateSwapchainFBO(Swapchain *swapchain)
if(!swapchain->sc_color[i]) if(!swapchain->sc_color[i])
return(false); return(false);
swapchain->render_frame[i]=CreateFBO( device_render_pass, swapchain->sc_fbo[i]=CreateFBO( device_render_pass,
swapchain->sc_color[i]->GetImageView(), swapchain->sc_color[i]->GetImageView(),
swapchain->sc_depth->GetImageView()); swapchain->sc_depth->GetImageView());
} }
return(true); return(true);

View File

@ -4,7 +4,7 @@
VK_NAMESPACE_BEGIN VK_NAMESPACE_BEGIN
Swapchain::~Swapchain() Swapchain::~Swapchain()
{ {
SAFE_CLEAR_OBJECT_ARRAY(render_frame,color_count); SAFE_CLEAR_OBJECT_ARRAY(sc_fbo,color_count);
SAFE_CLEAR(sc_depth); SAFE_CLEAR(sc_depth);
SAFE_CLEAR_OBJECT_ARRAY(sc_color,color_count) SAFE_CLEAR_OBJECT_ARRAY(sc_color,color_count)