moved GetBinding functions to ShaderModuleMap from Material.

This commit is contained in:
2021-06-16 20:27:10 +08:00
parent 3658171954
commit cbbc0641ef
5 changed files with 64 additions and 59 deletions

View File

@@ -45,42 +45,17 @@ Material::~Material()
delete shader_maps;
}
const int Material::GetBinding(VkDescriptorType desc_type,const AnsiString &name)const
{
if(desc_type<VK_DESCRIPTOR_TYPE_BEGIN_RANGE
||desc_type>VK_DESCRIPTOR_TYPE_END_RANGE
||name.IsEmpty())
return(-1);
int binding;
const int shader_count=shader_maps->GetCount();
const ShaderModule *sm;
auto **itp=shader_maps->GetDataList();
for(int i=0;i<shader_count;i++)
{
sm=(*itp)->right;
binding=sm->GetBinding(desc_type,name);
if(binding!=-1)
return binding;
++itp;
}
return(-1);
}
const VkPipelineLayout Material::GetPipelineLayout()const
{
return dsl_creater->GetPipelineLayout();
}
MaterialParameters *Material::CreateMP(const DescriptorSetsType &type)
MaterialParameters *Material::CreateMP(const DescriptorSetsType &type)const
{
DescriptorSets *ds=dsl_creater->Create(type);
if(!ds)return(nullptr);
return(new MaterialParameters(this,type,ds));
return(new MaterialParameters(shader_maps,type,ds));
}
VK_NAMESPACE_END