[WIP] next step is ShaderCreateInfo::ProcOutput
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include<hgl/type/StringList.h>
|
||||
#include<hgl/graph/VKShaderStage.h>
|
||||
#include<hgl/graph/VKDescriptorSetType.h>
|
||||
#include<hgl/graph/mtl/ShaderVariableType.h>
|
||||
#include<hgl/shadergen/MaterialDescriptorInfo.h>
|
||||
|
||||
namespace hgl{namespace graph
|
||||
@@ -18,9 +19,9 @@ using SubpassInputDescriptorList=ObjectList<SubpassInputDescriptor>;
|
||||
*/
|
||||
class ShaderDescriptorInfo
|
||||
{
|
||||
VkShaderStageFlagBits stage_flag;
|
||||
protected:
|
||||
|
||||
ShaderStageIO stage_io;
|
||||
VkShaderStageFlagBits stage_flag;
|
||||
|
||||
AnsiStringList struct_list; //用到的结构列表
|
||||
|
||||
@@ -29,22 +30,19 @@ class ShaderDescriptorInfo
|
||||
SamplerDescriptorList sampler_list;
|
||||
|
||||
ConstValueDescriptorList const_value_list;
|
||||
SubpassInputDescriptorList subpass_input;
|
||||
|
||||
ShaderPushConstant push_constant;
|
||||
|
||||
public:
|
||||
|
||||
ShaderDescriptorInfo(VkShaderStageFlagBits);
|
||||
~ShaderDescriptorInfo()=default;
|
||||
virtual ~ShaderDescriptorInfo()=default;
|
||||
|
||||
const VkShaderStageFlagBits GetStageFlag()const { return stage_flag; }
|
||||
const VkShaderStageFlagBits GetShaderStage()const { return stage_flag; }
|
||||
const AnsiString GetStageName()const { return AnsiString(GetShaderStageName(stage_flag)); }
|
||||
|
||||
public:
|
||||
|
||||
const ShaderStageIO & GetShaderStageIO()const{return stage_io;}
|
||||
|
||||
const AnsiStringList & GetStructList()const{return struct_list;}
|
||||
|
||||
const UBODescriptorList & GetUBOList()const{return ubo_list;}
|
||||
@@ -52,22 +50,57 @@ public:
|
||||
|
||||
const ConstValueDescriptorList & GetConstList()const{return const_value_list;}
|
||||
|
||||
const SubpassInputDescriptorList & GetSubpassInputList()const{return subpass_input;}
|
||||
|
||||
public:
|
||||
|
||||
bool AddInput(VertexInputAttribute *);
|
||||
bool AddOutput(VertexInputAttribute *);
|
||||
|
||||
bool hasInput(const char *)const; ///<是否有指定输入
|
||||
|
||||
void AddStruct(const AnsiString &);
|
||||
bool AddUBO(DescriptorSetType type,const UBODescriptor *sd);
|
||||
bool AddSampler(DescriptorSetType type,const SamplerDescriptor *sd);
|
||||
|
||||
bool AddConstValue(ConstValueDescriptor *sd);
|
||||
bool AddSubpassInput(const AnsiString name,uint8_t index);
|
||||
bool AddConstValue(ConstValueDescriptor *sd);
|
||||
|
||||
void SetPushConstant(const AnsiString name,uint8_t offset,uint8_t size);
|
||||
};//class ShaderDescriptorInfo
|
||||
|
||||
template<VkShaderStageFlagBits SS,typename IArray,typename I,typename OArray,typename O> class CustomShaderDescriptorInfo:public ShaderDescriptorInfo
|
||||
{
|
||||
IArray input;
|
||||
OArray output;
|
||||
|
||||
public:
|
||||
|
||||
CustomShaderDescriptorInfo():ShaderDescriptorInfo(SS){}
|
||||
virtual ~CustomShaderDescriptorInfo()override=default;
|
||||
|
||||
bool AddInput(I &item){return input.Add(item);}
|
||||
bool AddOutput(O &item){return output.Add(item);}
|
||||
|
||||
bool hasInput(const char *name)const{return input.IsMember(name);} ///<是否有指定输入
|
||||
|
||||
public:
|
||||
|
||||
IArray &GetInput(){return input;}
|
||||
OArray &GetOutput(){return output;}
|
||||
};//class CustomShaderDescriptorInfo
|
||||
|
||||
class VertexShaderDescriptorInfo:public CustomShaderDescriptorInfo<VK_SHADER_STAGE_VERTEX_BIT,VIAArray,VIA,SVArray,ShaderVariable >
|
||||
{
|
||||
SubpassInputDescriptorList subpass_input;
|
||||
|
||||
public:
|
||||
|
||||
const SubpassInputDescriptorList & GetSubpassInputList()const{return subpass_input;}
|
||||
|
||||
public:
|
||||
|
||||
using CustomShaderDescriptorInfo<VK_SHADER_STAGE_VERTEX_BIT,VIAArray,VIA,SVArray,ShaderVariable>::CustomShaderDescriptorInfo;
|
||||
~VertexShaderDescriptorInfo()override=default;
|
||||
|
||||
bool AddSubpassInput(const AnsiString name,uint8_t index);
|
||||
};//class VertexShaderDescriptorInfo
|
||||
|
||||
using TessCtrlShaderDescriptorInfo=CustomShaderDescriptorInfo<VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT, SVArray, ShaderVariable, SVArray, ShaderVariable >;
|
||||
using TessEvalShaderDescriptorInfo=CustomShaderDescriptorInfo<VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT, SVArray, ShaderVariable, SVArray, ShaderVariable >;
|
||||
using GeometryShaderDescriptorInfo=CustomShaderDescriptorInfo<VK_SHADER_STAGE_GEOMETRY_BIT, SVArray, ShaderVariable, SVArray, ShaderVariable >;
|
||||
using FragmentShaderDescriptorInfo=CustomShaderDescriptorInfo<VK_SHADER_STAGE_FRAGMENT_BIT, SVArray, ShaderVariable, VIAArray, VIA >;
|
||||
|
||||
}}//namespace hgl::graph
|
||||
|
Reference in New Issue
Block a user