added newly functions at MaterialParameters that used index instead of name

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-03-27 12:00:53 +08:00
parent 3937206fcb
commit 554220699f
2 changed files with 49 additions and 0 deletions

View File

@ -55,6 +55,11 @@ public:
virtual ~MaterialParameters();
bool BindUBO(const int &index,DeviceBuffer *ubo,bool dynamic=false);
bool BindSSBO(const int &index,DeviceBuffer *ubo,bool dynamic=false);
bool BindImageSampler(const int &index,Texture *tex,Sampler *sampler);
bool BindInputAttachment(const int &index,ImageView *);
bool BindUBO(const AnsiString &name,DeviceBuffer *ubo,bool dynamic=false);
bool BindSSBO(const AnsiString &name,DeviceBuffer *ubo,bool dynamic=false);
bool BindImageSampler(const AnsiString &name,Texture *tex,Sampler *sampler);

View File

@ -16,6 +16,17 @@ MaterialParameters::~MaterialParameters()
delete descriptor_set;
}
bool MaterialParameters::BindUBO(const int &index,DeviceBuffer *ubo,bool dynamic)
{
if(index<0||!ubo)
return(false);
if(!descriptor_set->BindUBO(index,ubo,dynamic))
return(false);
return(true);
}
bool MaterialParameters::BindUBO(const AnsiString &name,DeviceBuffer *ubo,bool dynamic)
{
if(name.IsEmpty()||!ubo)
@ -32,6 +43,17 @@ bool MaterialParameters::BindUBO(const AnsiString &name,DeviceBuffer *ubo,bool d
return(true);
}
bool MaterialParameters::BindSSBO(const int &index,DeviceBuffer *ssbo,bool dynamic)
{
if(index<0||!ssbo)
return(false);
if(!descriptor_set->BindSSBO(index,ssbo,dynamic))
return(false);
return(true);
}
bool MaterialParameters::BindSSBO(const AnsiString &name,DeviceBuffer *ssbo,bool dynamic)
{
if(name.IsEmpty()||!ssbo)
@ -48,6 +70,17 @@ bool MaterialParameters::BindSSBO(const AnsiString &name,DeviceBuffer *ssbo,bool
return(true);
}
bool MaterialParameters::BindImageSampler(const int &index,Texture *tex,Sampler *sampler)
{
if(index<0||!tex||!sampler)
return(false);
if(!descriptor_set->BindImageSampler(index,tex,sampler))
return(false);
return(true);
}
bool MaterialParameters::BindImageSampler(const AnsiString &name,Texture *tex,Sampler *sampler)
{
if(name.IsEmpty()||!tex||!sampler)
@ -64,6 +97,17 @@ bool MaterialParameters::BindImageSampler(const AnsiString &name,Texture *tex,Sa
return(true);
}
bool MaterialParameters::BindInputAttachment(const int &index,ImageView *iv)
{
if(index<0||!iv)
return(false);
if(!descriptor_set->BindInputAttachment(index,iv))
return(false);
return(true);
}
bool MaterialParameters::BindInputAttachment(const AnsiString &name,ImageView *iv)
{
if(name.IsEmpty()||!iv)