ULRE/inc/hgl/graph/VKRenderPass.h

71 lines
2.6 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef HGL_GRAPH_VULKAN_RENDER_PASS_INCLUDE
#define HGL_GRAPH_VULKAN_RENDER_PASS_INCLUDE
#include<hgl/graph/VK.h>
#include<hgl/graph/VKPipeline.h>
#include<hgl/type/ObjectList.h>
VK_NAMESPACE_BEGIN
/**
* RenderPass功能封装<br>
* RenderPass在创建时需要指定输入的color imageview与depth imageview象素格式
* 在随后创建Framebuffer时需要同时指定RenderPass与ColorImageView,DepthImageView象素格式要一致。
*/
class RenderPass
{
VkDevice device;
VkPipelineCache pipeline_cache;
VkRenderPass render_pass;
List<VkFormat> color_formats;
VkFormat depth_format;
VkExtent2D granularity;
protected:
ObjectList<Pipeline> pipeline_list;
Pipeline *CreatePipeline(const AnsiString &,PipelineData *,const ShaderStageCreateInfoList &,VkPipelineLayout,const VIL *);
private:
friend class RenderPassManager;
RenderPass(VkDevice d,VkPipelineCache pc,VkRenderPass rp,const List<VkFormat> &cf,VkFormat df);
public:
virtual ~RenderPass();
operator const VkRenderPass()const{return render_pass;}
const VkRenderPass GetVkRenderPass()const{return render_pass;}
const VkPipelineCache GetPipelineCache()const{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;}
const VkExtent2D & GetGranularity()const{return granularity;}
public:
Pipeline *CreatePipeline(Material *,const VIL *,const PipelineData *, const Prim &,const bool prim_restart=false);
Pipeline *CreatePipeline(Material *,const VIL *,const InlinePipeline &, const Prim &,const bool prim_restart=false);
Pipeline *CreatePipeline(Material *mtl, const PipelineData *, const Prim &,const bool prim_restart=false);
Pipeline *CreatePipeline(Material *mtl, const InlinePipeline &, const Prim &,const bool prim_restart=false);
Pipeline *CreatePipeline(MaterialInstance *, const InlinePipeline &, const Prim &,const bool prim_restart=false);
Pipeline *CreatePipeline(MaterialInstance *, const PipelineData *, const Prim &,const bool prim_restart=false);
Pipeline *CreatePipeline(MaterialInstance *, const OSString &, const Prim &,const bool prim_restart=false);
};//class RenderPass
VK_NAMESPACE_END
#endif//HGL_GRAPH_VULKAN_RENDER_PASS_INCLUDE