改进CommandBuffer::Bind(DescriptorSets *,使其支持绑定部分数据

This commit is contained in:
hyzboy 2019-05-05 22:00:25 +08:00
parent c8131db208
commit abe66192d6
2 changed files with 8 additions and 4 deletions

View File

@ -47,7 +47,7 @@ public:
bool Begin();
bool BeginRenderPass(RenderPass *rp,Framebuffer *fb);
bool Bind(Pipeline *p);
bool Bind(DescriptorSets *);
bool Bind(DescriptorSets *,int first=0,int count=0);
bool Bind(Renderable *);
void EndRenderPass();
bool End();

View File

@ -80,15 +80,19 @@ bool CommandBuffer::Bind(Pipeline *p)
return(true);
}
bool CommandBuffer::Bind(DescriptorSets *dsl)
bool CommandBuffer::Bind(DescriptorSets *dsl,int first,int count)
{
if(!dsl)
return(false);
const uint32_t count=dsl->GetCount();
if(first<0)
first=0;
if(count==0||first+count>dsl->GetCount())
count=dsl->GetCount()-first;
if(count>0)
vkCmdBindDescriptorSets(cmd_buf,VK_PIPELINE_BIND_POINT_GRAPHICS,dsl->GetPipelineLayout(),0,count,dsl->GetDescriptorSets(),0,nullptr);
vkCmdBindDescriptorSets(cmd_buf,VK_PIPELINE_BIND_POINT_GRAPHICS,dsl->GetPipelineLayout(),first,count,dsl->GetDescriptorSets(),0,nullptr);
return(true);
}