updated DescriptorBinding::BindUBO, to support dynamic param.
This commit is contained in:
parent
c355f96f9b
commit
49eb8f42f0
@ -101,7 +101,7 @@ namespace hgl
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void BindUBO(MaterialParameters *,const BindingMap &);
|
void BindUBO(MaterialParameters *,const BindingMap &,bool dynamic);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -3,24 +3,23 @@
|
|||||||
#include<hgl/graph/VKMaterialInstance.h>
|
#include<hgl/graph/VKMaterialInstance.h>
|
||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
void DescriptorBinding::BindUBO(MaterialParameters *mp,const BindingMap &binding_map)
|
void DescriptorBinding::BindUBO(MaterialParameters *mp,const BindingMap &binding_map,bool dynamic)
|
||||||
{
|
{
|
||||||
|
if (binding_map.GetCount() <= 0)return;
|
||||||
|
|
||||||
DeviceBuffer* buf = nullptr;
|
DeviceBuffer* buf = nullptr;
|
||||||
|
|
||||||
if (binding_map.GetCount() > 0)
|
const auto *dp =binding_map.GetDataList();
|
||||||
|
const uint count =binding_map.GetCount();
|
||||||
|
|
||||||
|
for(uint i=0;i<count;i++)
|
||||||
{
|
{
|
||||||
const auto* dp = binding_map.GetDataList();
|
buf=GetUBO((*dp)->key);
|
||||||
const uint count = binding_map.GetCount();
|
|
||||||
|
|
||||||
for (uint i = 0; i < count; i++)
|
if(buf)
|
||||||
{
|
mp->BindUBO((*dp)->value,buf,dynamic);
|
||||||
buf = GetUBO((*dp)->key);
|
|
||||||
|
|
||||||
if (buf)
|
++dp;
|
||||||
mp->BindUBO((*dp)->value, buf, false);
|
|
||||||
|
|
||||||
++dp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,8 +40,8 @@ bool DescriptorBinding::Bind(Material *mtl)
|
|||||||
|
|
||||||
// const BindingMap &texture_bm=bma[VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER];
|
// const BindingMap &texture_bm=bma[VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER];
|
||||||
|
|
||||||
BindUBO(mp,bma[VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER]);
|
BindUBO(mp,bma[VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER],false);
|
||||||
BindUBO(mp,bma[VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC]);
|
BindUBO(mp,bma[VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC],true);
|
||||||
|
|
||||||
mp->Update();
|
mp->Update();
|
||||||
return(true);
|
return(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user