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
|
|
|
|
|
|
2019-05-07 12:46:25 +08:00
|
|
|
|
#include<hgl/graph/vulkan/VK.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;
|
|
|
|
|
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
|
|
|
|
|
2019-04-22 23:15:48 +08:00
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
friend class Device;
|
2019-04-12 16:39:22 +08:00
|
|
|
|
|
2019-06-19 16:57:42 +08:00
|
|
|
|
RenderPass(VkDevice d,VkRenderPass rp,const List<VkFormat> &cf,VkFormat df)
|
|
|
|
|
{
|
|
|
|
|
device=d;
|
|
|
|
|
render_pass=rp;
|
|
|
|
|
color_formats=cf;
|
|
|
|
|
depth_format=df;
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-22 00:33:48 +08:00
|
|
|
|
RenderPass(VkDevice d,VkRenderPass rp,VkFormat cf,VkFormat df)
|
2019-04-12 16:39:22 +08:00
|
|
|
|
{
|
|
|
|
|
device=d;
|
|
|
|
|
render_pass=rp;
|
2019-06-19 16:57:42 +08:00
|
|
|
|
color_formats.Add(cf);
|
2019-04-22 00:33:48 +08:00
|
|
|
|
depth_format=df;
|
2019-04-12 16:39:22 +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
|
|
|
|
|
|
|
|
|
operator VkRenderPass(){return render_pass;}
|
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;}
|
2019-04-12 16:39:22 +08:00
|
|
|
|
};//class RenderPass
|
|
|
|
|
VK_NAMESPACE_END
|
|
|
|
|
#endif//HGL_GRAPH_VULKAN_RENDER_PASS_INCLUDE
|