From 7ba2d0cf6f33fa1b4dd96d1a6627dc3ed3477b05 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Mon, 27 Sep 2021 21:20:22 +0800 Subject: [PATCH] renamed type DescriptorSetType to DescriptorSetsType --- example/Vulkan/Atomsphere.cpp | 2 +- example/Vulkan/DeferredModel.cpp | 14 +++++++------- example/Vulkan/DrawText.cpp | 4 ++-- example/Vulkan/DrawTile.cpp | 4 ++-- example/Vulkan/FragCoordTest.cpp | 2 +- example/Vulkan/Geometry3D.cpp | 2 +- example/Vulkan/HQFilterTexture.cpp | 4 ++-- example/Vulkan/InlineGeometryScene.cpp | 8 ++++---- example/Vulkan/OffscreenRender.cpp | 4 ++-- example/Vulkan/RectanglePrimitive.cpp | 4 ++-- example/Vulkan/first_triangle.cpp | 2 +- example/Vulkan/indices_rect.cpp | 2 +- example/Vulkan/texture_rect.cpp | 4 ++-- example/Vulkan/two_triangle.cpp | 2 +- inc/hgl/graph/RenderList.h | 4 ++-- inc/hgl/graph/VK.h | 8 ++++---- inc/hgl/graph/VKDevice.h | 6 +++--- inc/hgl/graph/VKMaterial.h | 8 ++++---- inc/hgl/graph/VKMaterialDescriptorSets.h | 6 +++--- inc/hgl/graph/VKMaterialInstance.h | 2 +- inc/hgl/graph/VKMaterialParameters.h | 8 ++++---- inc/hgl/graph/VKRenderableInstance.h | 2 +- src/SceneGraph/RenderList.cpp | 18 +++++++++--------- .../Vulkan/VKCommandBufferRender.cpp | 8 ++++---- src/SceneGraph/Vulkan/VKDeviceMaterial.cpp | 16 ++++++++-------- .../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 | 4 ++-- src/SceneGraph/Vulkan/VKShaderResource.cpp | 10 +++++----- 32 files changed, 94 insertions(+), 94 deletions(-) diff --git a/example/Vulkan/Atomsphere.cpp b/example/Vulkan/Atomsphere.cpp index 97d6e341..2ec723f3 100644 --- a/example/Vulkan/Atomsphere.cpp +++ b/example/Vulkan/Atomsphere.cpp @@ -67,7 +67,7 @@ private: return(false); { - MaterialParameters *mp=material_instance->GetMP(DescriptorSetType::Value); + MaterialParameters *mp=material_instance->GetMP(DescriptorSetsType::Value); if(!mp)return(false); diff --git a/example/Vulkan/DeferredModel.cpp b/example/Vulkan/DeferredModel.cpp index ec0650ef..67020ebd 100644 --- a/example/Vulkan/DeferredModel.cpp +++ b/example/Vulkan/DeferredModel.cpp @@ -38,7 +38,7 @@ constexpr VkFormat gbuffer_depth_format=PF_D16UN; struct alignas(16) PhongPointLight { - Vector3f color; + Vector4f color; Vector4f position; float radius; };// @@ -198,7 +198,7 @@ private: sampler=db->CreateSampler(&sampler_create_info); { - MaterialParameters *mp_global=sp_gbuffer.material_instance->GetMP(DescriptorSetType::Global); + MaterialParameters *mp_global=sp_gbuffer.material_instance->GetMP(DescriptorSetsType::Global); if(!mp_global) return(false); @@ -209,7 +209,7 @@ private: } { - MaterialParameters *mp=sp_gbuffer.material_instance->GetMP(DescriptorSetType::Value); + MaterialParameters *mp=sp_gbuffer.material_instance->GetMP(DescriptorSetsType::Value); if(!mp) return(false); @@ -220,7 +220,7 @@ private: } { - MaterialParameters *mp_global=sp_composition.material_instance->GetMP(DescriptorSetType::Global); + MaterialParameters *mp_global=sp_composition.material_instance->GetMP(DescriptorSetsType::Global); if(!mp_global) return(false); @@ -231,7 +231,7 @@ private: } { - MaterialParameters *mp=sp_composition.material_instance->GetMP(DescriptorSetType::Value); + MaterialParameters *mp=sp_composition.material_instance->GetMP(DescriptorSetsType::Value); if(!mp) return(false); @@ -379,8 +379,8 @@ public: // White lights.position = Vector4f(0.0f, 0.0f, 50.0f, 0.0f); - lights.color = Vector3f(105.0f); - lights.radius = 150.0f; + lights.color = Vector4f(1.0f); + lights.radius = 15.0f; lights.position.x = sin(hgl_rad2deg(timer/100)) * 100.0f; lights.position.y = cos(hgl_rad2deg(timer/100)) * 100.0f; diff --git a/example/Vulkan/DrawText.cpp b/example/Vulkan/DrawText.cpp index ca92a091..a0017fcc 100644 --- a/example/Vulkan/DrawText.cpp +++ b/example/Vulkan/DrawText.cpp @@ -65,7 +65,7 @@ private: sampler=db->CreateSampler(); { - MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global); + MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global); if(!mp_global) return(false); @@ -76,7 +76,7 @@ private: } { - MaterialParameters *mp=material_instance->GetMP(DescriptorSetType::Value); + MaterialParameters *mp=material_instance->GetMP(DescriptorSetsType::Value); if(!mp) return(false); diff --git a/example/Vulkan/DrawTile.cpp b/example/Vulkan/DrawTile.cpp index 459ea78e..207ce0a0 100644 --- a/example/Vulkan/DrawTile.cpp +++ b/example/Vulkan/DrawTile.cpp @@ -167,7 +167,7 @@ private: sampler=db->CreateSampler(); { - MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global); + MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global); if(!mp_global) return(false); @@ -178,7 +178,7 @@ private: } { - MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetType::Value); + MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetsType::Value); if(!mp_texture) return(false); diff --git a/example/Vulkan/FragCoordTest.cpp b/example/Vulkan/FragCoordTest.cpp index 97439fb5..9007db41 100644 --- a/example/Vulkan/FragCoordTest.cpp +++ b/example/Vulkan/FragCoordTest.cpp @@ -61,7 +61,7 @@ private: return(false); { - MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global); + MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global); if(!mp_global) return(false); diff --git a/example/Vulkan/Geometry3D.cpp b/example/Vulkan/Geometry3D.cpp index db7688e7..0cf81af9 100644 --- a/example/Vulkan/Geometry3D.cpp +++ b/example/Vulkan/Geometry3D.cpp @@ -45,7 +45,7 @@ private: return(false); { - MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global); + MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global); if(!mp_global) return(false); diff --git a/example/Vulkan/HQFilterTexture.cpp b/example/Vulkan/HQFilterTexture.cpp index 3359a413..b1b50c28 100644 --- a/example/Vulkan/HQFilterTexture.cpp +++ b/example/Vulkan/HQFilterTexture.cpp @@ -161,7 +161,7 @@ private: if(!mir->material_instance)return(false); { - MaterialParameters *mp_global=mir->material_instance->GetMP(DescriptorSetType::Global); + MaterialParameters *mp_global=mir->material_instance->GetMP(DescriptorSetsType::Global); if(!mp_global) return(false); @@ -172,7 +172,7 @@ private: } { - MaterialParameters *mp_texture=mir->material_instance->GetMP(DescriptorSetType::Value); + MaterialParameters *mp_texture=mir->material_instance->GetMP(DescriptorSetsType::Value); if(!mp_texture) return(false); diff --git a/example/Vulkan/InlineGeometryScene.cpp b/example/Vulkan/InlineGeometryScene.cpp index 42751c9c..b956bb95 100644 --- a/example/Vulkan/InlineGeometryScene.cpp +++ b/example/Vulkan/InlineGeometryScene.cpp @@ -130,7 +130,7 @@ private: if(!material_instance)return(false); { - MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetType::Value); + MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetsType::Value); if(!mp_texture) return(false); @@ -213,7 +213,7 @@ private: ubo_phong=db->CreateUBO(sizeof(PhongMaterial),&phong); { - MaterialParameters *mp_value=material_instance->GetMP(DescriptorSetType::Value); + MaterialParameters *mp_value=material_instance->GetMP(DescriptorSetsType::Value); if(!mp_value) return(false); @@ -225,7 +225,7 @@ private: } { - MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global); + MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global); if(!mp_global) return(false); @@ -236,7 +236,7 @@ private: } { - MaterialParameters *mp_global=axis_mi->GetMP(DescriptorSetType::Global); + MaterialParameters *mp_global=axis_mi->GetMP(DescriptorSetsType::Global); if(!mp_global) return(false); diff --git a/example/Vulkan/OffscreenRender.cpp b/example/Vulkan/OffscreenRender.cpp index 22af1287..7fedae0c 100644 --- a/example/Vulkan/OffscreenRender.cpp +++ b/example/Vulkan/OffscreenRender.cpp @@ -72,7 +72,7 @@ public: return(false); { - MaterialParameters *mp_global=ro->material_instance->GetMP(DescriptorSetType::Global); + MaterialParameters *mp_global=ro->material_instance->GetMP(DescriptorSetsType::Global); if(!mp_global) return(false); @@ -143,7 +143,7 @@ public: if(!cube.sampler)return(false); { - MaterialParameters *mp_texture=cube.material_instance->GetMP(DescriptorSetType::Value); + MaterialParameters *mp_texture=cube.material_instance->GetMP(DescriptorSetsType::Value); if(!mp_texture) return(false); diff --git a/example/Vulkan/RectanglePrimitive.cpp b/example/Vulkan/RectanglePrimitive.cpp index c8f90fe9..2f364fcf 100644 --- a/example/Vulkan/RectanglePrimitive.cpp +++ b/example/Vulkan/RectanglePrimitive.cpp @@ -61,7 +61,7 @@ private: sampler=db->CreateSampler(); { - MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global); + MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global); if(!mp_global) return(false); @@ -72,7 +72,7 @@ private: } { - MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetType::Value); + MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetsType::Value); if(!mp_texture) return(false); diff --git a/example/Vulkan/first_triangle.cpp b/example/Vulkan/first_triangle.cpp index 77db8adf..b8f4d742 100644 --- a/example/Vulkan/first_triangle.cpp +++ b/example/Vulkan/first_triangle.cpp @@ -71,7 +71,7 @@ private: return(false); { - MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global); + MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global); if(!mp_global) return(false); diff --git a/example/Vulkan/indices_rect.cpp b/example/Vulkan/indices_rect.cpp index 90f7022b..6b1570ca 100644 --- a/example/Vulkan/indices_rect.cpp +++ b/example/Vulkan/indices_rect.cpp @@ -70,7 +70,7 @@ private: return(false); { - MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global); + MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global); if(!mp_global) return(false); diff --git a/example/Vulkan/texture_rect.cpp b/example/Vulkan/texture_rect.cpp index d9576474..fa6739cf 100644 --- a/example/Vulkan/texture_rect.cpp +++ b/example/Vulkan/texture_rect.cpp @@ -75,7 +75,7 @@ private: sampler=db->CreateSampler(); { - MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetType::Value); + MaterialParameters *mp_texture=material_instance->GetMP(DescriptorSetsType::Value); if(!mp_texture) return(false); @@ -103,7 +103,7 @@ private: return(false); { - MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global); + MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global); if(!mp_global) return(false); diff --git a/example/Vulkan/two_triangle.cpp b/example/Vulkan/two_triangle.cpp index 5e40c71b..cfd7040a 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(DescriptorSetType::Global); + MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetsType::Global); if(!mp_global) return(false); diff --git a/inc/hgl/graph/RenderList.h b/inc/hgl/graph/RenderList.h index 6fc7c73f..6ee80e84 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)DescriptorSetType::RANGE_SIZE]; + VkDescriptorSet ds_list[(size_t)DescriptorSetsType::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)DescriptorSetType::RANGE_SIZE]; + MaterialParameters *last_mp[(size_t)DescriptorSetsType::RANGE_SIZE]; uint32_t last_vbo; void Render(RenderableInstance *); diff --git a/inc/hgl/graph/VK.h b/inc/hgl/graph/VK.h index 53de8695..8b584794 100644 --- a/inc/hgl/graph/VK.h +++ b/inc/hgl/graph/VK.h @@ -69,7 +69,7 @@ class DeviceRenderPassManage; class GPUFence; class GPUSemaphore; -enum class DescriptorSetType +enum class DescriptorSetsType { //设计使其对应shader中的set @@ -82,16 +82,16 @@ enum class DescriptorSetType ENUM_CLASS_RANGE(Global,Renderable) };// -const DescriptorSetType CheckDescriptorSetType(const char *str); +const DescriptorSetsType CheckDescriptorSetsType(const char *str); constexpr char *DescriptSetsTypeName[]= { "Global","Material","Value","Renderable" }; -inline const char *GetDescriptorSetsTypeName(const enum class DescriptorSetType &type) +inline const char *GetDescriptorSetsTypeName(const enum class DescriptorSetsType &type) { - if(!ENUM_CLASS_RANGE_CHECK(DescriptorSetType,type)) + if(!ENUM_CLASS_RANGE_CHECK(DescriptorSetsType,type)) return nullptr; return DescriptSetsTypeName[(size_t)type]; diff --git a/inc/hgl/graph/VKDevice.h b/inc/hgl/graph/VKDevice.h index 3511a4ec..89aca2c6 100644 --- a/inc/hgl/graph/VKDevice.h +++ b/inc/hgl/graph/VKDevice.h @@ -196,9 +196,9 @@ public: //shader & material PipelineLayoutData *CreatePipelineLayoutData(const MaterialDescriptorSets *); void Destroy(PipelineLayoutData *); - DescriptorSets * CreateDescriptorSets(const PipelineLayoutData *,const DescriptorSetType &type)const; - MaterialParameters *CreateMP(const MaterialDescriptorSets *,const PipelineLayoutData *,const DescriptorSetType &); - MaterialParameters *CreateMP(Material *,const DescriptorSetType &); + DescriptorSets * CreateDescriptorSets(const PipelineLayoutData *,const DescriptorSetsType &type)const; + MaterialParameters *CreateMP(const MaterialDescriptorSets *,const PipelineLayoutData *,const DescriptorSetsType &); + MaterialParameters *CreateMP(Material *,const DescriptorSetsType &); ShaderModule *CreateShaderModule(ShaderResource *); diff --git a/inc/hgl/graph/VKMaterial.h b/inc/hgl/graph/VKMaterial.h index f257fe61..82ad64c0 100644 --- a/inc/hgl/graph/VKMaterial.h +++ b/inc/hgl/graph/VKMaterial.h @@ -70,11 +70,11 @@ public: public: - MaterialParameters * GetMP (const DescriptorSetType &type) + MaterialParameters * GetMP (const DescriptorSetsType &type) { - if(type==DescriptorSetType::Material )return data->mp.m;else - if(type==DescriptorSetType::Renderable )return data->mp.r;else - if(type==DescriptorSetType::Global )return data->mp.g;else + if(type==DescriptorSetsType::Material )return data->mp.m;else + if(type==DescriptorSetsType::Renderable )return data->mp.r;else + if(type==DescriptorSetsType::Global )return data->mp.g;else return(nullptr); } };//class Material diff --git a/inc/hgl/graph/VKMaterialDescriptorSets.h b/inc/hgl/graph/VKMaterialDescriptorSets.h index 4e3cca0c..67e3506d 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; - DescriptorSetType set_type; + DescriptorSetsType set_type; uint32_t set; uint32_t binding; uint32_t stage_flag; @@ -34,7 +34,7 @@ class MaterialDescriptorSets private: - DescriptorSetLayoutCreateInfo sds[size_t(DescriptorSetType::RANGE_SIZE)]; + DescriptorSetLayoutCreateInfo sds[size_t(DescriptorSetsType::RANGE_SIZE)]; public: @@ -49,7 +49,7 @@ public: const int GetSSBO (const AnsiString &name,bool dynamic)const{return GetBinding(dynamic?VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,name);} const int GetSampler (const AnsiString &name )const{return GetBinding(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, name);} - const DescriptorSetLayoutCreateInfo *GetBinding(const DescriptorSetType &type)const{return sds+size_t(type);} + const DescriptorSetLayoutCreateInfo *GetBinding(const DescriptorSetsType &type)const{return sds+size_t(type);} };//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 19716882..a22d6603 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 DescriptorSetType &type); + MaterialParameters *GetMP(const DescriptorSetsType &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 f4e3568a..7b699df4 100644 --- a/inc/hgl/graph/VKMaterialParameters.h +++ b/inc/hgl/graph/VKMaterialParameters.h @@ -9,7 +9,7 @@ class MaterialParameters { const MaterialDescriptorSets *mds; - DescriptorSetType ds_type; + DescriptorSetsType ds_type; DescriptorSets *descriptor_sets; @@ -17,11 +17,11 @@ private: friend class GPUDevice; - MaterialParameters(const MaterialDescriptorSets *,const DescriptorSetType &type,DescriptorSets *); + MaterialParameters(const MaterialDescriptorSets *,const DescriptorSetsType &type,DescriptorSets *); public: - const DescriptorSetType GetType (){return ds_type;} + const DescriptorSetsType GetType (){return ds_type;} DescriptorSets * 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==DescriptorSetType::name;} + #define MP_TYPE_IS(name) const bool is##name()const{return ds_type==DescriptorSetsType::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 e80b74da..bcc9ba6e 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 DescriptorSetType &type){return mat_inst->GetMP(type);} + MaterialParameters *GetMP (const DescriptorSetsType &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 97bc03f4..54ef620b 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::DescriptorSetType::BEGIN_RANGE; - i<=(int)hgl::graph::DescriptorSetType::END_RANGE; + for(int i =(int)hgl::graph::DescriptorSetsType::BEGIN_RANGE; + i<=(int)hgl::graph::DescriptorSetsType::END_RANGE; i++) { - off=ri_one->GetMP((hgl::graph::DescriptorSetType)i) - -ri_two->GetMP((hgl::graph::DescriptorSetType)i); + off=ri_one->GetMP((hgl::graph::DescriptorSetsType)i) + -ri_two->GetMP((hgl::graph::DescriptorSetsType)i); if(off) return off; @@ -151,7 +151,7 @@ namespace hgl //为所有的材质绑定 for(Material *mtl:material_sets) { - MaterialParameters *mp=mtl->GetMP(DescriptorSetType::Renderable); + MaterialParameters *mp=mtl->GetMP(DescriptorSetsType::Renderable); if(mp) { @@ -218,11 +218,11 @@ namespace hgl uint32_t first_set=0; MaterialParameters *mp; - for(int i=(int)DescriptorSetType::BEGIN_RANGE; - i<(int)DescriptorSetType::Renderable; + for(int i=(int)DescriptorSetsType::BEGIN_RANGE; + i<(int)DescriptorSetsType::Renderable; i++) { - mp=ri->GetMP((DescriptorSetType)i); + mp=ri->GetMP((DescriptorSetsType)i); if(last_mp[i]!=mp) { @@ -242,7 +242,7 @@ namespace hgl } { - mp=ri->GetMP(DescriptorSetType::Renderable); + mp=ri->GetMP(DescriptorSetsType::Renderable); if(mp) { diff --git a/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp b/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp index b6c826eb..4cff33f9 100644 --- a/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp +++ b/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp @@ -112,18 +112,18 @@ bool RenderCmdBuffer::BindDescriptorSets(RenderableInstance *ri) uint32_t count=0; MaterialParameters *mp; - VkDescriptorSet ds[(size_t)DescriptorSetType::RANGE_SIZE]; + VkDescriptorSet ds[(size_t)DescriptorSetsType::RANGE_SIZE]; - ENUM_CLASS_FOR(DescriptorSetType,int,i) + ENUM_CLASS_FOR(DescriptorSetsType,int,i) { - mp=ri->GetMP((DescriptorSetType)i); + mp=ri->GetMP((DescriptorSetsType)i); if(mp) { ds[count]=mp->GetVkDescriptorSet(); ++count; - if((DescriptorSetType)i==DescriptorSetType::Renderable) + if((DescriptorSetsType)i==DescriptorSetsType::Renderable) { dynamic_count=mp->GetCount(); diff --git a/src/SceneGraph/Vulkan/VKDeviceMaterial.cpp b/src/SceneGraph/Vulkan/VKDeviceMaterial.cpp index 05ca5942..571bcad9 100644 --- a/src/SceneGraph/Vulkan/VKDeviceMaterial.cpp +++ b/src/SceneGraph/Vulkan/VKDeviceMaterial.cpp @@ -8,9 +8,9 @@ #include"VKPipelineLayoutData.h" VK_NAMESPACE_BEGIN -DescriptorSets *GPUDevice::CreateDescriptorSets(const PipelineLayoutData *pld,const DescriptorSetType &type)const +DescriptorSets *GPUDevice::CreateDescriptorSets(const PipelineLayoutData *pld,const DescriptorSetsType &type)const { - ENUM_CLASS_RANGE_ERROR_RETURN_NULLPTR(DescriptorSetType,type); + ENUM_CLASS_RANGE_ERROR_RETURN_NULLPTR(DescriptorSetsType,type); const uint32_t binding_count=pld->binding_count[size_t(type)]; @@ -31,10 +31,10 @@ DescriptorSets *GPUDevice::CreateDescriptorSets(const PipelineLayoutData *pld,co return(new DescriptorSets(attr->device,binding_count,pld->pipeline_layout,desc_set)); } -MaterialParameters *GPUDevice::CreateMP(const MaterialDescriptorSets *mds,const PipelineLayoutData *pld,const DescriptorSetType &desc_set_type) +MaterialParameters *GPUDevice::CreateMP(const MaterialDescriptorSets *mds,const PipelineLayoutData *pld,const DescriptorSetsType &desc_set_type) { if(!mds||!pld)return(nullptr); - if(!RangeCheck(desc_set_type)) + if(!RangeCheck(desc_set_type)) return(nullptr); DescriptorSets *ds=CreateDescriptorSets(pld,desc_set_type); @@ -50,7 +50,7 @@ MaterialParameters *GPUDevice::CreateMP(const MaterialDescriptorSets *mds,const return(new MaterialParameters(mds,desc_set_type,ds)); } -MaterialParameters *GPUDevice::CreateMP(Material *mtl,const DescriptorSetType &desc_set_type) +MaterialParameters *GPUDevice::CreateMP(Material *mtl,const DescriptorSetsType &desc_set_type) { if(!mtl)return(nullptr); @@ -108,9 +108,9 @@ Material *GPUDevice::CreateMaterial(const UTF8String &mtl_name,ShaderModuleMap * CreateShaderStageList(data->shader_stage_list,shader_maps); data->pipeline_layout_data=pld; - data->mp.m=CreateMP(mds,pld,DescriptorSetType::Material ); - data->mp.r=CreateMP(mds,pld,DescriptorSetType::Renderable ); - data->mp.g=CreateMP(mds,pld,DescriptorSetType::Global ); + data->mp.m=CreateMP(mds,pld,DescriptorSetsType::Material ); + data->mp.r=CreateMP(mds,pld,DescriptorSetsType::Renderable ); + data->mp.g=CreateMP(mds,pld,DescriptorSetsType::Global ); return(new Material(data)); } diff --git a/src/SceneGraph/Vulkan/VKMaterialDescriptorSets.cpp b/src/SceneGraph/Vulkan/VKMaterialDescriptorSets.cpp index 4ddbb445..91bb74e9 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(DescriptorSetType,int,i) + ENUM_CLASS_FOR(DescriptorSetsType,int,i) { sds[i].bindingCount=0; sds[i].pBindings=nullptr; @@ -45,10 +45,10 @@ MaterialDescriptorSets::MaterialDescriptorSets(const UTF8String &name,ShaderDesc } } - VkDescriptorSetLayoutBinding *sds_ptr[size_t(DescriptorSetType::RANGE_SIZE)]; + VkDescriptorSetLayoutBinding *sds_ptr[size_t(DescriptorSetsType::RANGE_SIZE)]; { - ENUM_CLASS_FOR(DescriptorSetType,int,i) + ENUM_CLASS_FOR(DescriptorSetsType,int,i) if(sds[i].bindingCount>0) { sds[i].pBindings=new VkDescriptorSetLayoutBinding[sds[i].bindingCount]; @@ -93,7 +93,7 @@ MaterialDescriptorSets::MaterialDescriptorSets(const UTF8String &name,ShaderDesc MaterialDescriptorSets::~MaterialDescriptorSets() { - ENUM_CLASS_FOR(DescriptorSetType,int,i) + ENUM_CLASS_FOR(DescriptorSetsType,int,i) if(sds[i].bindingCount) delete[] sds[i].pBindings; diff --git a/src/SceneGraph/Vulkan/VKMaterialInstance.cpp b/src/SceneGraph/Vulkan/VKMaterialInstance.cpp index f3b25915..74c62687 100644 --- a/src/SceneGraph/Vulkan/VKMaterialInstance.cpp +++ b/src/SceneGraph/Vulkan/VKMaterialInstance.cpp @@ -8,7 +8,7 @@ MaterialInstance *GPUDevice::CreateMI(Material *mtl) { if(!mtl)return(nullptr); - MaterialParameters *mp=CreateMP(mtl,DescriptorSetType::Value); + MaterialParameters *mp=CreateMP(mtl,DescriptorSetsType::Value); return(new MaterialInstance(mtl,mp)); } @@ -25,12 +25,12 @@ MaterialInstance::~MaterialInstance() SAFE_CLEAR(mp_value); } -MaterialParameters *MaterialInstance::GetMP(const DescriptorSetType &type) +MaterialParameters *MaterialInstance::GetMP(const DescriptorSetsType &type) { - //if(type==DescriptorSetType::Texture + //if(type==DescriptorSetsType::Texture // return mp_texture; - if(type==DescriptorSetType::Value) + if(type==DescriptorSetsType::Value) return mp_value; return material->GetMP(type); diff --git a/src/SceneGraph/Vulkan/VKMaterialParameters.cpp b/src/SceneGraph/Vulkan/VKMaterialParameters.cpp index c9979deb..c33a4bb1 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 DescriptorSetType &type,DescriptorSets *ds) +MaterialParameters::MaterialParameters(const MaterialDescriptorSets *_mds,const DescriptorSetsType &type,DescriptorSets *ds) { mds=_mds; ds_type=type; diff --git a/src/SceneGraph/Vulkan/VKPipelineLayoutData.cpp b/src/SceneGraph/Vulkan/VKPipelineLayoutData.cpp index b75c4a9d..09086047 100644 --- a/src/SceneGraph/Vulkan/VKPipelineLayoutData.cpp +++ b/src/SceneGraph/Vulkan/VKPipelineLayoutData.cpp @@ -8,9 +8,9 @@ PipelineLayoutData *GPUDevice::CreatePipelineLayoutData(const MaterialDescriptor { PipelineLayoutData *pld=hgl_zero_new(); - ENUM_CLASS_FOR(DescriptorSetType,int,i) + ENUM_CLASS_FOR(DescriptorSetsType,int,i) { - const DescriptorSetLayoutCreateInfo *dslci=mds->GetBinding((DescriptorSetType)i); + const DescriptorSetLayoutCreateInfo *dslci=mds->GetBinding((DescriptorSetsType)i); if(!dslci||dslci->bindingCount<=0) continue; @@ -64,7 +64,7 @@ PipelineLayoutData::~PipelineLayoutData() { vkDestroyPipelineLayout(device,pipeline_layout,nullptr); - ENUM_CLASS_FOR(DescriptorSetType,int,i) + ENUM_CLASS_FOR(DescriptorSetsType,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 5e7d21d7..720ad7d9 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(DescriptorSetType::RANGE_SIZE)]; - VkDescriptorSetLayout layouts[size_t(DescriptorSetType::RANGE_SIZE)]; + int binding_count[size_t(DescriptorSetsType::RANGE_SIZE)]; + VkDescriptorSetLayout layouts[size_t(DescriptorSetsType::RANGE_SIZE)]; - VkDescriptorSetLayout fin_dsl[size_t(DescriptorSetType::RANGE_SIZE)]; + VkDescriptorSetLayout fin_dsl[size_t(DescriptorSetsType::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 0ba95655..2e6207c7 100644 --- a/src/SceneGraph/Vulkan/VKRenderResourceMaterial.cpp +++ b/src/SceneGraph/Vulkan/VKRenderResourceMaterial.cpp @@ -47,9 +47,9 @@ void LoadShaderDescriptor(const uint8 *data,ShaderDescriptor *sd_list,const uint sd->stage_flag =*(uint32 *)data; data+=sizeof(uint32); - sd->set_type=CheckDescriptorSetType(sd->name); + sd->set_type=CheckDescriptorSetsType(sd->name); - if(sd->set_type==DescriptorSetType::Renderable) + if(sd->set_type==DescriptorSetsType::Renderable) { 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/Vulkan/VKShaderResource.cpp b/src/SceneGraph/Vulkan/VKShaderResource.cpp index 0a241fb9..94e5631a 100644 --- a/src/SceneGraph/Vulkan/VKShaderResource.cpp +++ b/src/SceneGraph/Vulkan/VKShaderResource.cpp @@ -5,16 +5,16 @@ VK_NAMESPACE_BEGIN - const DescriptorSetType CheckDescriptorSetType(const char *str) + const DescriptorSetsType CheckDescriptorSetsType(const char *str) { if(str[1]=='_') { - if(str[0]=='m')return DescriptorSetType::Material; - if(str[0]=='g')return DescriptorSetType::Global; - if(str[0]=='r')return DescriptorSetType::Renderable; + if(str[0]=='m')return DescriptorSetsType::Material; + if(str[0]=='g')return DescriptorSetsType::Global; + if(str[0]=='r')return DescriptorSetsType::Renderable; } - return DescriptorSetType::Value; + return DescriptorSetsType::Value; } #define AccessByPointer(data,type) *(type *)data;data+=sizeof(type);