diff --git a/CMSceneGraph b/CMSceneGraph index b5b673f8..4a244cf3 160000 --- a/CMSceneGraph +++ b/CMSceneGraph @@ -1 +1 @@ -Subproject commit b5b673f8a65a0c1a8b4972f81e45122bad5155a5 +Subproject commit 4a244cf3f7aed607e6332ccd32bed3f465a667e9 diff --git a/inc/hgl/graph/VKMaterial.h b/inc/hgl/graph/VKMaterial.h index 990135c0..d84f76dd 100644 --- a/inc/hgl/graph/VKMaterial.h +++ b/inc/hgl/graph/VKMaterial.h @@ -7,6 +7,8 @@ #include #include VK_NAMESPACE_BEGIN +using ShaderStageCreateInfoList=List; + struct MaterialData { UTF8String name; @@ -17,7 +19,7 @@ struct MaterialData VertexShaderModule *vertex_sm; VertexAttributeBinding *vab; - List shader_stage_list; + ShaderStageCreateInfoList shader_stage_list; PipelineLayoutData *pipeline_layout_data; @@ -56,8 +58,7 @@ public: const VertexShaderModule * GetVertexShaderModule ()const{return data->vertex_sm;} - const uint32_t GetStageCount ()const{return data->shader_stage_list.GetCount();} - const VkPipelineShaderStageCreateInfo * GetStages ()const{return data->shader_stage_list.GetData();} + const ShaderStageCreateInfoList & GetStageList ()const{return data->shader_stage_list;} const MaterialDescriptorSets * GetDescriptorSets ()const{return data->mds;} const VkPipelineLayout GetPipelineLayout ()const; diff --git a/inc/hgl/graph/VKVertexAttributeBinding.h b/inc/hgl/graph/VKVertexAttributeBinding.h deleted file mode 100644 index e7dd6b47..00000000 --- a/inc/hgl/graph/VKVertexAttributeBinding.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef HGL_GRAPH_VULKAN_VERTEX_ATTRIBUTE_BINDING_INCLUDE -#define HGL_GRAPH_VULKAN_VERTEX_ATTRIBUTE_BINDING_INCLUDE - -#include -#include -VK_NAMESPACE_BEGIN -/** -* 顶点输入状态实例
-* 本对象用于传递给Material,用于已经确定好顶点格式的情况下,依然可修改部分设定(如instance)。 -*/ -class VertexAttributeBinding -{ - uint32_t attr_count; - VkVertexInputBindingDescription *binding_list; - VkVertexInputAttributeDescription *attribute_list; - -private: - - friend class VertexShaderModule; - - VertexAttributeBinding(const uint32_t,const VkVertexInputBindingDescription *,const VkVertexInputAttributeDescription *); - -public: - - ~VertexAttributeBinding(); - - bool SetInstance(const uint binding,bool instance); - bool SetStride (const uint binding,const uint32_t & stride); - bool SetFormat (const uint binding,const VkFormat & format); - bool SetOffset (const uint binding,const uint32_t offset); - - const uint32_t GetVertexAttrCount ()const{return attr_count;} - const VkVertexInputBindingDescription * GetVertexBindingList ()const{return binding_list;} - const VkVertexInputAttributeDescription * GetVertexAttributeList ()const{return attribute_list;} -};//class VertexAttributeBinding - -using VAB=VertexAttributeBinding; -VK_NAMESPACE_END -#endif//HGL_GRAPH_VULKAN_VERTEX_ATTRIBUTE_BINDING_INCLUDE diff --git a/src/SceneGraph/CMakeLists.txt b/src/SceneGraph/CMakeLists.txt index 0fa48711..0fa555be 100644 --- a/src/SceneGraph/CMakeLists.txt +++ b/src/SceneGraph/CMakeLists.txt @@ -104,7 +104,6 @@ SET(VK_DEBUG_SOURCE ${SG_INCLUDE_PATH}/VKDebugOut.h SET(VK_MEMORY_SOURCE ${SG_INCLUDE_PATH}/VKMemory.h ${SG_INCLUDE_PATH}/VKMemoryAllocator.h ${SG_INCLUDE_PATH}/VKBuffer.h - ${SG_INCLUDE_PATH}/VKVertexAttribBuffer.h ${SG_INCLUDE_PATH}/VKIndexBuffer.h ${SG_INCLUDE_PATH}/VKArrayBuffer.h Vulkan/VKMemory.cpp @@ -204,10 +203,8 @@ SET(VK_CMD_BUFFER_SOURCE ${SG_INCLUDE_PATH}/VKCommandBuffer.h SOURCE_GROUP("Vulkan\\Command Buffer" FILES ${VK_CMD_BUFFER_SOURCE}) -SET(VK_RENDERABLE_SOURCE ${SG_INCLUDE_PATH}/VKVertexAttributeBinding.h - ${SG_INCLUDE_PATH}/VKRenderable.h +SET(VK_RENDERABLE_SOURCE ${SG_INCLUDE_PATH}/VKRenderable.h ${SG_INCLUDE_PATH}/VKRenderableInstance.h - Vulkan/VKVertexAttributeBinding.cpp Vulkan/VKRenderable.cpp Vulkan/VKRenderableInstance.cpp Vulkan/VKTileData.cpp diff --git a/src/SceneGraph/Vulkan/VKRenderPass.cpp b/src/SceneGraph/Vulkan/VKRenderPass.cpp index 725ded90..726f5829 100644 --- a/src/SceneGraph/Vulkan/VKRenderPass.cpp +++ b/src/SceneGraph/Vulkan/VKRenderPass.cpp @@ -27,13 +27,8 @@ Pipeline *RenderPass::CreatePipeline(const Material *material,PipelineData *data { VkPipeline graphicsPipeline; - const VAB *vab=material->GetVAB(); - - data->InitVertexInputState( material->GetStageCount(), - material->GetStages(), - vab->GetVertexAttrCount(), - vab->GetVertexBindingList(), - vab->GetVertexAttributeList()); + data->InitShaderStage(material->GetStageList()); + data->InitVertexInputState(material->GetVAB()); data->SetColorAttachments(color_formats.GetCount()); diff --git a/src/SceneGraph/Vulkan/VKVertexAttributeBinding.cpp b/src/SceneGraph/Vulkan/VKVertexAttributeBinding.cpp deleted file mode 100644 index 57120012..00000000 --- a/src/SceneGraph/Vulkan/VKVertexAttributeBinding.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include -#include - -VK_NAMESPACE_BEGIN -VertexAttributeBinding::VertexAttributeBinding(const uint32_t count,const VkVertexInputBindingDescription *bind_list,const VkVertexInputAttributeDescription *attr_list) -{ - attr_count=count; - - if(attr_count<=0) - { - binding_list=nullptr; - attribute_list=nullptr; - return; - } - - binding_list=hgl_copy_new(attr_count,bind_list); - attribute_list=hgl_copy_new(attr_count,attr_list); -} - -VertexAttributeBinding::~VertexAttributeBinding() -{ - delete[] attribute_list; - delete[] binding_list; -} - -bool VertexAttributeBinding::SetInstance(const uint index,bool instance) -{ - if(index>=attr_count)return(false); - - binding_list[index].inputRate=instance?VK_VERTEX_INPUT_RATE_INSTANCE:VK_VERTEX_INPUT_RATE_VERTEX; - - return(true); -} - -bool VertexAttributeBinding::SetStride(const uint index,const uint32_t &stride) -{ - if(index>=attr_count)return(false); - - binding_list[index].stride=stride; - - return(true); -} - -bool VertexAttributeBinding::SetFormat(const uint index,const VkFormat &format) -{ - if(index>=attr_count)return(false); - - attribute_list[index].format=format; - - return(true); -} - -bool VertexAttributeBinding::SetOffset(const uint index,const uint32_t offset) -{ - if(index>=attr_count)return(false); - - attribute_list[index].offset=offset; - - return(true); -} -VK_NAMESPACE_END