updated DescriptorSetLayoutCreater::Create function.
This commit is contained in:
parent
1100e98a92
commit
9118ba8e9f
@ -100,7 +100,7 @@ bool DescriptorSetLayoutCreater::CreatePipelineLayout()
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorSets *DescriptorSetLayoutCreater::Create(const DescriptorSetType &type)
|
DescriptorSets *DescriptorSetLayoutCreater::Create(const DescriptorSetsType &type)
|
||||||
{
|
{
|
||||||
if(!pipeline_layout||!dsl)
|
if(!pipeline_layout||!dsl)
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
@ -110,6 +110,23 @@ DescriptorSets *DescriptorSetLayoutCreater::Create(const DescriptorSetType &type
|
|||||||
if(count<=0)
|
if(count<=0)
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
|
|
||||||
|
BindingMapping *bm=nullptr;
|
||||||
|
|
||||||
|
if(type==DescriptorSetsType::Material
|
||||||
|
||type==DescriptorSetsType::MaterialInstance) //未开会区分开
|
||||||
|
bm=&index_by_binding;
|
||||||
|
else
|
||||||
|
if(type==DescriptorSetsType::RenderableInstance)
|
||||||
|
bm=&index_by_binding_ri;
|
||||||
|
else
|
||||||
|
if(type==DescriptorSetsType::Global)
|
||||||
|
bm=&index_by_binding_global;
|
||||||
|
else
|
||||||
|
return(nullptr);
|
||||||
|
|
||||||
|
if(bm->GetCount()==0)
|
||||||
|
return(nullptr);
|
||||||
|
|
||||||
DescriptorSetAllocateInfo alloc_info;
|
DescriptorSetAllocateInfo alloc_info;
|
||||||
|
|
||||||
alloc_info.descriptorPool = pool;
|
alloc_info.descriptorPool = pool;
|
||||||
@ -121,15 +138,6 @@ DescriptorSets *DescriptorSetLayoutCreater::Create(const DescriptorSetType &type
|
|||||||
if(vkAllocateDescriptorSets(device,&alloc_info,&desc_set)!=VK_SUCCESS)
|
if(vkAllocateDescriptorSets(device,&alloc_info,&desc_set)!=VK_SUCCESS)
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
|
|
||||||
if(type==DescriptorSetType::Material)
|
return(new DescriptorSets(device,count,pipeline_layout,desc_set,bm));
|
||||||
return(new DescriptorSets(device,count,pipeline_layout,desc_set,&index_by_binding));
|
|
||||||
else
|
|
||||||
if(type==DescriptorSetType::Renderable)
|
|
||||||
return(new DescriptorSets(device,count,pipeline_layout,desc_set,&index_by_binding_ri));
|
|
||||||
else
|
|
||||||
if(type==DescriptorSetType::Global)
|
|
||||||
return(new DescriptorSets(device,count,pipeline_layout,desc_set,&index_by_binding_global));
|
|
||||||
else
|
|
||||||
return(nullptr);
|
|
||||||
}
|
}
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
Loading…
x
Reference in New Issue
Block a user