ULRE/inc/hgl/graph/VKRenderPass.h

66 lines
2.1 KiB
C
Raw Normal View History

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
#include<hgl/graph/VK.h>
#include<hgl/graph/VKPipeline.h>
#include<hgl/type/List.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;
VkPipelineCache pipeline_cache;
2019-04-12 16:39:22 +08:00
VkRenderPass render_pass;
List<VkFormat> color_formats;
VkFormat depth_format;
2021-09-29 20:53:03 +08:00
VkExtent2D granularity;
protected:
ObjectList<Pipeline> pipeline_list;
private:
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);
public:
2019-04-12 16:39:22 +08:00
virtual ~RenderPass();
2019-04-18 21:02:42 +08:00
VkRenderPass GetVkRenderPass(){return render_pass;}
VkPipelineCache GetPipelineCache(){return pipeline_cache;}
const uint GetColorCount()const{return color_formats.GetCount();}
const List<VkFormat> & GetColorFormat()const{return color_formats;}
const VkFormat GetColorFormat(int index)const
{
if(index<0||index>=color_formats.GetCount())return VK_FORMAT_UNDEFINED;
return color_formats.GetData()[index];
}
const VkFormat GetDepthFormat()const{return depth_format;}
2021-09-29 20:53:03 +08:00
const VkExtent2D & GetGranularity()const{return granularity;}
public:
Pipeline *CreatePipeline(MaterialInstance *, PipelineData *);
Pipeline *CreatePipeline(MaterialInstance *, const InlinePipeline &);
public:
Pipeline *CreatePipeline(MaterialInstance *, const InlinePipeline &, const Prim &prim,const bool prim_restart=false);
Pipeline *CreatePipeline(MaterialInstance *, PipelineData *, const Prim &prim,const bool prim_restart=false);
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