From abe66192d6c7970f35cc0afb1b4083d67b3f60a5 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Sun, 5 May 2019 22:00:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BCommandBuffer::Bind(Descripto?= =?UTF-8?q?rSets=20*,=E4=BD=BF=E5=85=B6=E6=94=AF=E6=8C=81=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E9=83=A8=E5=88=86=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/hgl/graph/vulkan/VKCommandBuffer.h | 2 +- src/RenderDevice/Vulkan/VKCommandBuffer.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/inc/hgl/graph/vulkan/VKCommandBuffer.h b/inc/hgl/graph/vulkan/VKCommandBuffer.h index 5908082a..156b212b 100644 --- a/inc/hgl/graph/vulkan/VKCommandBuffer.h +++ b/inc/hgl/graph/vulkan/VKCommandBuffer.h @@ -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(); diff --git a/src/RenderDevice/Vulkan/VKCommandBuffer.cpp b/src/RenderDevice/Vulkan/VKCommandBuffer.cpp index 78159838..99b26368 100644 --- a/src/RenderDevice/Vulkan/VKCommandBuffer.cpp +++ b/src/RenderDevice/Vulkan/VKCommandBuffer.cpp @@ -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); }