supported 0 DescriptorSet material.

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2022-06-20 21:39:04 +08:00
parent 3fbbdb8204
commit 4dff46c5c5
2 changed files with 26 additions and 19 deletions

View File

@ -51,10 +51,10 @@ public:
Renderable(const uint32_t dc=0):draw_count(dc){} Renderable(const uint32_t dc=0):draw_count(dc){}
virtual ~Renderable()=default; virtual ~Renderable()=default;
const uint GetRefCount()const{return ref_count;} const uint GetRefCount()const{return ref_count;}
void SetBoundingBox(const AABB &aabb){BoundingBox=aabb;} void SetBoundingBox(const AABB &aabb){BoundingBox=aabb;}
const AABB &GetBoundingBox()const {return BoundingBox;} const AABB & GetBoundingBox()const {return BoundingBox;}
bool Set(const AnsiString &name,VBO *vb,VkDeviceSize offset=0); bool Set(const AnsiString &name,VBO *vb,VkDeviceSize offset=0);

View File

@ -8,32 +8,39 @@ PipelineLayoutData *GPUDevice::CreatePipelineLayoutData(const MaterialDescriptor
{ {
PipelineLayoutData *pld=hgl_zero_new<PipelineLayoutData>(); PipelineLayoutData *pld=hgl_zero_new<PipelineLayoutData>();
ENUM_CLASS_FOR(DescriptorSetsType,int,i) if(mds)
{ {
const DescriptorSetLayoutCreateInfo *dslci=mds->GetBinding((DescriptorSetsType)i); ENUM_CLASS_FOR(DescriptorSetsType,int,i)
{
const DescriptorSetLayoutCreateInfo *dslci=mds->GetBinding((DescriptorSetsType)i);
if(!dslci||dslci->bindingCount<=0) if(!dslci||dslci->bindingCount<=0)
continue; continue;
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,dslci,nullptr,pld->layouts+i)!=VK_SUCCESS) if(vkCreateDescriptorSetLayout(attr->device,dslci,nullptr,pld->layouts+i)!=VK_SUCCESS)
{
delete pld;
return(nullptr);
}
pld->binding_count[i]=dslci->bindingCount;
pld->fin_dsl[pld->fin_dsl_count]=pld->layouts[i];
++pld->fin_dsl_count;
}
if(pld->fin_dsl_count<=0)
{ {
delete pld; delete pld;
return(nullptr); return(nullptr);
} }
pld->binding_count[i]=dslci->bindingCount;
pld->fin_dsl[pld->fin_dsl_count]=pld->layouts[i];
++pld->fin_dsl_count;
} }
else
if(pld->fin_dsl_count<=0)
{ {
delete pld; //没有任何DescriptorSets的情况也是存在的
return(nullptr);
} }
//VkPushConstantRange push_constant_range; //VkPushConstantRange push_constant_range;