2019-04-22 17:46:49 +08:00
|
|
|
|
#ifndef HGL_GRAPH_VULKAN_RENDER_PASS_INCLUDE
|
2019-04-12 16:39:22 +08:00
|
|
|
|
#define HGL_GRAPH_VULKAN_RENDER_PASS_INCLUDE
|
|
|
|
|
|
2020-10-21 11:43:18 +08:00
|
|
|
|
#include<hgl/graph/VK.h>
|
2021-09-22 17:15:17 +08:00
|
|
|
|
#include<hgl/graph/VKPipeline.h>
|
2023-07-28 20:17:46 +08:00
|
|
|
|
#include<hgl/type/ObjectList.h>
|
2019-04-12 16:39:22 +08:00
|
|
|
|
VK_NAMESPACE_BEGIN
|
2019-04-22 17:46:49 +08:00
|
|
|
|
/**
|
|
|
|
|
* RenderPass功能封装<br>
|
|
|
|
|
* RenderPass在创建时,需要指定输入的color imageview与depth imageview象素格式,
|
|
|
|
|
* 在随后创建Framebuffer时,需要同时指定RenderPass与ColorImageView,DepthImageView,象素格式要一致。
|
|
|
|
|
*/
|
2019-04-12 16:39:22 +08:00
|
|
|
|
class RenderPass
|
|
|
|
|
{
|
|
|
|
|
VkDevice device;
|
2021-09-22 17:15:17 +08:00
|
|
|
|
VkPipelineCache pipeline_cache;
|
2019-04-12 16:39:22 +08:00
|
|
|
|
VkRenderPass render_pass;
|
|
|
|
|
|
2019-06-19 16:57:42 +08:00
|
|
|
|
List<VkFormat> color_formats;
|
|
|
|
|
VkFormat depth_format;
|
2019-04-22 00:33:48 +08:00
|
|
|
|
|
2021-09-29 20:53:03 +08:00
|
|
|
|
VkExtent2D granularity;
|
|
|
|
|
|
2021-09-22 17:15:17 +08:00
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
ObjectList<Pipeline> pipeline_list;
|
|
|
|
|
|
2023-02-23 14:43:57 +08:00
|
|
|
|
Pipeline *CreatePipeline(PipelineData *,const ShaderStageCreateInfoList &,VkPipelineLayout,const VIL *);
|
2022-01-07 16:26:40 +08:00
|
|
|
|
|
2019-04-22 23:15:48 +08:00
|
|
|
|
private:
|
|
|
|
|
|
2021-09-22 16:28:39 +08:00
|
|
|
|
friend class DeviceRenderPassManage;
|
2019-04-12 16:39:22 +08:00
|
|
|
|
|
2021-09-29 20:53:03 +08:00
|
|
|
|
RenderPass(VkDevice d,VkPipelineCache pc,VkRenderPass rp,const List<VkFormat> &cf,VkFormat df);
|
2019-06-19 16:57:42 +08:00
|
|
|
|
|
2019-04-22 23:15:48 +08:00
|
|
|
|
public:
|
|
|
|
|
|
2019-04-12 16:39:22 +08:00
|
|
|
|
virtual ~RenderPass();
|
2019-04-18 21:02:42 +08:00
|
|
|
|
|
2021-09-22 17:15:17 +08:00
|
|
|
|
VkRenderPass GetVkRenderPass(){return render_pass;}
|
|
|
|
|
VkPipelineCache GetPipelineCache(){return pipeline_cache;}
|
2019-04-22 00:33:48 +08:00
|
|
|
|
|
2019-07-10 14:55:34 +08:00
|
|
|
|
const uint GetColorCount()const{return color_formats.GetCount();}
|
2019-06-19 16:57:42 +08:00
|
|
|
|
const List<VkFormat> & GetColorFormat()const{return color_formats;}
|
2020-10-15 22:13:15 +08:00
|
|
|
|
const VkFormat GetColorFormat(int index)const
|
|
|
|
|
{
|
|
|
|
|
if(index<0||index>=color_formats.GetCount())return VK_FORMAT_UNDEFINED;
|
|
|
|
|
|
|
|
|
|
return color_formats.GetData()[index];
|
|
|
|
|
}
|
2019-06-19 16:57:42 +08:00
|
|
|
|
const VkFormat GetDepthFormat()const{return depth_format;}
|
2021-09-22 17:15:17 +08:00
|
|
|
|
|
2021-09-29 20:53:03 +08:00
|
|
|
|
const VkExtent2D & GetGranularity()const{return granularity;}
|
|
|
|
|
|
2021-09-22 17:15:17 +08:00
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
Pipeline *CreatePipeline(MaterialInstance *, const InlinePipeline &, const Prim &prim,const bool prim_restart=false);
|
2022-01-07 16:26:40 +08:00
|
|
|
|
Pipeline *CreatePipeline(MaterialInstance *, const PipelineData *, const Prim &prim,const bool prim_restart=false);
|
2021-09-22 17:15:17 +08:00
|
|
|
|
Pipeline *CreatePipeline(MaterialInstance *, const OSString &, const Prim &prim,const bool prim_restart=false);
|
2019-04-12 16:39:22 +08:00
|
|
|
|
};//class RenderPass
|
|
|
|
|
VK_NAMESPACE_END
|
|
|
|
|
#endif//HGL_GRAPH_VULKAN_RENDER_PASS_INCLUDE
|