ULRE/inc/hgl/shadergen/ShaderDescriptorInfo.h

74 lines
2.5 KiB
C
Raw Normal View History

2024-06-18 02:04:11 +08:00
#pragma once
2023-03-03 23:02:40 +08:00
#include<hgl/type/Map.h>
2023-03-09 23:21:52 +08:00
#include<hgl/type/StringList.h>
2023-03-03 23:02:40 +08:00
#include<hgl/graph/VKShaderStage.h>
#include<hgl/graph/VKDescriptorSetType.h>
2023-03-17 10:14:07 +08:00
#include<hgl/shadergen/MaterialDescriptorInfo.h>
2023-03-03 23:02:40 +08:00
2023-03-21 18:05:48 +08:00
namespace hgl{namespace graph
{
2023-03-15 11:32:38 +08:00
using UBODescriptorList=List<const UBODescriptor *>;
using SamplerDescriptorList=List<const SamplerDescriptor *>;
using ConstValueDescriptorList=ObjectList<ConstValueDescriptor>;
using SubpassInputDescriptorList=ObjectList<SubpassInputDescriptor>;
2023-03-03 23:02:40 +08:00
/**
* Shader数据管理器,Shader前的资源统计
*/
2023-03-17 10:14:07 +08:00
class ShaderDescriptorInfo
2023-03-03 23:02:40 +08:00
{
VkShaderStageFlagBits stage_flag;
2023-03-08 21:41:57 +08:00
2023-03-03 23:02:40 +08:00
ShaderStageIO stage_io;
2023-03-14 22:22:35 +08:00
2023-03-09 23:21:52 +08:00
AnsiStringList struct_list; //用到的结构列表
2023-03-17 21:06:05 +08:00
//ubo/object在这里以及MaterialDescriptorInfo中均有一份mdi中的用于产生set/binding号这里的用于产生shader
2023-03-15 11:32:38 +08:00
UBODescriptorList ubo_list;
SamplerDescriptorList sampler_list;
2023-03-03 23:02:40 +08:00
2023-03-15 11:32:38 +08:00
ConstValueDescriptorList const_value_list;
SubpassInputDescriptorList subpass_input;
2023-03-03 23:02:40 +08:00
ShaderPushConstant push_constant;
public:
2023-03-17 10:14:07 +08:00
ShaderDescriptorInfo(VkShaderStageFlagBits);
~ShaderDescriptorInfo()=default;
2023-03-03 23:02:40 +08:00
const VkShaderStageFlagBits GetStageFlag()const { return stage_flag; }
const AnsiString GetStageName()const { return AnsiString(GetShaderStageName(stage_flag)); }
2023-03-14 22:22:35 +08:00
2023-03-03 23:02:40 +08:00
public:
2023-03-15 11:32:38 +08:00
const ShaderStageIO & GetShaderStageIO()const{return stage_io;}
2023-03-03 23:02:40 +08:00
2023-03-15 11:32:38 +08:00
const AnsiStringList & GetStructList()const{return struct_list;}
2023-03-09 23:21:52 +08:00
2023-03-15 11:32:38 +08:00
const UBODescriptorList & GetUBOList()const{return ubo_list;}
const SamplerDescriptorList & GetSamplerList()const{return sampler_list;}
2023-03-03 23:02:40 +08:00
2023-03-15 11:32:38 +08:00
const ConstValueDescriptorList & GetConstList()const{return const_value_list;}
2023-03-03 23:02:40 +08:00
2023-03-15 11:32:38 +08:00
const SubpassInputDescriptorList & GetSubpassInputList()const{return subpass_input;}
2023-03-14 22:22:35 +08:00
2023-03-03 23:02:40 +08:00
public:
2024-06-18 02:04:11 +08:00
bool AddInput(VertexInputAttribute *);
bool AddOutput(VertexInputAttribute *);
2023-03-03 23:02:40 +08:00
bool hasInput(const char *)const; ///<是否有指定输入
2023-05-22 14:29:16 +08:00
void AddStruct(const AnsiString &);
bool AddUBO(DescriptorSetType type,const UBODescriptor *sd);
bool AddSampler(DescriptorSetType type,const SamplerDescriptor *sd);
2023-03-03 23:02:40 +08:00
bool AddConstValue(ConstValueDescriptor *sd);
bool AddSubpassInput(const AnsiString name,uint8_t index);
void SetPushConstant(const AnsiString name,uint8_t offset,uint8_t size);
2023-03-17 10:14:07 +08:00
};//class ShaderDescriptorInfo
2023-03-21 18:05:48 +08:00
}}//namespace hgl::graph