From c232feb40ad873e9484b41468e30b8257db46da0 Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Fri, 28 Apr 2023 11:10:50 +0800 Subject: [PATCH] temporary to disable the RenderList and RenderNode --- example/Vulkan/first_triangle.cpp | 2 +- example/common/VulkanAppFramework.h | 46 +++++++++---------- inc/hgl/graph/mtl/ShaderBuffer.h | 2 +- inc/hgl/graph/mtl/StdMaterial.h | 1 - inc/hgl/shadergen/MaterialCreateInfo.h | 2 +- src/SceneGraph/CMakeLists.txt | 4 +- src/SceneGraph/RenderNode2D.cpp | 21 ++++----- .../Vulkan/VKRenderResourceMaterial.cpp | 16 +++---- 8 files changed, 44 insertions(+), 50 deletions(-) diff --git a/example/Vulkan/first_triangle.cpp b/example/Vulkan/first_triangle.cpp index 65b1d537..5b671e6d 100644 --- a/example/Vulkan/first_triangle.cpp +++ b/example/Vulkan/first_triangle.cpp @@ -98,7 +98,7 @@ private: bool InitAutoMaterial() { - AutoDelete mci=mtl::CreateVertexColor2D(CoordinateSystem2D::NDC); + AutoDelete mci=mtl::CreateVertexColor2D(mtl::CoordinateSystem2D::NDC); material_instance=db->CreateMaterialInstance(mci,&vil_config); diff --git a/example/common/VulkanAppFramework.h b/example/common/VulkanAppFramework.h index c361cbdc..e7308668 100644 --- a/example/common/VulkanAppFramework.h +++ b/example/common/VulkanAppFramework.h @@ -19,7 +19,7 @@ #include #include #include -#include +//#include #include #include #include @@ -142,7 +142,7 @@ public: ubo_vp_info=db->CreateUBO(sizeof(ViewportInfo),&vp_info); - db->global_descriptor.AddUBO(InlineDescriptor::ViewportInfo.name,ubo_vp_info); + db->global_descriptor.AddUBO(mtl::SBS_ViewportInfo.name,ubo_vp_info); } return(true); @@ -248,31 +248,31 @@ public: return BuildCommandBuffer(sc_render_target->GetCurrentFrameIndices(),ri); } - void BuildCommandBuffer(uint32_t index,RenderList2D *rl) - { - if(!rl)return; + //void BuildCommandBuffer(uint32_t index,RenderList2D *rl) + //{ + // if(!rl)return; - RenderCmdBuffer *cb=cmd_buf[index]; + // RenderCmdBuffer *cb=cmd_buf[index]; - cb->Begin(); - cb->BindFramebuffer(sc_render_target->GetRenderPass(),sc_render_target->GetFramebuffer(index)); - cb->SetClearColor(0,clear_color); - cb->BeginRenderPass(); - rl->Render(cb); - cb->EndRenderPass(); - cb->End(); - } + // cb->Begin(); + // cb->BindFramebuffer(sc_render_target->GetRenderPass(),sc_render_target->GetFramebuffer(index)); + // cb->SetClearColor(0,clear_color); + // cb->BeginRenderPass(); + // rl->Render(cb); + // cb->EndRenderPass(); + // cb->End(); + //} - void BuildCommandBuffer(RenderList2D *rl) - { - for(int32_t i=0;iGetCurrentFrameIndices(),rl); - } + //void BuildCurrentCommandBuffer(RenderList2D *rl) + //{ + // BuildCommandBuffer(sc_render_target->GetCurrentFrameIndices(),rl); + //} template Pipeline *CreatePipeline(ARGS...args){return device_render_pass->CreatePipeline(args...);} diff --git a/inc/hgl/graph/mtl/ShaderBuffer.h b/inc/hgl/graph/mtl/ShaderBuffer.h index 8e136bf9..bc6226dd 100644 --- a/inc/hgl/graph/mtl/ShaderBuffer.h +++ b/inc/hgl/graph/mtl/ShaderBuffer.h @@ -10,7 +10,7 @@ namespace hgl struct ShaderBufferSource { const char *struct_name; - const char *value_name; + const char *name; const char *codes; }; }//namespace graph diff --git a/inc/hgl/graph/mtl/StdMaterial.h b/inc/hgl/graph/mtl/StdMaterial.h index f0e0c5f4..bd59d9f1 100644 --- a/inc/hgl/graph/mtl/StdMaterial.h +++ b/inc/hgl/graph/mtl/StdMaterial.h @@ -53,5 +53,4 @@ vec3 world_up; float znear,zfar;)" }; - STD_MTL_NAMESPACE_END diff --git a/inc/hgl/shadergen/MaterialCreateInfo.h b/inc/hgl/shadergen/MaterialCreateInfo.h index e4c04ad2..157586fa 100644 --- a/inc/hgl/shadergen/MaterialCreateInfo.h +++ b/inc/hgl/shadergen/MaterialCreateInfo.h @@ -66,7 +66,7 @@ public: if(!mdi.hasStruct(ss.struct_name)) mdi.AddStruct(ss.struct_name,ss.codes); - return AddUBO(flag_bits,set_type,ss.struct_name,ss.value_name); + return AddUBO(flag_bits,set_type,ss.struct_name,ss.name); } bool CreateShader(); diff --git a/src/SceneGraph/CMakeLists.txt b/src/SceneGraph/CMakeLists.txt index 53802284..b4415a9c 100644 --- a/src/SceneGraph/CMakeLists.txt +++ b/src/SceneGraph/CMakeLists.txt @@ -268,8 +268,8 @@ SET(VULKAN_RENDER_SOURCE ${VK_RR_SOURCE} ${VK_RENDERABLE_SOURCE} ${VK_RENDER_DEVICE_SOURCE}) -add_cm_library(ULRE.SceneGraph "ULRE" ${SCENE_GRAPH_HEADER} - ${SCENE_GRAPH_SOURCE} +add_cm_library(ULRE.SceneGraph "ULRE" #${SCENE_GRAPH_HEADER} + #${SCENE_GRAPH_SOURCE} ${GEOMETRY_FILES} ${LIGHT_FILES} diff --git a/src/SceneGraph/RenderNode2D.cpp b/src/SceneGraph/RenderNode2D.cpp index dd88a180..68deb43d 100644 --- a/src/SceneGraph/RenderNode2D.cpp +++ b/src/SceneGraph/RenderNode2D.cpp @@ -30,18 +30,13 @@ int Comparator::compare(const hgl::graph::RenderNode2D } //比较材质实例 - //{ - // for(int i =(int)hgl::graph::DescriptorSetType::BEGIN_RANGE; - // i<=(int)hgl::graph::DescriptorSetType::END_RANGE; - // i++) - // { - // off=ri_one->GetMP((hgl::graph::DescriptorSetType)i) - // -ri_two->GetMP((hgl::graph::DescriptorSetType)i); + { + off=ri_one->GetMaterialInstance() + -ri_two->GetMaterialInstance(); - // if(off) - // return off; - // } - //} + if(off) + return off; + } //比较vbo+ebo { @@ -78,9 +73,9 @@ namespace hgl Sort(rn_list,&rnc); } - //创建UBO/SSBO绑定数据 + //生成mvp数据 { - mtl-> + } } }//namespace graph diff --git a/src/SceneGraph/Vulkan/VKRenderResourceMaterial.cpp b/src/SceneGraph/Vulkan/VKRenderResourceMaterial.cpp index 09f5bb6c..1774a4d1 100644 --- a/src/SceneGraph/Vulkan/VKRenderResourceMaterial.cpp +++ b/src/SceneGraph/Vulkan/VKRenderResourceMaterial.cpp @@ -60,20 +60,20 @@ void LoadShaderDescriptor(io::ConstBufferReader &cbr,ShaderDescriptor *sd_list,c if(ver==2) //以下是旧的,未来不用了,现仅保证能运行 { 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; + //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::PerMaterial; } cbr.Read(sd->set); cbr.Read(sd->binding); cbr.Read(sd->stage_flag); - 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; - } + //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; + //} ++sd; }