2023-03-03 23:02:40 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
|
2023-03-06 14:06:20 +08:00
|
|
|
|
#include<hgl/shadergen/ShaderGenNamespace.h>
|
2023-03-03 23:02:40 +08:00
|
|
|
|
#include<hgl/type/Map.h>
|
|
|
|
|
#include<hgl/graph/VKShaderStage.h>
|
|
|
|
|
#include<hgl/graph/VKDescriptorSetType.h>
|
|
|
|
|
#include<hgl/shadergen/MaterialDescriptorManager.h>
|
|
|
|
|
|
|
|
|
|
SHADERGEN_NAMESPACE_BEGIN
|
2023-03-04 05:11:51 +08:00
|
|
|
|
|
|
|
|
|
using ConstUBODescriptorList=List<const UBODescriptor *>;
|
|
|
|
|
using ConstSamplerDescriptorList=List<const SamplerDescriptor *>;
|
|
|
|
|
|
2023-03-03 23:02:40 +08:00
|
|
|
|
/**
|
|
|
|
|
* Shader数据管理器,用于生成正式Shader前的资源统计
|
|
|
|
|
*/
|
|
|
|
|
class ShaderDescriptorManager
|
|
|
|
|
{
|
2023-03-08 21:41:57 +08:00
|
|
|
|
VkShaderStageFlagBits shader_stage;
|
|
|
|
|
|
2023-03-03 23:02:40 +08:00
|
|
|
|
ShaderStageIO stage_io;
|
|
|
|
|
|
|
|
|
|
//ubo/object在这里以及MaterialDescriptorManager中均有一份,mdm中的用于产生set/binding号,这里的用于产生shader
|
2023-03-04 05:11:51 +08:00
|
|
|
|
ConstUBODescriptorList ubo_list;
|
|
|
|
|
ConstSamplerDescriptorList sampler_list;
|
2023-03-03 23:02:40 +08:00
|
|
|
|
|
|
|
|
|
ObjectList<ConstValueDescriptor> const_value_list;
|
|
|
|
|
ObjectList<SubpassInputDescriptor> subpass_input;
|
|
|
|
|
|
|
|
|
|
ShaderPushConstant push_constant;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2023-03-04 05:11:51 +08:00
|
|
|
|
ShaderDescriptorManager(VkShaderStageFlagBits);
|
2023-03-03 23:02:40 +08:00
|
|
|
|
~ShaderDescriptorManager()=default;
|
|
|
|
|
|
2023-03-08 21:41:57 +08:00
|
|
|
|
const VkShaderStageFlagBits GetStageBits()const { return shader_stage; }
|
|
|
|
|
const AnsiString GetStageName()const { return AnsiString(GetShaderStageName(shader_stage)); }
|
2023-03-03 23:02:40 +08:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
const ShaderStageIO & GetShaderStageIO()const{return stage_io;}
|
|
|
|
|
|
2023-03-04 05:11:51 +08:00
|
|
|
|
const ConstUBODescriptorList & GetUBOList()const{return ubo_list;}
|
|
|
|
|
const ConstSamplerDescriptorList & GetSamplerList()const{return sampler_list;}
|
2023-03-03 23:02:40 +08:00
|
|
|
|
|
|
|
|
|
const ObjectList<ConstValueDescriptor> & GetConstList()const{return const_value_list;}
|
|
|
|
|
|
|
|
|
|
const ObjectList<SubpassInputDescriptor> & GetSubpassInputList()const { return subpass_input; }
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
bool AddInput(ShaderStage *);
|
|
|
|
|
bool AddOutput(ShaderStage *);
|
|
|
|
|
|
2023-03-04 05:11:51 +08:00
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
void DebugOutput(int);
|
|
|
|
|
#endif//_DEBUG
|
|
|
|
|
};//class ShaderDescriptorManager
|
|
|
|
|
SHADERGEN_NAMESPACE_END
|