修正重复UBO被重复绑定的问题
This commit is contained in:
parent
0c20f52eb8
commit
8abe9c3d9d
@ -14,6 +14,12 @@ DescriptorSetLayoutCreater::~DescriptorSetLayoutCreater()
|
||||
|
||||
void DescriptorSetLayoutCreater::Bind(const uint32_t binding,VkDescriptorType desc_type,VkShaderStageFlagBits stageFlags)
|
||||
{
|
||||
if(index_by_binding.KeyExist(binding))
|
||||
{
|
||||
//重复的绑定点,有可能存在的,比如WorldMatrix在vs/fs中同时存在
|
||||
return;
|
||||
}
|
||||
|
||||
VkDescriptorSetLayoutBinding layout_binding;
|
||||
|
||||
layout_binding.binding = binding;
|
||||
@ -33,11 +39,15 @@ void DescriptorSetLayoutCreater::Bind(const uint32_t *binding,const uint32_t cou
|
||||
|
||||
const uint old_count=layout_binding_list.GetCount();
|
||||
|
||||
layout_binding_list.SetCount(old_count+count);
|
||||
layout_binding_list.PreMalloc(old_count+count);
|
||||
|
||||
VkDescriptorSetLayoutBinding *p=layout_binding_list.GetData()+old_count;
|
||||
|
||||
uint fin_count=0;
|
||||
|
||||
for(uint i=old_count;i<old_count+count;i++)
|
||||
{
|
||||
if(!index_by_binding.KeyExist(*binding))
|
||||
{
|
||||
p->binding = *binding;
|
||||
p->descriptorType = desc_type;
|
||||
@ -47,9 +57,14 @@ void DescriptorSetLayoutCreater::Bind(const uint32_t *binding,const uint32_t cou
|
||||
|
||||
index_by_binding.Add(*binding,i);
|
||||
|
||||
++binding;
|
||||
++p;
|
||||
++fin_count;
|
||||
}
|
||||
|
||||
++binding;
|
||||
}
|
||||
|
||||
layout_binding_list.SetCount(old_count+fin_count);
|
||||
}
|
||||
|
||||
bool DescriptorSetLayoutCreater::CreatePipelineLayout()
|
||||
|
Loading…
x
Reference in New Issue
Block a user