improved Swapchain&SwapchainRenderTarget
This commit is contained in:
@@ -39,7 +39,6 @@ private:
|
||||
DeviceRenderPassManage *render_pass_manage;
|
||||
RenderPass *device_render_pass;
|
||||
|
||||
Swapchain *swapchain;
|
||||
SwapchainRenderTarget *swapchainRT;
|
||||
|
||||
SwapchainRenderTarget *CreateSwapchainRenderTarget();
|
||||
@@ -51,10 +50,11 @@ private:
|
||||
|
||||
VkCommandBuffer CreateCommandBuffer();
|
||||
|
||||
bool CreateSwapchainColorTexture();
|
||||
bool CreateSwapchainDepthTexture();
|
||||
bool CreateSwapchainColorTexture(Swapchain *);
|
||||
bool CreateSwapchainDepthTexture(Swapchain *);
|
||||
void CreateSwapchainFBO(Swapchain *);
|
||||
|
||||
bool CreateSwapchain(const VkExtent2D &acquire_extent);
|
||||
Swapchain *CreateSwapchain(const VkExtent2D &acquire_extent);
|
||||
|
||||
private:
|
||||
|
||||
@@ -81,13 +81,12 @@ public:
|
||||
VkQueue GetGraphicsQueue () {return attr->graphics_queue;}
|
||||
|
||||
RenderPass * GetRenderPass () {return device_render_pass;}
|
||||
Swapchain * GetSwapchain () {return swapchain;}
|
||||
|
||||
SwapchainRenderTarget * GetSwapchainRT () {return swapchainRT;}
|
||||
|
||||
public:
|
||||
const VkExtent2D & GetSwapchainSize ()const {return swapchainRT->GetExtent();}
|
||||
|
||||
const VkExtent2D & GetSwapchainSize ()const {return swapchain->extent;}
|
||||
public:
|
||||
|
||||
bool Resize (const VkExtent2D &);
|
||||
bool Resize (const uint32_t &w,const uint32_t &h)
|
||||
|
@@ -66,29 +66,25 @@ class SwapchainRenderTarget:public RenderTarget
|
||||
{
|
||||
VkDevice device;
|
||||
Swapchain *swapchain;
|
||||
VkSwapchainKHR vk_swapchain;
|
||||
PresentInfo present_info;
|
||||
|
||||
GPUSemaphore *present_complete_semaphore=nullptr;
|
||||
|
||||
uint32_t swap_chain_count;
|
||||
|
||||
uint32_t current_frame;
|
||||
Framebuffer **render_frame;
|
||||
|
||||
public:
|
||||
|
||||
SwapchainRenderTarget(VkDevice dev,Swapchain *sc,GPUQueue *q,GPUSemaphore *rcs,GPUSemaphore *pcs,RenderPass *rp,Framebuffer **fbo_list);
|
||||
SwapchainRenderTarget(VkDevice dev,Swapchain *sc,GPUQueue *q,GPUSemaphore *rcs,GPUSemaphore *pcs,RenderPass *rp);
|
||||
~SwapchainRenderTarget();
|
||||
|
||||
Framebuffer * GetFramebuffer ()override {return render_frame[current_frame];}
|
||||
Framebuffer * GetFramebuffer (const uint32_t index) {return render_frame[index];}
|
||||
Framebuffer * GetFramebuffer ()override {return swapchain->render_frame[current_frame];}
|
||||
Framebuffer * GetFramebuffer (const uint32_t index) {return swapchain->render_frame[index];}
|
||||
|
||||
const uint32_t GetColorCount ()const override {return 1;}
|
||||
const uint32_t GetImageCount ()const {return swap_chain_count;}
|
||||
const uint32_t GetImageCount ()const {return swapchain->color_count;}
|
||||
|
||||
virtual Texture2D * GetColorTexture (const int index=0) override{return swapchain->GetColorTexture(index);}
|
||||
virtual Texture2D * GetDepthTexture () override{return swapchain->GetDepthTexture();}
|
||||
virtual Texture2D * GetColorTexture (const int index=0) override{return swapchain->sc_color[index];}
|
||||
virtual Texture2D * GetDepthTexture () override{return swapchain->sc_depth;}
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -13,23 +13,14 @@ public:
|
||||
|
||||
VkExtent2D extent;
|
||||
|
||||
VkQueue graphics_queue =VK_NULL_HANDLE;
|
||||
VkSwapchainKHR swap_chain =VK_NULL_HANDLE;
|
||||
|
||||
uint32_t swap_chain_count=0;
|
||||
uint32_t color_count=0;
|
||||
|
||||
ObjectList<Texture2D> sc_color;
|
||||
Texture2D ** sc_color =nullptr;
|
||||
Texture2D * sc_depth =nullptr;
|
||||
|
||||
public:
|
||||
|
||||
VkSwapchainKHR GetSwapchain () {return swap_chain;}
|
||||
const VkExtent2D & GetExtent ()const {return extent;}
|
||||
const uint32_t GetImageCount ()const {return sc_color.GetCount();}
|
||||
|
||||
Texture2D ** GetColorTextures () {return sc_color.GetData();}
|
||||
Texture2D * GetColorTexture (int index) {return sc_color[index];}
|
||||
Texture2D * GetDepthTexture () {return sc_depth;}
|
||||
Framebuffer ** render_frame =nullptr;
|
||||
|
||||
public:
|
||||
|
||||
|
Reference in New Issue
Block a user