diff --git a/inc/hgl/graph/VKRenderable.h b/inc/hgl/graph/VKRenderable.h index 79740354..297c2dc4 100644 --- a/inc/hgl/graph/VKRenderable.h +++ b/inc/hgl/graph/VKRenderable.h @@ -51,10 +51,10 @@ public: Renderable(const uint32_t dc=0):draw_count(dc){} virtual ~Renderable()=default; - const uint GetRefCount()const{return ref_count;} + const uint GetRefCount()const{return ref_count;} - void SetBoundingBox(const AABB &aabb){BoundingBox=aabb;} - const AABB &GetBoundingBox()const {return BoundingBox;} + void SetBoundingBox(const AABB &aabb){BoundingBox=aabb;} + const AABB & GetBoundingBox()const {return BoundingBox;} bool Set(const AnsiString &name,VBO *vb,VkDeviceSize offset=0); diff --git a/src/SceneGraph/Vulkan/VKPipelineLayoutData.cpp b/src/SceneGraph/Vulkan/VKPipelineLayoutData.cpp index 09086047..0f4001f7 100644 --- a/src/SceneGraph/Vulkan/VKPipelineLayoutData.cpp +++ b/src/SceneGraph/Vulkan/VKPipelineLayoutData.cpp @@ -8,32 +8,39 @@ PipelineLayoutData *GPUDevice::CreatePipelineLayoutData(const MaterialDescriptor { PipelineLayoutData *pld=hgl_zero_new(); - 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) - continue; + if(!dslci||dslci->bindingCount<=0) + continue; - if(pld->layouts[i]) - vkDestroyDescriptorSetLayout(attr->device,pld->layouts[i],nullptr); + if(pld->layouts[i]) + 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; 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) + else { - delete pld; - return(nullptr); + //没有任何DescriptorSets的情况也是存在的 } //VkPushConstantRange push_constant_range;