diff --git a/inc/hgl/graph/VKCommandBuffer.h b/inc/hgl/graph/VKCommandBuffer.h index b1994dc1..1ced171a 100644 --- a/inc/hgl/graph/VKCommandBuffer.h +++ b/inc/hgl/graph/VKCommandBuffer.h @@ -114,11 +114,11 @@ public: return(true); } - bool BindDescriptorSets(VkPipelineLayout pipeline_layout,const VkDescriptorSet *ds_list,const uint32_t ds_count,const uint32_t *offset,const uint32_t offset_count) + bool BindDescriptorSets(VkPipelineLayout pipeline_layout,const uint32_t first_set,const VkDescriptorSet *ds_list,const uint32_t ds_count,const uint32_t *offset,const uint32_t offset_count) { if(!ds_list||ds_count<=0)return(false); - vkCmdBindDescriptorSets(cmd_buf,VK_PIPELINE_BIND_POINT_GRAPHICS,pipeline_layout,0,ds_count,ds_list,offset_count,offset); + vkCmdBindDescriptorSets(cmd_buf,VK_PIPELINE_BIND_POINT_GRAPHICS,pipeline_layout,first_set,ds_count,ds_list,offset_count,offset); return(true); } diff --git a/src/SceneGraph/RenderList.cpp b/src/SceneGraph/RenderList.cpp index fbbccb86..c395ffe5 100644 --- a/src/SceneGraph/RenderList.cpp +++ b/src/SceneGraph/RenderList.cpp @@ -214,7 +214,8 @@ namespace hgl } { - int ds_count=0; + uint32_t ds_count=0; + uint32_t first_set=0; MaterialParameters *mp; for(int i=(int)DescriptorSetType::BEGIN_RANGE; @@ -223,9 +224,9 @@ namespace hgl { mp=ri->GetMP((DescriptorSetType)i); -// if(last_mp[i]!=mp) + if(last_mp[i]!=mp) { - //last_mp[i]=mp; + last_mp[i]=mp; if(mp) { @@ -233,6 +234,11 @@ namespace hgl ++ds_count; } } + else + { + if(mp) + ++first_set; + } } { @@ -243,11 +249,11 @@ namespace hgl ds_list[ds_count]=mp->GetVkDescriptorSet(); ++ds_count; - cmd_buf->BindDescriptorSets(ri->GetPipelineLayout(),ds_list,ds_count,&ubo_offset,1); + cmd_buf->BindDescriptorSets(ri->GetPipelineLayout(),first_set,ds_list,ds_count,&ubo_offset,1); } else { - cmd_buf->BindDescriptorSets(ri->GetPipelineLayout(),ds_list,ds_count,nullptr,0); + cmd_buf->BindDescriptorSets(ri->GetPipelineLayout(),first_set,ds_list,ds_count,nullptr,0); } ubo_offset+=ubo_align;