renamed DescriptorSetsType to DescriptorSetType

This commit is contained in:
hyzboy 2021-06-22 14:48:08 +08:00
parent 15a9c8cb38
commit 2b70ee07c8
18 changed files with 55 additions and 55 deletions

View File

@ -64,7 +64,7 @@ private:
return(false);
{
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global);
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
if(!mp_global)
return(false);

View File

@ -76,7 +76,7 @@ private:
return(false);
{
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global);
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
if(!mp_global)
return(false);

View File

@ -68,7 +68,7 @@ private:
return(false);
{
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global);
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
if(!mp_global)
return(false);

View File

@ -72,12 +72,12 @@ private:
sampler=db->CreateSampler();
{
MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetsType::Material);
MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetType::Value);
if(!mp_texture)
return(false);
if(!mp_texture->BindSampler("m_tex",texture,sampler))return(false);
if(!mp_texture->BindSampler("tex",texture,sampler))return(false);
mp_texture->Update();
}
@ -100,7 +100,7 @@ private:
return(false);
{
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global);
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
if(!mp_global)
return(false);

View File

@ -71,7 +71,7 @@ private:
return(false);
{
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global);
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
if(!mp_global)
return(false);

View File

@ -39,7 +39,7 @@ namespace hgl
MVPArrayBuffer *mvp_array;
List<RenderableInstance *> ri_list;
VkDescriptorSet ds_list[(size_t)DescriptorSetsType::RANGE_SIZE];
VkDescriptorSet ds_list[(size_t)DescriptorSetType::RANGE_SIZE];
DescriptorSets *renderable_desc_sets;
uint32_t ubo_offset;
@ -54,7 +54,7 @@ namespace hgl
private:
Pipeline * last_pipeline;
MaterialParameters *last_mp[(size_t)DescriptorSetsType::RANGE_SIZE];
MaterialParameters *last_mp[(size_t)DescriptorSetType::RANGE_SIZE];
uint32_t last_vbo;
void Render(RenderableInstance *);

View File

@ -54,7 +54,7 @@ class RenderPass;
class GPUFence;
class GPUSemaphore;
enum class DescriptorSetsType
enum class DescriptorSetType
{
//设计使其对应shader中的sets

View File

@ -48,12 +48,12 @@ public:
public:
MaterialParameters * CreateMP (const DescriptorSetsType &type)const;
MaterialParameters * GetMP (const DescriptorSetsType &type)
MaterialParameters * CreateMP (const DescriptorSetType &type)const;
MaterialParameters * GetMP (const DescriptorSetType &type)
{
if(type==DescriptorSetsType::Material )return mp_m;else
if(type==DescriptorSetsType::Renderable )return mp_r;else
if(type==DescriptorSetsType::Global )return mp_g;else
if(type==DescriptorSetType::Material )return mp_m;else
if(type==DescriptorSetType::Renderable )return mp_r;else
if(type==DescriptorSetType::Global )return mp_g;else
return(nullptr);
}

View File

@ -23,7 +23,7 @@ public:
Material *GetMaterial(){return material;}
MaterialParameters *GetMP(){return mp_value;}
MaterialParameters *GetMP(const DescriptorSetsType &type);
MaterialParameters *GetMP(const DescriptorSetType &type);
};//class MaterialInstance
VK_NAMESPACE_END
#endif//HGL_GRAPH_VULKAN_MATERIAL_INSTANCE_INCLUDE

View File

@ -9,7 +9,7 @@ class MaterialParameters
{
const ShaderModuleMap *shader_map;
DescriptorSetsType ds_type;
DescriptorSetType ds_type;
DescriptorSets *descriptor_sets;
@ -17,17 +17,17 @@ private:
friend class Material;
MaterialParameters(const ShaderModuleMap *,const DescriptorSetsType &type,DescriptorSets *);
MaterialParameters(const ShaderModuleMap *,const DescriptorSetType &type,DescriptorSets *);
public:
const DescriptorSetsType GetType (){return ds_type;}
const DescriptorSetType GetType (){return ds_type;}
DescriptorSets * GetDescriptorSet (){return descriptor_sets;}
const VkDescriptorSet GetVkDescriptorSet ()const{return descriptor_sets->GetDescriptorSet();}
public:
#define MP_TYPE_IS(name) const bool is##name()const{return ds_type==DescriptorSetsType::name;}
#define MP_TYPE_IS(name) const bool is##name()const{return ds_type==DescriptorSetType::name;}
MP_TYPE_IS(Material)
// MP_TYPE_IS(Texture)
MP_TYPE_IS(Value)

View File

@ -52,7 +52,7 @@ public:
const uint32_t GetBufferHash ()const{return buffer_hash;}
MaterialParameters *GetMP (const DescriptorSetsType &type){return mat_inst->GetMP(type);}
MaterialParameters *GetMP (const DescriptorSetType &type){return mat_inst->GetMP(type);}
};//class RenderableInstance
RenderableInstance *CreateRenderableInstance(Renderable *,MaterialInstance *,Pipeline *);

View File

@ -37,12 +37,12 @@ int Comparator<RenderNodePointer>::compare(const RenderNodePointer &obj_one,cons
//比较材质实例
{
for(int i =(int)hgl::graph::DescriptorSetsType::BEGIN_RANGE;
i<=(int)hgl::graph::DescriptorSetsType::END_RANGE;
for(int i =(int)hgl::graph::DescriptorSetType::BEGIN_RANGE;
i<=(int)hgl::graph::DescriptorSetType::END_RANGE;
i++)
{
off=ri_one->GetMP((hgl::graph::DescriptorSetsType)i)
-ri_two->GetMP((hgl::graph::DescriptorSetsType)i);
off=ri_one->GetMP((hgl::graph::DescriptorSetType)i)
-ri_two->GetMP((hgl::graph::DescriptorSetType)i);
if(off)
return off;
@ -149,7 +149,7 @@ namespace hgl
//为所有的材质绑定
for(Material *mtl:material_sets)
{
MaterialParameters *mp=mtl->GetMP(DescriptorSetsType::Renderable);
MaterialParameters *mp=mtl->GetMP(DescriptorSetType::Renderable);
if(mp)
mp->BindUBO("r_scene_info",mvp_array->GetBuffer(),false);
@ -212,11 +212,11 @@ namespace hgl
int ds_count=0;
MaterialParameters *mp;
for(int i=(int)DescriptorSetsType::BEGIN_RANGE;
i<(int)DescriptorSetsType::Renderable;
for(int i=(int)DescriptorSetType::BEGIN_RANGE;
i<(int)DescriptorSetType::Renderable;
i++)
{
mp=ri->GetMP((DescriptorSetsType)i);
mp=ri->GetMP((DescriptorSetType)i);
if(last_mp[i]!=mp)
{
@ -231,7 +231,7 @@ namespace hgl
}
{
mp=ri->GetMP(DescriptorSetsType::Renderable);
mp=ri->GetMP(DescriptorSetType::Renderable);
if(mp)
{

View File

@ -109,11 +109,11 @@ bool RenderCmdBuffer::BindDescriptorSets(RenderableInstance *ri)
uint32_t count=0;
MaterialParameters *mp;
VkDescriptorSet ds[(size_t)DescriptorSetsType::RANGE_SIZE];
VkDescriptorSet ds[(size_t)DescriptorSetType::RANGE_SIZE];
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
ENUM_CLASS_FOR(DescriptorSetType,int,i)
{
mp=ri->GetMP((DescriptorSetsType)i);
mp=ri->GetMP((DescriptorSetType)i);
if(mp)
{

View File

@ -22,10 +22,10 @@ void DescriptorSetLayoutCreater::Bind(const ShaderDescriptorList *sd_list,VkDesc
{
if(!sd_list||sd_list->GetCount()<=0)return;
uint32_t binding_count[size_t(DescriptorSetsType::RANGE_SIZE)],
old_count[size_t(DescriptorSetsType::RANGE_SIZE)],
fin_count[size_t(DescriptorSetsType::RANGE_SIZE)];
VkDescriptorSetLayoutBinding *p[size_t(DescriptorSetsType::RANGE_SIZE)];
uint32_t binding_count[size_t(DescriptorSetType::RANGE_SIZE)],
old_count[size_t(DescriptorSetType::RANGE_SIZE)],
fin_count[size_t(DescriptorSetType::RANGE_SIZE)];
VkDescriptorSetLayoutBinding *p[size_t(DescriptorSetType::RANGE_SIZE)];
hgl_zero(binding_count);
hgl_zero(old_count);
@ -39,7 +39,7 @@ void DescriptorSetLayoutCreater::Bind(const ShaderDescriptorList *sd_list,VkDesc
++binding_count[sd.set];
}
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
ENUM_CLASS_FOR(DescriptorSetType,int,i)
if(binding_count[i]>0)
{
old_count[i]=sds[i].binding_list.GetCount();
@ -67,7 +67,7 @@ void DescriptorSetLayoutCreater::Bind(const ShaderDescriptorList *sd_list,VkDesc
}
}
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
ENUM_CLASS_FOR(DescriptorSetType,int,i)
if(binding_count[i]>0)
sds[i].binding_list.SetCount(old_count[i]+fin_count[i]);
}
@ -76,7 +76,7 @@ bool DescriptorSetLayoutCreater::CreatePipelineLayout()
{
fin_dsl_count=0;
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
ENUM_CLASS_FOR(DescriptorSetType,int,i)
{
const int count=sds[i].binding_list.GetCount();
@ -120,12 +120,12 @@ bool DescriptorSetLayoutCreater::CreatePipelineLayout()
return(true);
}
DescriptorSets *DescriptorSetLayoutCreater::Create(const DescriptorSetsType &type)const
DescriptorSets *DescriptorSetLayoutCreater::Create(const DescriptorSetType &type)const
{
if(!pipeline_layout)
return(nullptr);
ENUM_CLASS_RANGE_ERROR_RETURN_NULLPTR(DescriptorSetsType,type);
ENUM_CLASS_RANGE_ERROR_RETURN_NULLPTR(DescriptorSetType,type);
const uint32_t count=sds[(size_t)type].binding_list.GetCount();

View File

@ -24,9 +24,9 @@ class DescriptorSetLayoutCreater
VkDescriptorSetLayout layout;
};
ShaderDescriptorSet sds[size_t(DescriptorSetsType::RANGE_SIZE)];
ShaderDescriptorSet sds[size_t(DescriptorSetType::RANGE_SIZE)];
VkDescriptorSetLayout fin_dsl[size_t(DescriptorSetsType::RANGE_SIZE)];
VkDescriptorSetLayout fin_dsl[size_t(DescriptorSetType::RANGE_SIZE)];
uint32_t fin_dsl_count;
VkPipelineLayout pipeline_layout=VK_NULL_HANDLE;
@ -35,7 +35,7 @@ public:
DescriptorSetLayoutCreater(VkDevice dev,VkDescriptorPool dp)
{
ENUM_CLASS_FOR(DescriptorSetsType,int,i)
ENUM_CLASS_FOR(DescriptorSetType,int,i)
sds[i].layout=nullptr;
hgl_zero(fin_dsl);
@ -83,6 +83,6 @@ public:
const VkPipelineLayout GetPipelineLayout()const{return pipeline_layout;}
DescriptorSets *Create(const DescriptorSetsType &type)const;
DescriptorSets *Create(const DescriptorSetType &type)const;
};//class DescriptorSetLayoutCreater
VK_NAMESPACE_END

View File

@ -22,9 +22,9 @@ Material::Material(const UTF8String &name,ShaderModuleMap *smm,List<VkPipelineSh
vab=nullptr;
}
mp_m=CreateMP(DescriptorSetsType::Material);
mp_r=CreateMP(DescriptorSetsType::Renderable);
mp_g=CreateMP(DescriptorSetsType::Global);
mp_m=CreateMP(DescriptorSetType::Material);
mp_r=CreateMP(DescriptorSetType::Renderable);
mp_g=CreateMP(DescriptorSetType::Global);
}
Material::~Material()
@ -50,7 +50,7 @@ const VkPipelineLayout Material::GetPipelineLayout()const
return dsl_creater->GetPipelineLayout();
}
MaterialParameters *Material::CreateMP(const DescriptorSetsType &type)const
MaterialParameters *Material::CreateMP(const DescriptorSetType &type)const
{
DescriptorSets *ds=dsl_creater->Create(type);

View File

@ -5,7 +5,7 @@
VK_NAMESPACE_BEGIN
MaterialInstance *Material::CreateInstance()
{
MaterialParameters *mp=CreateMP(DescriptorSetsType::Value);
MaterialParameters *mp=CreateMP(DescriptorSetType::Value);
return(new MaterialInstance(this,mp));
}
@ -22,12 +22,12 @@ MaterialInstance::~MaterialInstance()
SAFE_CLEAR(mp_value);
}
MaterialParameters *MaterialInstance::GetMP(const DescriptorSetsType &type)
MaterialParameters *MaterialInstance::GetMP(const DescriptorSetType &type)
{
//if(type==DescriptorSetsType::Texture
//if(type==DescriptorSetType::Texture
// return mp_texture;
if(type==DescriptorSetsType::Value)
if(type==DescriptorSetType::Value)
return mp_value;
return material->GetMP(type);

View File

@ -4,7 +4,7 @@
#include<hgl/graph/VKDescriptorSets.h>
VK_NAMESPACE_BEGIN
MaterialParameters::MaterialParameters(const ShaderModuleMap *smm,const DescriptorSetsType &type,DescriptorSets *ds)
MaterialParameters::MaterialParameters(const ShaderModuleMap *smm,const DescriptorSetType &type,DescriptorSets *ds)
{
shader_map=smm;
ds_type=type;