2019-07-13 02:38:42 +08:00
|
|
|
|
#ifndef HGL_GRAPH_VULKAN_SWAP_CHAIN_INCLUDE
|
2019-07-13 02:37:19 +08:00
|
|
|
|
#define HGL_GRAPH_VULKAN_SWAP_CHAIN_INCLUDE
|
|
|
|
|
|
2019-07-16 10:26:24 +08:00
|
|
|
|
#include<hgl/graph/vulkan/VKSwapchainAttribute.h>
|
2019-07-13 02:37:19 +08:00
|
|
|
|
#include<hgl/graph/vulkan/VKFramebuffer.h>
|
|
|
|
|
#include<hgl/graph/vulkan/VKFence.h>
|
|
|
|
|
#include<hgl/graph/vulkan/VKSemaphore.h>
|
|
|
|
|
VK_NAMESPACE_BEGIN
|
2019-07-15 22:37:00 +08:00
|
|
|
|
class Swapchain
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
Device *device;
|
|
|
|
|
|
|
|
|
|
SwapchainAttribute *sc_attr;
|
2019-07-13 02:37:19 +08:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
2019-07-16 19:59:53 +08:00
|
|
|
|
// VkPipelineStageFlags pipe_stage_flags;
|
2019-07-13 02:37:19 +08:00
|
|
|
|
|
2019-07-16 19:59:53 +08:00
|
|
|
|
//uint32_t current_frame;
|
|
|
|
|
//ObjectList<Framebuffer> render_frame;
|
2019-07-13 02:37:19 +08:00
|
|
|
|
|
2019-07-16 19:59:53 +08:00
|
|
|
|
//uint32_t current_fence;
|
|
|
|
|
//ObjectList<Fence> fence_list;
|
2019-07-13 02:37:19 +08:00
|
|
|
|
|
2019-07-16 19:59:53 +08:00
|
|
|
|
//RenderPass *main_rp =nullptr;
|
2019-07-13 02:37:19 +08:00
|
|
|
|
|
2019-07-16 19:59:53 +08:00
|
|
|
|
//VkSubmitInfo submit_info;
|
|
|
|
|
//VkPresentInfoKHR present_info;
|
2019-07-13 02:37:19 +08:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2019-07-16 19:59:53 +08:00
|
|
|
|
VkSwapchainKHR GetSwapchain () {return sc_attr->swap_chain;}
|
2019-07-15 22:37:00 +08:00
|
|
|
|
const VkExtent2D & GetExtent ()const {return sc_attr->extent;}
|
|
|
|
|
const uint32_t GetImageCount ()const {return sc_attr->sc_color.GetCount();}
|
2019-07-13 02:37:19 +08:00
|
|
|
|
|
2019-07-16 19:59:53 +08:00
|
|
|
|
Texture2D ** GetColorTextures () {return sc_attr->sc_color.GetData();}
|
|
|
|
|
Texture2D * GetColorTexture (int index) {return sc_attr->sc_color[index];}
|
|
|
|
|
Texture2D * GetDepthTexture () {return sc_attr->sc_depth;}
|
|
|
|
|
|
|
|
|
|
// RenderPass * GetMainRenderPass () {return main_rp;}
|
|
|
|
|
// Framebuffer * GetFramebuffer (int index) {return render_frame[index];}
|
|
|
|
|
//const uint32_t GetCurrentFrameIndices () {return current_frame;}
|
|
|
|
|
// Framebuffer * GetCurrentFramebuffer () {return render_frame[current_frame];}
|
2019-07-13 02:37:19 +08:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2019-07-15 22:37:00 +08:00
|
|
|
|
Swapchain(Device *,SwapchainAttribute *sa);
|
2019-07-13 02:37:19 +08:00
|
|
|
|
|
2019-07-15 22:37:00 +08:00
|
|
|
|
virtual ~Swapchain();
|
2019-07-13 02:37:19 +08:00
|
|
|
|
|
2019-07-16 19:59:53 +08:00
|
|
|
|
//bool Wait (bool wait_all=VK_TRUE,uint64_t time_out=HGL_NANO_SEC_PER_SEC*0.1); ///<等待队列完成
|
|
|
|
|
|
|
|
|
|
///**
|
|
|
|
|
// * 请求获得下一帧的索引,并将确认信息发送到指定信号
|
|
|
|
|
// * @param complete_semaphore 完成后请发送至此信号
|
|
|
|
|
// * @return 下一帧的索引
|
|
|
|
|
// * @return <0 错误
|
|
|
|
|
// */
|
|
|
|
|
//int AcquireNextImage (vulkan::Semaphore *complete_semaphore); ///<请求获得下一帧的索引
|
|
|
|
|
//
|
|
|
|
|
///**
|
|
|
|
|
// * 提交一个绘制指令
|
|
|
|
|
// * @param cmd_list 绘制指令
|
|
|
|
|
// * @param wait_sem 指令开始前要等待的确认的信号
|
|
|
|
|
// * @param complete_semaphore 绘制完成后发送的信号
|
|
|
|
|
// */
|
|
|
|
|
//bool SubmitDraw (VkCommandBuffer &cmd_list,vulkan::Semaphore *wait_sem,vulkan::Semaphore *complete_semaphore); ///<提交绘制指令
|
|
|
|
|
|
|
|
|
|
///**
|
|
|
|
|
// * 提交一批绘制指令
|
|
|
|
|
// * @param cmd_list 绘制指令
|
|
|
|
|
// * @param wait_sems 指令开始前要等待的确认的信号
|
|
|
|
|
// * @param complete_semaphores 绘制完成后发送的信号
|
|
|
|
|
// */
|
|
|
|
|
//bool SubmitDraw (List<VkCommandBuffer> &cmd_list,List<VkSemaphore> &wait_sems,List<VkSemaphore> &complete_semaphores); ///<提交绘制指令
|
|
|
|
|
|
|
|
|
|
///**
|
|
|
|
|
// * @param render_complete_semaphore 渲染完成信号
|
|
|
|
|
// */
|
|
|
|
|
//bool PresentBackbuffer (vulkan::Semaphore *render_complete_semaphore); ///<等待绘制队列完成,并将后台缓冲区呈现到前台
|
2019-07-13 02:37:19 +08:00
|
|
|
|
};//class Swapchain
|
|
|
|
|
VK_NAMESPACE_END
|
|
|
|
|
#endif//HGL_GRAPH_VULKAN_SWAP_CHAIN_INCLUDE
|