diff --git a/example/Vulkan/FragCoordTest.cpp b/example/Vulkan/FragCoordTest.cpp index 0b93ab01..1d1c9316 100644 --- a/example/Vulkan/FragCoordTest.cpp +++ b/example/Vulkan/FragCoordTest.cpp @@ -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); diff --git a/example/Vulkan/first_triangle.cpp b/example/Vulkan/first_triangle.cpp index 13fc50fc..b51918aa 100644 --- a/example/Vulkan/first_triangle.cpp +++ b/example/Vulkan/first_triangle.cpp @@ -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); diff --git a/example/Vulkan/indices_rect.cpp b/example/Vulkan/indices_rect.cpp index e7a51883..a0885878 100644 --- a/example/Vulkan/indices_rect.cpp +++ b/example/Vulkan/indices_rect.cpp @@ -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); diff --git a/example/Vulkan/texture_rect.cpp b/example/Vulkan/texture_rect.cpp index 900a62ed..7c6fef25 100644 --- a/example/Vulkan/texture_rect.cpp +++ b/example/Vulkan/texture_rect.cpp @@ -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); diff --git a/example/Vulkan/two_triangle.cpp b/example/Vulkan/two_triangle.cpp index e54b702b..92a01a23 100644 --- a/example/Vulkan/two_triangle.cpp +++ b/example/Vulkan/two_triangle.cpp @@ -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); diff --git a/inc/hgl/graph/RenderList.h b/inc/hgl/graph/RenderList.h index 6ee80e84..6fc7c73f 100644 --- a/inc/hgl/graph/RenderList.h +++ b/inc/hgl/graph/RenderList.h @@ -39,7 +39,7 @@ namespace hgl MVPArrayBuffer *mvp_array; List 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 *); diff --git a/inc/hgl/graph/VK.h b/inc/hgl/graph/VK.h index 5afc29a2..0f524435 100644 --- a/inc/hgl/graph/VK.h +++ b/inc/hgl/graph/VK.h @@ -54,7 +54,7 @@ class RenderPass; class GPUFence; class GPUSemaphore; -enum class DescriptorSetsType +enum class DescriptorSetType { //设计使其对应shader中的sets diff --git a/inc/hgl/graph/VKMaterial.h b/inc/hgl/graph/VKMaterial.h index 9323b850..a8ee66bc 100644 --- a/inc/hgl/graph/VKMaterial.h +++ b/inc/hgl/graph/VKMaterial.h @@ -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); } diff --git a/inc/hgl/graph/VKMaterialInstance.h b/inc/hgl/graph/VKMaterialInstance.h index c0eaf70f..8827414f 100644 --- a/inc/hgl/graph/VKMaterialInstance.h +++ b/inc/hgl/graph/VKMaterialInstance.h @@ -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 diff --git a/inc/hgl/graph/VKMaterialParameters.h b/inc/hgl/graph/VKMaterialParameters.h index 0fb9c8d6..f35d3991 100644 --- a/inc/hgl/graph/VKMaterialParameters.h +++ b/inc/hgl/graph/VKMaterialParameters.h @@ -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) diff --git a/inc/hgl/graph/VKRenderableInstance.h b/inc/hgl/graph/VKRenderableInstance.h index bcc9ba6e..e80b74da 100644 --- a/inc/hgl/graph/VKRenderableInstance.h +++ b/inc/hgl/graph/VKRenderableInstance.h @@ -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 *); diff --git a/src/SceneGraph/RenderList.cpp b/src/SceneGraph/RenderList.cpp index cd204889..ff9251d6 100644 --- a/src/SceneGraph/RenderList.cpp +++ b/src/SceneGraph/RenderList.cpp @@ -37,12 +37,12 @@ int Comparator::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) { diff --git a/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp b/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp index dc950686..2d05cc4b 100644 --- a/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp +++ b/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp @@ -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) { diff --git a/src/SceneGraph/Vulkan/VKDescriptorSetLayoutCreater.cpp b/src/SceneGraph/Vulkan/VKDescriptorSetLayoutCreater.cpp index 6abaf431..22afaa3e 100644 --- a/src/SceneGraph/Vulkan/VKDescriptorSetLayoutCreater.cpp +++ b/src/SceneGraph/Vulkan/VKDescriptorSetLayoutCreater.cpp @@ -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(); diff --git a/src/SceneGraph/Vulkan/VKDescriptorSetLayoutCreater.h b/src/SceneGraph/Vulkan/VKDescriptorSetLayoutCreater.h index 08c87ff1..cb140ad4 100644 --- a/src/SceneGraph/Vulkan/VKDescriptorSetLayoutCreater.h +++ b/src/SceneGraph/Vulkan/VKDescriptorSetLayoutCreater.h @@ -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 \ No newline at end of file diff --git a/src/SceneGraph/Vulkan/VKMaterial.cpp b/src/SceneGraph/Vulkan/VKMaterial.cpp index c6e08edd..3178ff5d 100644 --- a/src/SceneGraph/Vulkan/VKMaterial.cpp +++ b/src/SceneGraph/Vulkan/VKMaterial.cpp @@ -22,9 +22,9 @@ Material::Material(const UTF8String &name,ShaderModuleMap *smm,ListGetPipelineLayout(); } -MaterialParameters *Material::CreateMP(const DescriptorSetsType &type)const +MaterialParameters *Material::CreateMP(const DescriptorSetType &type)const { DescriptorSets *ds=dsl_creater->Create(type); diff --git a/src/SceneGraph/Vulkan/VKMaterialInstance.cpp b/src/SceneGraph/Vulkan/VKMaterialInstance.cpp index acb4e1da..ca99df7d 100644 --- a/src/SceneGraph/Vulkan/VKMaterialInstance.cpp +++ b/src/SceneGraph/Vulkan/VKMaterialInstance.cpp @@ -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); diff --git a/src/SceneGraph/Vulkan/VKMaterialParameters.cpp b/src/SceneGraph/Vulkan/VKMaterialParameters.cpp index 2d014a82..40fe114c 100644 --- a/src/SceneGraph/Vulkan/VKMaterialParameters.cpp +++ b/src/SceneGraph/Vulkan/VKMaterialParameters.cpp @@ -4,7 +4,7 @@ #include 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;