From af4b9cd6d47bc984577706a86139781ea83cb00b Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Wed, 22 Feb 2023 21:53:51 +0800 Subject: [PATCH] renamed to DescriptorSetType instead of DescriptorSetsType --- example/2dVector/line.cpp | 4 ++-- example/2dVector/roundbox.cpp | 4 ++-- example/Vulkan/Atmosphere.cpp | 2 +- example/Vulkan/Cubemap.cpp | 4 ++-- example/Vulkan/DeferredRender.cpp | 4 ++-- example/Vulkan/DrawTile.cpp | 2 +- example/Vulkan/EquirectangularMap.cpp | 2 +- example/Vulkan/InlineGeometryScene.cpp | 4 ++-- example/Vulkan/OffscreenRender.cpp | 2 +- example/Vulkan/RectanglePrimitive.cpp | 2 +- example/Vulkan/SceneTree.cpp | 2 +- example/Vulkan/SkyColor.cpp | 2 +- example/Vulkan/texture_rect.cpp | 2 +- example/common/VulkanAppFramework.h | 2 +- inc/hgl/graph/RenderList.h | 4 ++-- inc/hgl/graph/VK.h | 4 ++-- inc/hgl/graph/VKDevice.h | 6 +++--- inc/hgl/graph/VKMaterial.h | 6 +++--- inc/hgl/graph/VKMaterialDescriptorSets.h | 12 ++++++------ inc/hgl/graph/VKMaterialInstance.h | 8 ++++---- inc/hgl/graph/VKMaterialParameters.h | 8 ++++---- inc/hgl/graph/VKRenderable.h | 2 +- src/SceneGraph/RenderList.cpp | 18 +++++++++--------- .../Vulkan/VKCommandBufferRender.cpp | 8 ++++---- src/SceneGraph/Vulkan/VKDeviceMaterial.cpp | 16 ++++++++-------- src/SceneGraph/Vulkan/VKMaterial.cpp | 4 ++-- .../Vulkan/VKMaterialDescriptorSets.cpp | 8 ++++---- src/SceneGraph/Vulkan/VKMaterialInstance.cpp | 8 ++++---- src/SceneGraph/Vulkan/VKMaterialParameters.cpp | 2 +- src/SceneGraph/Vulkan/VKPipelineLayoutData.cpp | 6 +++--- src/SceneGraph/Vulkan/VKPipelineLayoutData.h | 6 +++--- .../Vulkan/VKRenderResourceMaterial.cpp | 12 ++++++------ src/SceneGraph/font/TextRender.cpp | 4 ++-- 33 files changed, 90 insertions(+), 90 deletions(-) diff --git a/example/2dVector/line.cpp b/example/2dVector/line.cpp index c1e97f62..5b4efffe 100644 --- a/example/2dVector/line.cpp +++ b/example/2dVector/line.cpp @@ -82,7 +82,7 @@ private: cam.RefreshCameraInfo(); { - MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global); + MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global); if(!mp_global) return(false); @@ -95,7 +95,7 @@ private: { - MaterialParameters *mp_value=material_instance->GetMP(DescriptorSetsType::Value); + MaterialParameters *mp_value=material_instance->GetMP(DescriptorSetType::Value); if(!mp_value) return(false); diff --git a/example/2dVector/roundbox.cpp b/example/2dVector/roundbox.cpp index 168c8c79..b27308a8 100644 --- a/example/2dVector/roundbox.cpp +++ b/example/2dVector/roundbox.cpp @@ -94,7 +94,7 @@ private: cam.RefreshCameraInfo(); { - MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global); + MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global); if(!mp_global) return(false); @@ -108,7 +108,7 @@ private: } { - MaterialParameters *mp_value=material_instance->GetMP(DescriptorSetsType::Value); + MaterialParameters *mp_value=material_instance->GetMP(DescriptorSetType::Value); if(!mp_value) return(false); diff --git a/example/Vulkan/Atmosphere.cpp b/example/Vulkan/Atmosphere.cpp index 9c81c4e0..1cf3dcec 100644 --- a/example/Vulkan/Atmosphere.cpp +++ b/example/Vulkan/Atmosphere.cpp @@ -67,7 +67,7 @@ private: return(false); { - MaterialParameters *mp=material_instance->GetMP(DescriptorSetsType::Value); + MaterialParameters *mp=material_instance->GetMP(DescriptorSetType::Value); if(!mp)return(false); diff --git a/example/Vulkan/Cubemap.cpp b/example/Vulkan/Cubemap.cpp index 392b6e96..2bb56629 100644 --- a/example/Vulkan/Cubemap.cpp +++ b/example/Vulkan/Cubemap.cpp @@ -98,7 +98,7 @@ private: sky_mi=db->CreateMaterialInstance(sky_material); if(!sky_mi)return(false); - if(!sky_mi->BindSampler(DescriptorSetsType::Value,"tex" ,texture, sampler))return(false); + if(!sky_mi->BindSampler(DescriptorSetType::Value,"tex" ,texture, sampler))return(false); sky_pipeline=CreatePipeline(sky_mi,InlinePipeline::Sky,Prim::Triangles); if(!sky_pipeline)return(false); @@ -111,7 +111,7 @@ private: envmap_mi=db->CreateMaterialInstance(envmap_material); if(!envmap_mi)return(false); - if(!envmap_mi->BindSampler(DescriptorSetsType::Value,"EnvCubemap" ,texture, sampler))return(false); + if(!envmap_mi->BindSampler(DescriptorSetType::Value,"EnvCubemap" ,texture, sampler))return(false); solid_pipeline=CreatePipeline(envmap_mi,InlinePipeline::Solid3D,Prim::Triangles); } diff --git a/example/Vulkan/DeferredRender.cpp b/example/Vulkan/DeferredRender.cpp index 61cf4cc7..b93314a8 100644 --- a/example/Vulkan/DeferredRender.cpp +++ b/example/Vulkan/DeferredRender.cpp @@ -311,7 +311,7 @@ private: BindCameraUBO(sp_gbuffer.material_instance); { - MaterialParameters *mp=sp_gbuffer.material_instance->GetMP(DescriptorSetsType::Value); + MaterialParameters *mp=sp_gbuffer.material_instance->GetMP(DescriptorSetType::Value); if(!mp) return(false); @@ -324,7 +324,7 @@ private: BindCameraUBO(sp_composition.material_instance); { - MaterialParameters *mp=sp_composition.material_instance->GetMP(DescriptorSetsType::Value); + MaterialParameters *mp=sp_composition.material_instance->GetMP(DescriptorSetType::Value); if(!mp) return(false); diff --git a/example/Vulkan/DrawTile.cpp b/example/Vulkan/DrawTile.cpp index 74e6b85a..98aa0c58 100644 --- a/example/Vulkan/DrawTile.cpp +++ b/example/Vulkan/DrawTile.cpp @@ -165,7 +165,7 @@ private: sampler=db->CreateSampler(); - if(!material_instance->BindSampler(DescriptorSetsType::Value,"tex",tile_data->GetTexture(),sampler))return(false); + if(!material_instance->BindSampler(DescriptorSetType::Value,"tex",tile_data->GetTexture(),sampler))return(false); return(true); } diff --git a/example/Vulkan/EquirectangularMap.cpp b/example/Vulkan/EquirectangularMap.cpp index 064dbdc0..e4067114 100644 --- a/example/Vulkan/EquirectangularMap.cpp +++ b/example/Vulkan/EquirectangularMap.cpp @@ -54,7 +54,7 @@ private: envmap_mi=db->CreateMaterialInstance(OS_TEXT("res/material/EnvEquirectangularMap")); if(!envmap_mi)return(false); - if(!envmap_mi->BindSampler(DescriptorSetsType::Value,"Envmap" ,texture, sampler))return(false); + if(!envmap_mi->BindSampler(DescriptorSetType::Value,"Envmap" ,texture, sampler))return(false); } solid_pipeline=CreatePipeline(envmap_mi,InlinePipeline::Solid3D,Prim::Triangles); diff --git a/example/Vulkan/InlineGeometryScene.cpp b/example/Vulkan/InlineGeometryScene.cpp index 81cb115b..16e3e102 100644 --- a/example/Vulkan/InlineGeometryScene.cpp +++ b/example/Vulkan/InlineGeometryScene.cpp @@ -129,7 +129,7 @@ private: if(!material_instance)return(false); { - MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetsType::Value); + MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetType::Value); if(!mp_texture) return(false); @@ -216,7 +216,7 @@ private: ubo_phong=db->CreateUBO(sizeof(PhongMaterial),&phong); { - MaterialParameters *mp_value=material_instance->GetMP(DescriptorSetsType::Value); + MaterialParameters *mp_value=material_instance->GetMP(DescriptorSetType::Value); if(!mp_value) return(false); diff --git a/example/Vulkan/OffscreenRender.cpp b/example/Vulkan/OffscreenRender.cpp index 0a92b294..a68c754d 100644 --- a/example/Vulkan/OffscreenRender.cpp +++ b/example/Vulkan/OffscreenRender.cpp @@ -135,7 +135,7 @@ public: cube.sampler=db->CreateSampler(); if(!cube.sampler)return(false); - if(!cube.material_instance->BindSampler(DescriptorSetsType::Value,"tex",os.render_taget->GetColorTexture(),cube.sampler)) + if(!cube.material_instance->BindSampler(DescriptorSetType::Value,"tex",os.render_taget->GetColorTexture(),cube.sampler)) return(false); { diff --git a/example/Vulkan/RectanglePrimitive.cpp b/example/Vulkan/RectanglePrimitive.cpp index 1895aa9d..c46e74df 100644 --- a/example/Vulkan/RectanglePrimitive.cpp +++ b/example/Vulkan/RectanglePrimitive.cpp @@ -59,7 +59,7 @@ private: sampler=db->CreateSampler(); - if(!material_instance->BindSampler(DescriptorSetsType::Value,"tex",texture,sampler))return(false); + if(!material_instance->BindSampler(DescriptorSetType::Value,"tex",texture,sampler))return(false); return(true); } diff --git a/example/Vulkan/SceneTree.cpp b/example/Vulkan/SceneTree.cpp index fd018e06..9ccd1696 100644 --- a/example/Vulkan/SceneTree.cpp +++ b/example/Vulkan/SceneTree.cpp @@ -84,7 +84,7 @@ private: if(!ubo_sun)return(false); { - MaterialParameters *mp=material_instance->GetMP(DescriptorSetsType::Value); + MaterialParameters *mp=material_instance->GetMP(DescriptorSetType::Value); if(!mp)return(false); diff --git a/example/Vulkan/SkyColor.cpp b/example/Vulkan/SkyColor.cpp index 64ce951e..ab8949ab 100644 --- a/example/Vulkan/SkyColor.cpp +++ b/example/Vulkan/SkyColor.cpp @@ -71,7 +71,7 @@ private: if(!ubo_sky_color) return(false); - if(!material_instance->BindUBO(DescriptorSetsType::Value,"sky_color",ubo_sky_color)) + if(!material_instance->BindUBO(DescriptorSetType::Value,"sky_color",ubo_sky_color)) return(false); return(true); diff --git a/example/Vulkan/texture_rect.cpp b/example/Vulkan/texture_rect.cpp index 515dcab6..5b772bc7 100644 --- a/example/Vulkan/texture_rect.cpp +++ b/example/Vulkan/texture_rect.cpp @@ -73,7 +73,7 @@ private: sampler=db->CreateSampler(); - if(!material_instance->BindSampler(DescriptorSetsType::Value,"tex",texture,sampler))return(false); + if(!material_instance->BindSampler(DescriptorSetType::Value,"tex",texture,sampler))return(false); return(true); } diff --git a/example/common/VulkanAppFramework.h b/example/common/VulkanAppFramework.h index 5081b8e3..673e7bff 100644 --- a/example/common/VulkanAppFramework.h +++ b/example/common/VulkanAppFramework.h @@ -156,7 +156,7 @@ public: bool BindCameraUBO(MaterialInstance *mi) { - return mi->BindUBO(DescriptorSetsType::Global,"g_camera",ubo_camera_info); + return mi->BindUBO(DescriptorSetType::Global,"g_camera",ubo_camera_info); } virtual void Resize(int w,int h) diff --git a/inc/hgl/graph/RenderList.h b/inc/hgl/graph/RenderList.h index 6fd3c4b5..50cef763 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]; DescriptorSet *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(Renderable *); diff --git a/inc/hgl/graph/VK.h b/inc/hgl/graph/VK.h index 67c9e35d..de22e0c0 100644 --- a/inc/hgl/graph/VK.h +++ b/inc/hgl/graph/VK.h @@ -70,7 +70,7 @@ class DeviceRenderPassManage; class Fence; class Semaphore; -enum class DescriptorSetsType +enum class DescriptorSetType { //设计使其对应shader中的set @@ -90,7 +90,7 @@ constexpr char *DescriptSetsTypeName[]= "Global","PerFrame","PerMaterial","PerObject","Instance","Skeleton" }; -inline const char *GetDescriptorSetsTypeName(const enum class DescriptorSetsType &type) +inline const char *GetDescriptorSetTypeName(const enum class DescriptorSetType &type) { RANGE_CHECK_RETURN_NULLPTR(type); diff --git a/inc/hgl/graph/VKDevice.h b/inc/hgl/graph/VKDevice.h index 14c9048b..848d99cd 100644 --- a/inc/hgl/graph/VKDevice.h +++ b/inc/hgl/graph/VKDevice.h @@ -219,9 +219,9 @@ public: //shader & material PipelineLayoutData *CreatePipelineLayoutData(const MaterialDescriptorSets *); void Destroy(PipelineLayoutData *); - DescriptorSet * CreateDescriptorSets(const PipelineLayoutData *,const DescriptorSetsType &type)const; - MaterialParameters *CreateMP(const MaterialDescriptorSets *,const PipelineLayoutData *,const DescriptorSetsType &); - MaterialParameters *CreateMP(Material *,const DescriptorSetsType &); + DescriptorSet * CreateDescriptorSets(const PipelineLayoutData *,const DescriptorSetType &type)const; + MaterialParameters *CreateMP(const MaterialDescriptorSets *,const PipelineLayoutData *,const DescriptorSetType &); + MaterialParameters *CreateMP(Material *,const DescriptorSetType &); ShaderModule *CreateShaderModule(ShaderResource *); diff --git a/inc/hgl/graph/VKMaterial.h b/inc/hgl/graph/VKMaterial.h index 8aaf6769..f83ce6e1 100644 --- a/inc/hgl/graph/VKMaterial.h +++ b/inc/hgl/graph/VKMaterial.h @@ -8,7 +8,7 @@ VK_NAMESPACE_BEGIN using ShaderStageCreateInfoList=List; -using MaterialParameterArray=MaterialParameters *[size_t(DescriptorSetsType::RANGE_SIZE)]; +using MaterialParameterArray=MaterialParameters *[size_t(DescriptorSetType::RANGE_SIZE)]; struct MaterialData { @@ -63,14 +63,14 @@ public: public: - MaterialParameters * GetMP (const DescriptorSetsType &type) + MaterialParameters * GetMP (const DescriptorSetType &type) { RANGE_CHECK_RETURN_NULLPTR(type) return data->mp_array[size_t(type)]; } - const bool hasSet (const DescriptorSetsType &type)const; + const bool hasSet (const DescriptorSetType &type)const; };//class Material VK_NAMESPACE_END #endif//HGL_GRAPH_VULKAN_MATERIAL_INCLUDE diff --git a/inc/hgl/graph/VKMaterialDescriptorSets.h b/inc/hgl/graph/VKMaterialDescriptorSets.h index 17d55996..42224fbc 100644 --- a/inc/hgl/graph/VKMaterialDescriptorSets.h +++ b/inc/hgl/graph/VKMaterialDescriptorSets.h @@ -10,7 +10,7 @@ struct ShaderDescriptor char name[128]; VkDescriptorType desc_type; - DescriptorSetsType set_type; + DescriptorSetType set_type; uint32_t set; uint32_t binding; uint32_t stage_flag; @@ -26,7 +26,7 @@ class MaterialDescriptorSets uint sd_count; ShaderDescriptorList descriptor_list[VK_DESCRIPTOR_TYPE_RANGE_SIZE]; - ShaderDescriptorList descriptor_list_by_set_type[size_t(DescriptorSetsType::RANGE_SIZE)]; + ShaderDescriptorList descriptor_list_by_set_type[size_t(DescriptorSetType::RANGE_SIZE)]; Map sd_by_name; Map binding_map[VK_DESCRIPTOR_TYPE_RANGE_SIZE]; @@ -35,7 +35,7 @@ class MaterialDescriptorSets private: - DescriptorSetLayoutCreateInfo dsl_ci[size_t(DescriptorSetsType::RANGE_SIZE)]; + DescriptorSetLayoutCreateInfo dsl_ci[size_t(DescriptorSetType::RANGE_SIZE)]; public: @@ -51,11 +51,11 @@ public: const int GetSampler (const AnsiString &name )const{return GetBinding(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,name);} const int GetAttachment (const AnsiString &name )const{return GetBinding(VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT,name);} - const DescriptorSetLayoutCreateInfo *GetDSLCI(const DescriptorSetsType &type)const{return dsl_ci+size_t(type);} + const DescriptorSetLayoutCreateInfo *GetDSLCI(const DescriptorSetType &type)const{return dsl_ci+size_t(type);} - const ShaderDescriptorList &GetDescriptorList(const DescriptorSetsType &type)const{return descriptor_list_by_set_type[size_t(type)];} + const ShaderDescriptorList &GetDescriptorList(const DescriptorSetType &type)const{return descriptor_list_by_set_type[size_t(type)];} - const bool hasSet(const DescriptorSetsType &type)const{return !descriptor_list_by_set_type[size_t(type)].IsEmpty();} + const bool hasSet(const DescriptorSetType &type)const{return !descriptor_list_by_set_type[size_t(type)].IsEmpty();} };//class MaterialDescriptorSets VK_NAMESPACE_END #endif//HGL_GRAPH_VULKAN_MATERIAL_DESCRIPTOR_SETS_INCLUDE diff --git a/inc/hgl/graph/VKMaterialInstance.h b/inc/hgl/graph/VKMaterialInstance.h index f4d0d863..9d6f4c89 100644 --- a/inc/hgl/graph/VKMaterialInstance.h +++ b/inc/hgl/graph/VKMaterialInstance.h @@ -26,11 +26,11 @@ public: const VIL *GetVIL()const{return vil;} MaterialParameters *GetMP(){return mp_per_mi;} - MaterialParameters *GetMP(const DescriptorSetsType &type){return material->GetMP(type);} + MaterialParameters *GetMP(const DescriptorSetType &type){return material->GetMP(type);} - bool BindUBO(const DescriptorSetsType &type,const AnsiString &name,DeviceBuffer *ubo,bool dynamic=false); - bool BindSSBO(const DescriptorSetsType &type,const AnsiString &name,DeviceBuffer *ubo,bool dynamic=false); - bool BindSampler(const DescriptorSetsType &type,const AnsiString &name,Texture *tex,Sampler *sampler); + bool BindUBO(const DescriptorSetType &type,const AnsiString &name,DeviceBuffer *ubo,bool dynamic=false); + bool BindSSBO(const DescriptorSetType &type,const AnsiString &name,DeviceBuffer *ubo,bool dynamic=false); + bool BindSampler(const DescriptorSetType &type,const AnsiString &name,Texture *tex,Sampler *sampler); };//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 1309ae8e..1b27f382 100644 --- a/inc/hgl/graph/VKMaterialParameters.h +++ b/inc/hgl/graph/VKMaterialParameters.h @@ -9,7 +9,7 @@ class MaterialParameters { const MaterialDescriptorSets *mds; - DescriptorSetsType ds_type; + DescriptorSetType ds_type; DescriptorSet *descriptor_sets; @@ -17,11 +17,11 @@ private: friend class GPUDevice; - MaterialParameters(const MaterialDescriptorSets *,const DescriptorSetsType &type,DescriptorSet *); + MaterialParameters(const MaterialDescriptorSets *,const DescriptorSetType &type,DescriptorSet *); public: - const DescriptorSetsType GetType (){return ds_type;} + const DescriptorSetType GetType (){return ds_type;} DescriptorSet * GetDescriptorSet (){return descriptor_sets;} const VkDescriptorSet GetVkDescriptorSet ()const{return descriptor_sets->GetDescriptorSet();} @@ -30,7 +30,7 @@ public: 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(Skeleton) MP_TYPE_IS(Instance) MP_TYPE_IS(PerObject) diff --git a/inc/hgl/graph/VKRenderable.h b/inc/hgl/graph/VKRenderable.h index 4d880614..d4b19ba0 100644 --- a/inc/hgl/graph/VKRenderable.h +++ b/inc/hgl/graph/VKRenderable.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);} public: //instance support diff --git a/src/SceneGraph/RenderList.cpp b/src/SceneGraph/RenderList.cpp index 82a964b4..d14ec89c 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; @@ -151,7 +151,7 @@ namespace hgl //为所有的材质绑定 for(Material *mtl:material_sets) { - MaterialParameters *mp=mtl->GetMP(DescriptorSetsType::PerObject); + MaterialParameters *mp=mtl->GetMP(DescriptorSetType::PerObject); if(mp) { @@ -218,11 +218,11 @@ namespace hgl uint32_t first_set=0; MaterialParameters *mp; - for(int i=(int)DescriptorSetsType::BEGIN_RANGE; - i<(int)DescriptorSetsType::PerObject; + for(int i=(int)DescriptorSetType::BEGIN_RANGE; + i<(int)DescriptorSetType::PerObject; i++) { - mp=ri->GetMP((DescriptorSetsType)i); + mp=ri->GetMP((DescriptorSetType)i); if(last_mp[i]!=mp) { @@ -242,7 +242,7 @@ namespace hgl } { - mp=ri->GetMP(DescriptorSetsType::PerObject); + mp=ri->GetMP(DescriptorSetType::PerObject); if(mp) { diff --git a/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp b/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp index 0310a9ba..492f0d98 100644 --- a/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp +++ b/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp @@ -112,18 +112,18 @@ bool RenderCmdBuffer::BindDescriptorSets(Renderable *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) { ds[count]=mp->GetVkDescriptorSet(); ++count; - if((DescriptorSetsType)i==DescriptorSetsType::PerObject) + if((DescriptorSetType)i==DescriptorSetType::PerObject) { dynamic_count=mp->GetCount(); diff --git a/src/SceneGraph/Vulkan/VKDeviceMaterial.cpp b/src/SceneGraph/Vulkan/VKDeviceMaterial.cpp index 3d904bbe..67e73f6d 100644 --- a/src/SceneGraph/Vulkan/VKDeviceMaterial.cpp +++ b/src/SceneGraph/Vulkan/VKDeviceMaterial.cpp @@ -8,7 +8,7 @@ #include"VKPipelineLayoutData.h" VK_NAMESPACE_BEGIN -DescriptorSet *GPUDevice::CreateDescriptorSets(const PipelineLayoutData *pld,const DescriptorSetsType &type)const +DescriptorSet *GPUDevice::CreateDescriptorSets(const PipelineLayoutData *pld,const DescriptorSetType &type)const { RANGE_CHECK_RETURN_NULLPTR(type); @@ -31,10 +31,10 @@ DescriptorSet *GPUDevice::CreateDescriptorSets(const PipelineLayoutData *pld,con return(new DescriptorSet(attr->device,binding_count,pld->pipeline_layout,desc_set)); } -MaterialParameters *GPUDevice::CreateMP(const MaterialDescriptorSets *mds,const PipelineLayoutData *pld,const DescriptorSetsType &desc_set_type) +MaterialParameters *GPUDevice::CreateMP(const MaterialDescriptorSets *mds,const PipelineLayoutData *pld,const DescriptorSetType &desc_set_type) { if(!mds||!pld)return(nullptr); - if(!RangeCheck(desc_set_type)) + if(!RangeCheck(desc_set_type)) return(nullptr); DescriptorSet *ds=CreateDescriptorSets(pld,desc_set_type); @@ -44,13 +44,13 @@ MaterialParameters *GPUDevice::CreateMP(const MaterialDescriptorSets *mds,const #ifdef _DEBUG const UTF8String addr_string=HexToString((uint64_t)(ds->GetDescriptorSet())); - LOG_INFO(U8_TEXT("Create [DescriptSets:")+addr_string+("] OK! Material Name: \"")+mds->GetMaterialName()+U8_TEXT("\" Type: ")+GetDescriptorSetsTypeName(desc_set_type)); + LOG_INFO(U8_TEXT("Create [DescriptSets:")+addr_string+("] OK! Material Name: \"")+mds->GetMaterialName()+U8_TEXT("\" Type: ")+GetDescriptorSetTypeName(desc_set_type)); #endif//_DEBUG return(new MaterialParameters(mds,desc_set_type,ds)); } -MaterialParameters *GPUDevice::CreateMP(Material *mtl,const DescriptorSetsType &desc_set_type) +MaterialParameters *GPUDevice::CreateMP(Material *mtl,const DescriptorSetType &desc_set_type) { if(!mtl)return(nullptr); @@ -111,10 +111,10 @@ Material *GPUDevice::CreateMaterial(const UTF8String &mtl_name,ShaderModuleMap * if(mds) { - ENUM_CLASS_FOR(DescriptorSetsType,int,dst) + ENUM_CLASS_FOR(DescriptorSetType,int,dst) { - if(mds->hasSet((DescriptorSetsType)dst)) - data->mp_array[dst]=CreateMP(mds,pld,(DescriptorSetsType)dst); + if(mds->hasSet((DescriptorSetType)dst)) + data->mp_array[dst]=CreateMP(mds,pld,(DescriptorSetType)dst); else data->mp_array[dst]=nullptr; } diff --git a/src/SceneGraph/Vulkan/VKMaterial.cpp b/src/SceneGraph/Vulkan/VKMaterial.cpp index 9fdd4ee2..35352a63 100644 --- a/src/SceneGraph/Vulkan/VKMaterial.cpp +++ b/src/SceneGraph/Vulkan/VKMaterial.cpp @@ -5,7 +5,7 @@ VK_NAMESPACE_BEGIN MaterialData::~MaterialData() { - for(int i=0;ipipeline_layout_data->pipeline_layout; } -const bool Material::hasSet(const DescriptorSetsType &dst)const +const bool Material::hasSet(const DescriptorSetType &dst)const { return data->mds->hasSet(dst); } diff --git a/src/SceneGraph/Vulkan/VKMaterialDescriptorSets.cpp b/src/SceneGraph/Vulkan/VKMaterialDescriptorSets.cpp index 9daceca3..ca79b812 100644 --- a/src/SceneGraph/Vulkan/VKMaterialDescriptorSets.cpp +++ b/src/SceneGraph/Vulkan/VKMaterialDescriptorSets.cpp @@ -21,7 +21,7 @@ MaterialDescriptorSets::MaterialDescriptorSets(const UTF8String &name,ShaderDesc if(sd_count<=0)return; { - ENUM_CLASS_FOR(DescriptorSetsType,int,i) + ENUM_CLASS_FOR(DescriptorSetType,int,i) { dsl_ci[i].bindingCount=0; dsl_ci[i].pBindings=nullptr; @@ -47,10 +47,10 @@ MaterialDescriptorSets::MaterialDescriptorSets(const UTF8String &name,ShaderDesc } } - VkDescriptorSetLayoutBinding *sds_ptr[size_t(DescriptorSetsType::RANGE_SIZE)]; + VkDescriptorSetLayoutBinding *sds_ptr[size_t(DescriptorSetType::RANGE_SIZE)]; { - ENUM_CLASS_FOR(DescriptorSetsType,int,i) + ENUM_CLASS_FOR(DescriptorSetType,int,i) if(dsl_ci[i].bindingCount>0) { dsl_ci[i].pBindings=new VkDescriptorSetLayoutBinding[dsl_ci[i].bindingCount]; @@ -95,7 +95,7 @@ MaterialDescriptorSets::MaterialDescriptorSets(const UTF8String &name,ShaderDesc MaterialDescriptorSets::~MaterialDescriptorSets() { - ENUM_CLASS_FOR(DescriptorSetsType,int,i) + ENUM_CLASS_FOR(DescriptorSetType,int,i) if(dsl_ci[i].bindingCount) delete[] dsl_ci[i].pBindings; diff --git a/src/SceneGraph/Vulkan/VKMaterialInstance.cpp b/src/SceneGraph/Vulkan/VKMaterialInstance.cpp index dd9cb9ca..1a319bd6 100644 --- a/src/SceneGraph/Vulkan/VKMaterialInstance.cpp +++ b/src/SceneGraph/Vulkan/VKMaterialInstance.cpp @@ -23,10 +23,10 @@ MaterialInstance::MaterialInstance(Material *mtl,VIL *v) vil=v; - mp_per_mi=mtl->GetMP(DescriptorSetsType::PerMaterial); + mp_per_mi=mtl->GetMP(DescriptorSetType::PerMaterial); } -bool MaterialInstance::BindUBO(const DescriptorSetsType &type,const AnsiString &name,DeviceBuffer *ubo,bool dynamic) +bool MaterialInstance::BindUBO(const DescriptorSetType &type,const AnsiString &name,DeviceBuffer *ubo,bool dynamic) { MaterialParameters *mp=GetMP(type); @@ -39,7 +39,7 @@ bool MaterialInstance::BindUBO(const DescriptorSetsType &type,const AnsiString & return(true); } -bool MaterialInstance::BindSSBO(const DescriptorSetsType &type,const AnsiString &name,DeviceBuffer *ubo,bool dynamic) +bool MaterialInstance::BindSSBO(const DescriptorSetType &type,const AnsiString &name,DeviceBuffer *ubo,bool dynamic) { MaterialParameters *mp=GetMP(type); @@ -52,7 +52,7 @@ bool MaterialInstance::BindSSBO(const DescriptorSetsType &type,const AnsiString return(true); } -bool MaterialInstance::BindSampler(const DescriptorSetsType &type,const AnsiString &name,Texture *tex,Sampler *sampler) +bool MaterialInstance::BindSampler(const DescriptorSetType &type,const AnsiString &name,Texture *tex,Sampler *sampler) { MaterialParameters *mp=GetMP(type); diff --git a/src/SceneGraph/Vulkan/VKMaterialParameters.cpp b/src/SceneGraph/Vulkan/VKMaterialParameters.cpp index 4ad77942..a3d3c8cf 100644 --- a/src/SceneGraph/Vulkan/VKMaterialParameters.cpp +++ b/src/SceneGraph/Vulkan/VKMaterialParameters.cpp @@ -4,7 +4,7 @@ #include VK_NAMESPACE_BEGIN -MaterialParameters::MaterialParameters(const MaterialDescriptorSets *_mds,const DescriptorSetsType &type,DescriptorSet *ds) +MaterialParameters::MaterialParameters(const MaterialDescriptorSets *_mds,const DescriptorSetType &type,DescriptorSet *ds) { mds=_mds; ds_type=type; diff --git a/src/SceneGraph/Vulkan/VKPipelineLayoutData.cpp b/src/SceneGraph/Vulkan/VKPipelineLayoutData.cpp index d269efc9..767499f0 100644 --- a/src/SceneGraph/Vulkan/VKPipelineLayoutData.cpp +++ b/src/SceneGraph/Vulkan/VKPipelineLayoutData.cpp @@ -10,9 +10,9 @@ PipelineLayoutData *GPUDevice::CreatePipelineLayoutData(const MaterialDescriptor if(mds) { - ENUM_CLASS_FOR(DescriptorSetsType,int,i) + ENUM_CLASS_FOR(DescriptorSetType,int,i) { - const DescriptorSetLayoutCreateInfo *dslci=mds->GetDSLCI((DescriptorSetsType)i); + const DescriptorSetLayoutCreateInfo *dslci=mds->GetDSLCI((DescriptorSetType)i); if(!dslci||dslci->bindingCount<=0) continue; @@ -71,7 +71,7 @@ PipelineLayoutData::~PipelineLayoutData() { vkDestroyPipelineLayout(device,pipeline_layout,nullptr); - ENUM_CLASS_FOR(DescriptorSetsType,int,i) + ENUM_CLASS_FOR(DescriptorSetType,int,i) if(layouts[i]) vkDestroyDescriptorSetLayout(device,layouts[i],nullptr); } diff --git a/src/SceneGraph/Vulkan/VKPipelineLayoutData.h b/src/SceneGraph/Vulkan/VKPipelineLayoutData.h index 957ca441..c51d38d4 100644 --- a/src/SceneGraph/Vulkan/VKPipelineLayoutData.h +++ b/src/SceneGraph/Vulkan/VKPipelineLayoutData.h @@ -9,10 +9,10 @@ struct PipelineLayoutData { VkDevice device; - int binding_count[size_t(DescriptorSetsType::RANGE_SIZE)]; - VkDescriptorSetLayout layouts[size_t(DescriptorSetsType::RANGE_SIZE)]; + int binding_count[size_t(DescriptorSetType::RANGE_SIZE)]; + VkDescriptorSetLayout layouts[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; diff --git a/src/SceneGraph/Vulkan/VKRenderResourceMaterial.cpp b/src/SceneGraph/Vulkan/VKRenderResourceMaterial.cpp index 6e1460b6..24f16921 100644 --- a/src/SceneGraph/Vulkan/VKRenderResourceMaterial.cpp +++ b/src/SceneGraph/Vulkan/VKRenderResourceMaterial.cpp @@ -56,14 +56,14 @@ void LoadShaderDescriptor(const uint8 *data,ShaderDescriptor *sd_list,const uint } if(ver==3) - sd->set_type =(DescriptorSetsType)*data++; + sd->set_type =(DescriptorSetType)*data++; else if(ver==2) //以下是旧的,未来不用了,现仅保证能运行 { - if(sd->name[0]=='g')sd->set_type=DescriptorSetsType::Global;else - if(sd->name[0]=='m')sd->set_type=DescriptorSetsType::PerMaterial;else - if(sd->name[0]=='r')sd->set_type=DescriptorSetsType::PerObject;else - sd->set_type=DescriptorSetsType::PerFrame; + if(sd->name[0]=='g')sd->set_type=DescriptorSetType::Global;else + if(sd->name[0]=='m')sd->set_type=DescriptorSetType::PerMaterial;else + if(sd->name[0]=='r')sd->set_type=DescriptorSetType::PerObject;else + sd->set_type=DescriptorSetType::PerFrame; } sd->set =*data++; @@ -71,7 +71,7 @@ void LoadShaderDescriptor(const uint8 *data,ShaderDescriptor *sd_list,const uint sd->stage_flag =*(uint32 *)data; data+=sizeof(uint32); - if(sd->set_type==DescriptorSetsType::PerObject) + if(sd->set_type==DescriptorSetType::PerObject) { if(sd->desc_type==VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER)sd->desc_type=VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;else if(sd->desc_type==VK_DESCRIPTOR_TYPE_STORAGE_BUFFER)sd->desc_type=VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC; diff --git a/src/SceneGraph/font/TextRender.cpp b/src/SceneGraph/font/TextRender.cpp index 38b8541f..25fae70c 100644 --- a/src/SceneGraph/font/TextRender.cpp +++ b/src/SceneGraph/font/TextRender.cpp @@ -98,7 +98,7 @@ namespace hgl sampler=db->CreateSampler(); { - MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global); + MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global); if(!mp_global) return(false); @@ -109,7 +109,7 @@ namespace hgl } { - MaterialParameters *mp=material_instance->GetMP(DescriptorSetsType::PerMaterial); + MaterialParameters *mp=material_instance->GetMP(DescriptorSetType::PerMaterial); if(!mp) return(false);