optimized DescriptorSets::Update
This commit is contained in:
parent
ae85d3fc66
commit
255c7859f1
@ -23,9 +23,10 @@ Output
|
||||
|
||||
Code
|
||||
{
|
||||
|
||||
|
||||
gl_Position=GetPosition3D();
|
||||
void main()
|
||||
{
|
||||
gl_Position=GetPosition3D();
|
||||
}
|
||||
}
|
||||
|
||||
#Fragment
|
||||
|
@ -92,7 +92,7 @@ private:
|
||||
camera_control->SetTarget(Vector3f(0,0,0));
|
||||
camera_control->Refresh();
|
||||
|
||||
cmc->SetReserveDirection(true,true); //反转x,y
|
||||
camera_control->SetReserveDirection(true,true); //反转x,y
|
||||
|
||||
render_root.RefreshMatrix();
|
||||
render_list->Expend(&render_root);
|
||||
|
@ -81,6 +81,8 @@ public:
|
||||
bool BindSSBO(const DescriptorSetType &type,const AnsiString &name,DeviceBuffer *ubo,bool dynamic=false);
|
||||
bool BindImageSampler(const DescriptorSetType &type,const AnsiString &name,Texture *tex,Sampler *sampler);
|
||||
|
||||
void Update();
|
||||
|
||||
public:
|
||||
|
||||
const bool HasMI ()const{return mi_data_bytes>0;}
|
||||
|
@ -117,6 +117,8 @@ bool RenderCmdBuffer::BindDescriptorSets(Material *mtl)
|
||||
|
||||
if(mp)
|
||||
{
|
||||
mp->Update();
|
||||
|
||||
ds[count]=mp->GetVkDescriptorSet();
|
||||
++count;
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ Material::~Material()
|
||||
SAFE_CLEAR(desc_manager);
|
||||
SAFE_CLEAR(pipeline_layout_data);
|
||||
|
||||
for(int i=0;i<DESCRIPTOR_SET_TYPE_COUNT;i++)
|
||||
SAFE_CLEAR(mp_array[i]);
|
||||
for(auto &mp:mp_array)
|
||||
SAFE_CLEAR(mp);
|
||||
}
|
||||
|
||||
const VkPipelineLayout Material::GetPipelineLayout()const
|
||||
@ -74,10 +74,7 @@ bool Material::BindUBO(const DescriptorSetType &type,const AnsiString &name,Devi
|
||||
if(!mp)
|
||||
return(false);
|
||||
|
||||
if(!mp->BindUBO(name,ubo,dynamic))return(false);
|
||||
|
||||
mp->Update();
|
||||
return(true);
|
||||
return mp->BindUBO(name,ubo,dynamic);
|
||||
}
|
||||
|
||||
bool Material::BindSSBO(const DescriptorSetType &type,const AnsiString &name,DeviceBuffer *ubo,bool dynamic)
|
||||
@ -87,10 +84,7 @@ bool Material::BindSSBO(const DescriptorSetType &type,const AnsiString &name,Dev
|
||||
if(!mp)
|
||||
return(false);
|
||||
|
||||
if(!mp->BindSSBO(name,ubo,dynamic))return(false);
|
||||
|
||||
mp->Update();
|
||||
return(true);
|
||||
return mp->BindSSBO(name,ubo,dynamic);
|
||||
}
|
||||
|
||||
bool Material::BindImageSampler(const DescriptorSetType &type,const AnsiString &name,Texture *tex,Sampler *sampler)
|
||||
@ -100,9 +94,15 @@ bool Material::BindImageSampler(const DescriptorSetType &type,const AnsiString &
|
||||
if(!mp)
|
||||
return(false);
|
||||
|
||||
if(!mp->BindImageSampler(name,tex,sampler))return(false);
|
||||
return mp->BindImageSampler(name,tex,sampler);
|
||||
}
|
||||
|
||||
mp->Update();
|
||||
return(true);
|
||||
void Material::Update()
|
||||
{
|
||||
for(auto &mp:mp_array)
|
||||
{
|
||||
if(mp)
|
||||
mp->Update();
|
||||
}
|
||||
}
|
||||
VK_NAMESPACE_END
|
||||
|
Loading…
x
Reference in New Issue
Block a user