use DescriptorSetLayoutCreateInfo instead of ShaderDescriptorSet
This commit is contained in:
parent
99bfd4d257
commit
0a4ec8b184
@ -74,7 +74,6 @@ private:
|
|||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
if(!mp_global->BindUBO("g_camera",ubo_camera_info))return(false);
|
if(!mp_global->BindUBO("g_camera",ubo_camera_info))return(false);
|
||||||
if(!mp_global->BindUBO("g_frag_camera",ubo_camera_info))return(false);
|
|
||||||
|
|
||||||
mp_global->Update();
|
mp_global->Update();
|
||||||
}
|
}
|
||||||
|
@ -32,13 +32,7 @@ class MaterialDescriptorSets
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
struct ShaderDescriptorSet
|
DescriptorSetLayoutCreateInfo sds[size_t(DescriptorSetType::RANGE_SIZE)];
|
||||||
{
|
|
||||||
uint32_t count;
|
|
||||||
VkDescriptorSetLayoutBinding *binding_list;
|
|
||||||
};
|
|
||||||
|
|
||||||
ShaderDescriptorSet sds[size_t(DescriptorSetType::RANGE_SIZE)];
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -51,8 +45,7 @@ public:
|
|||||||
const int GetSSBO (const AnsiString &name)const{return GetBinding(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, name);}
|
const int GetSSBO (const AnsiString &name)const{return GetBinding(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, name);}
|
||||||
const int GetSampler(const AnsiString &name)const{return GetBinding(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, name);}
|
const int GetSampler(const AnsiString &name)const{return GetBinding(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, name);}
|
||||||
|
|
||||||
const int GetBindingCount (const DescriptorSetType &type)const{return sds[(size_t)type].count;}
|
const DescriptorSetLayoutCreateInfo *GetBinding(const DescriptorSetType &type)const{return sds+size_t(type);}
|
||||||
const VkDescriptorSetLayoutBinding *GetBindingList (const DescriptorSetType &type)const{return sds[(size_t)type].binding_list;}
|
|
||||||
};//class MaterialDescriptorSets
|
};//class MaterialDescriptorSets
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
#endif//HGL_GRAPH_VULKAN_MATERIAL_DESCRIPTOR_SETS_INCLUDE
|
#endif//HGL_GRAPH_VULKAN_MATERIAL_DESCRIPTOR_SETS_INCLUDE
|
||||||
|
2
res
2
res
@ -1 +1 @@
|
|||||||
Subproject commit a0c84d12663e1d0ce0ad22faa5cd89ede26af90f
|
Subproject commit 404938c1f73f3eaa0554e47c6ff5ff0979c1a281
|
@ -130,7 +130,7 @@ bool RenderCmdBuffer::BindDescriptorSets(RenderableInstance *ri)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(false);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderCmdBuffer::BindVAB(RenderableInstance *ri)
|
bool RenderCmdBuffer::BindVAB(RenderableInstance *ri)
|
||||||
|
@ -19,7 +19,11 @@ MaterialDescriptorSets::MaterialDescriptorSets(ShaderDescriptor *sd,const uint c
|
|||||||
if(sd_count<=0)return;
|
if(sd_count<=0)return;
|
||||||
|
|
||||||
{
|
{
|
||||||
hgl_zero(sds,size_t(DescriptorSetType::RANGE_SIZE));
|
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||||
|
{
|
||||||
|
sds[i].bindingCount=0;
|
||||||
|
sds[i].pBindings=nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
ShaderDescriptor *sp=sd_list;
|
ShaderDescriptor *sp=sd_list;
|
||||||
@ -33,7 +37,7 @@ MaterialDescriptorSets::MaterialDescriptorSets(ShaderDescriptor *sd,const uint c
|
|||||||
sd_by_name.Add(sp->name,sp);
|
sd_by_name.Add(sp->name,sp);
|
||||||
binding_map[size_t(sp->desc_type)].Add(sp->name,sp->binding);
|
binding_map[size_t(sp->desc_type)].Add(sp->name,sp->binding);
|
||||||
|
|
||||||
++sds[sp->set].count;
|
++sds[sp->set].bindingCount;
|
||||||
|
|
||||||
++sp;
|
++sp;
|
||||||
}
|
}
|
||||||
@ -43,10 +47,10 @@ MaterialDescriptorSets::MaterialDescriptorSets(ShaderDescriptor *sd,const uint c
|
|||||||
|
|
||||||
{
|
{
|
||||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||||
if(sds[i].count>0)
|
if(sds[i].bindingCount>0)
|
||||||
{
|
{
|
||||||
sds[i].binding_list=new VkDescriptorSetLayoutBinding[sds[i].count];
|
sds[i].pBindings=new VkDescriptorSetLayoutBinding[sds[i].bindingCount];
|
||||||
sds_ptr[i]=sds[i].binding_list;
|
sds_ptr[i]=(VkDescriptorSetLayoutBinding *)sds[i].pBindings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,8 +92,8 @@ MaterialDescriptorSets::MaterialDescriptorSets(ShaderDescriptor *sd,const uint c
|
|||||||
MaterialDescriptorSets::~MaterialDescriptorSets()
|
MaterialDescriptorSets::~MaterialDescriptorSets()
|
||||||
{
|
{
|
||||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||||
if(sds[i].count)
|
if(sds[i].bindingCount)
|
||||||
delete[] sds[i].binding_list;
|
delete[] sds[i].pBindings;
|
||||||
|
|
||||||
delete[] sd_list; //"delete[] nullptr" isn't bug.
|
delete[] sd_list; //"delete[] nullptr" isn't bug.
|
||||||
}
|
}
|
||||||
|
@ -10,26 +10,21 @@ PipelineLayoutData *GPUDevice::CreatePipelineLayoutData(const MaterialDescriptor
|
|||||||
|
|
||||||
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
ENUM_CLASS_FOR(DescriptorSetType,int,i)
|
||||||
{
|
{
|
||||||
const int binding_count=mds->GetBindingCount((DescriptorSetType)i);
|
const DescriptorSetLayoutCreateInfo *dslci=mds->GetBinding((DescriptorSetType)i);
|
||||||
|
|
||||||
if(binding_count<=0)
|
if(!dslci)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DescriptorSetLayoutCreateInfo descriptor_layout;
|
|
||||||
|
|
||||||
descriptor_layout.bindingCount = binding_count;
|
|
||||||
descriptor_layout.pBindings = mds->GetBindingList((DescriptorSetType)i);
|
|
||||||
|
|
||||||
if(pld->layouts[i])
|
if(pld->layouts[i])
|
||||||
vkDestroyDescriptorSetLayout(attr->device,pld->layouts[i],nullptr);
|
vkDestroyDescriptorSetLayout(attr->device,pld->layouts[i],nullptr);
|
||||||
|
|
||||||
if(vkCreateDescriptorSetLayout(attr->device,&descriptor_layout,nullptr,pld->layouts+i)!=VK_SUCCESS)
|
if(vkCreateDescriptorSetLayout(attr->device,dslci,nullptr,pld->layouts+i)!=VK_SUCCESS)
|
||||||
{
|
{
|
||||||
delete pld;
|
delete pld;
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
pld->binding_count[i]=binding_count;
|
pld->binding_count[i]=dslci->bindingCount;
|
||||||
|
|
||||||
pld->fin_dsl[pld->fin_dsl_count]=pld->layouts[i];
|
pld->fin_dsl[pld->fin_dsl_count]=pld->layouts[i];
|
||||||
++pld->fin_dsl_count;
|
++pld->fin_dsl_count;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user