comment sd_list_by_set_type array and GetDescriptorList function at MaterialDescriptorSets
This commit is contained in:
parent
c4a4ec5ebc
commit
09277924f1
@ -12,8 +12,8 @@ class MaterialDescriptorSets
|
||||
ShaderDescriptor *sd_list;
|
||||
uint sd_count;
|
||||
|
||||
ShaderDescriptorList sd_list_by_desc_type[VK_DESCRIPTOR_TYPE_RANGE_SIZE];
|
||||
ShaderDescriptorList sd_list_by_set_type[size_t(DescriptorSetType::RANGE_SIZE)];
|
||||
//ShaderDescriptorList sd_list_by_set_type[size_t(DescriptorSetType::RANGE_SIZE)];
|
||||
bool set_has_desc[size_t(DescriptorSetType::RANGE_SIZE)];
|
||||
|
||||
// Map<AnsiString,ShaderDescriptor *> sd_by_name;
|
||||
Map<AnsiString,int> binding_map[VK_DESCRIPTOR_TYPE_RANGE_SIZE];
|
||||
@ -40,9 +40,10 @@ public:
|
||||
|
||||
const DescriptorSetLayoutCreateInfo *GetDSLCI(const DescriptorSetType &type)const{return dsl_ci+size_t(type);}
|
||||
|
||||
const ShaderDescriptorList &GetDescriptorList(const DescriptorSetType &type)const{return sd_list_by_set_type[size_t(type)];}
|
||||
//const ShaderDescriptorList &GetDescriptorList(const DescriptorSetType &type)const{return sd_list_by_set_type[size_t(type)];}
|
||||
|
||||
const bool hasSet(const DescriptorSetType &type)const{return !sd_list_by_set_type[size_t(type)].IsEmpty();}
|
||||
const bool hasSet(const DescriptorSetType &type)const{return set_has_desc[size_t(type)];}
|
||||
//!sd_list_by_set_type[size_t(type)].IsEmpty();}
|
||||
};//class MaterialDescriptorSets
|
||||
VK_NAMESPACE_END
|
||||
#endif//HGL_GRAPH_VULKAN_MATERIAL_DESCRIPTOR_SETS_INCLUDE
|
||||
|
@ -42,9 +42,9 @@ public:
|
||||
bool hasFragment()const{return hasShader(VK_SHADER_STAGE_FRAGMENT_BIT);}
|
||||
// bool hasCompute ()const{return hasShader(VK_SHADER_STAGE_COMPUTE_BIT);}
|
||||
|
||||
ShaderCreateInfoVertex * GetVS(){return vert;}
|
||||
ShaderCreateInfoGeometry * GetGS(){return geom;}
|
||||
ShaderCreateInfoFragment * GetFS(){return frag;}
|
||||
const ShaderCreateInfoVertex * GetVS()const{return vert;}
|
||||
const ShaderCreateInfoGeometry * GetGS()const{return geom;}
|
||||
const ShaderCreateInfoFragment * GetFS()const{return frag;}
|
||||
|
||||
public:
|
||||
|
||||
|
@ -21,6 +21,10 @@ MaterialDescriptorSets::MaterialDescriptorSets(const UTF8String &name,ShaderDesc
|
||||
|
||||
if(sd_count<=0)return;
|
||||
|
||||
ShaderDescriptorList sd_list_by_desc_type[VK_DESCRIPTOR_TYPE_RANGE_SIZE];
|
||||
|
||||
hgl_zero(set_has_desc);
|
||||
|
||||
{
|
||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||
{
|
||||
@ -42,7 +46,8 @@ MaterialDescriptorSets::MaterialDescriptorSets(const UTF8String &name,ShaderDesc
|
||||
|
||||
++dsl_ci[size_t(sp->set_type)].bindingCount;
|
||||
|
||||
sd_list_by_set_type[size_t(sp->set_type)].Add(sp);
|
||||
//sd_list_by_set_type[size_t(sp->set_type)].Add(sp);
|
||||
set_has_desc[size_t(sp->set_type)]=true;
|
||||
|
||||
++sp;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
const ShaderModule *RenderResource::CreateShaderModule(const OSString &filename,VkShaderStageFlagBits shader_stage,const void *spv_data,const size_t spv_size)
|
||||
const ShaderModule *RenderResource::CreateShaderModule(const OSString &filename,VkShaderStageFlagBits shader_stage,const uint32_t *spv_data,const size_t spv_size)
|
||||
{
|
||||
if(!device)return(nullptr);
|
||||
if(filename.IsEmpty())return(nullptr);
|
||||
@ -198,14 +198,57 @@ Material *RenderResource::CreateMaterial(const OSString &filename)
|
||||
|
||||
Material *RenderResource::CreateMaterial(const hgl::shadergen::MaterialCreateInfo *mci)
|
||||
{
|
||||
SHADERGEN_NAMESPACE_USING
|
||||
|
||||
if(!mci)
|
||||
return(nullptr);
|
||||
|
||||
const uint count=GetShaderCountByBits(mci->GetShaderStage());
|
||||
ShaderModuleMap *smm=new ShaderModuleMap;
|
||||
SHADERGEN_NAMESPACE_USING
|
||||
|
||||
const uint count=GetShaderCountByBits(mci->GetShaderStage());
|
||||
const ShaderModule *sm;
|
||||
|
||||
ShaderModuleMap *smm=new ShaderModuleMap;
|
||||
VertexInput *vertex_input=nullptr;
|
||||
|
||||
const OSString mtl_name=ToOSString(mci->GetName());
|
||||
|
||||
const ShaderCreateInfoVertex *vert=mci->GetVS();
|
||||
|
||||
if(vert)
|
||||
{
|
||||
sm=CreateShaderModule( mtl_name+OS_TEXT("?Vertex"),
|
||||
VK_SHADER_STAGE_VERTEX_BIT,
|
||||
vert->GetCode(),vert->GetCodeSize());
|
||||
|
||||
if(sm)
|
||||
{
|
||||
if(smm->Add(sm))
|
||||
vertex_input=new VertexInput(vert->GetInput());
|
||||
}
|
||||
|
||||
smm->Add(sm);
|
||||
}
|
||||
|
||||
const ShaderCreateInfoGeometry *geom=mci->GetGS();
|
||||
|
||||
if(geom)
|
||||
{
|
||||
sm=CreateShaderModule( mtl_name+OS_TEXT("?Geometry"),
|
||||
VK_SHADER_STAGE_GEOMETRY_BIT,
|
||||
geom->GetCode(),geom->GetCodeSize());
|
||||
|
||||
smm->Add(sm);
|
||||
}
|
||||
|
||||
const ShaderCreateInfoFragment *frag=mci->GetFS();
|
||||
|
||||
if(frag)
|
||||
{
|
||||
sm=CreateShaderModule( mtl_name+OS_TEXT("?Fragment"),
|
||||
VK_SHADER_STAGE_FRAGMENT_BIT,
|
||||
frag->GetCode(),frag->GetCodeSize());
|
||||
|
||||
smm->Add(sm);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user