diff --git a/CMSceneGraph b/CMSceneGraph index 8b585e15..3fe2e7b8 160000 --- a/CMSceneGraph +++ b/CMSceneGraph @@ -1 +1 @@ -Subproject commit 8b585e15eb31c5f412f838a1ec78c529c1a5a2fd +Subproject commit 3fe2e7b806b1d2fd222e4e12daf4ccad5797b19e diff --git a/src/SceneGraph/MaterialRenderList.cpp b/src/SceneGraph/MaterialRenderList.cpp index c22d881d..933cee34 100644 --- a/src/SceneGraph/MaterialRenderList.cpp +++ b/src/SceneGraph/MaterialRenderList.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include"RenderAssignBuffer.h" @@ -225,24 +226,6 @@ bool MaterialRenderList::Bind(const VertexInputData *vid,const uint ri_index) // } //} - //if(countGetCount(VertexInputGroup::LocalToWorld); - - // if(l2w_binding_count>0) //有变换矩阵信息 - // { - // if(l2w_binding_count!=4) - // return(false); - - // hgl_cpy(buffer_list+count,assign_buffer->l2w_buffer,4); - - // for(uint i=0;i<4;i++) - // buffer_offset[count+i]=ri_index*16; //mat4每列都是rgba32f,自然是16字节 - - // count+=l2w_binding_count; - // } - //} - if(!vbo_list->IsFull()) { const uint assign_binding_count=vil->GetCount(VertexInputGroup::Assign); @@ -252,7 +235,7 @@ bool MaterialRenderList::Bind(const VertexInputData *vid,const uint ri_index) if(assign_binding_count!=1) return(false); - vbo_list->Add(assign_buffer->GetAssignVBO(),ASSIGNS_VBO_STRIP_BYTES*ri_index); + vbo_list->Add(assign_buffer->GetAssignVBO(),ASSIGN_VBO_STIDE_BYTES*ri_index); } } @@ -264,7 +247,6 @@ bool MaterialRenderList::Bind(const VertexInputData *vid,const uint ri_index) // return(false); //} - //cmd_buf->BindVBO(0,count,buffer_list,buffer_offset); cmd_buf->BindVBO(vbo_list); return(true); diff --git a/src/SceneGraph/RenderAssignBuffer.cpp b/src/SceneGraph/RenderAssignBuffer.cpp index fb628869..47585530 100644 --- a/src/SceneGraph/RenderAssignBuffer.cpp +++ b/src/SceneGraph/RenderAssignBuffer.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include VK_NAMESPACE_BEGIN @@ -49,7 +50,7 @@ void RenderAssignBuffer::NodeAlloc(GPUDevice *dev,const uint c) ubo_l2w=dev->CreateUBO(node_count*sizeof(Matrix4f)); //ubo_mi=dev->CreateUBO(node_count*sizeof(uint8)); - vbo_assigns=dev->CreateVBO(VF_V1U16,node_count); + vbo_assigns=dev->CreateVBO(ASSIGN_VBO_FMT,node_count); } //void MIAlloc(GPUDevice *dev,const uint c,const uint mis) diff --git a/src/SceneGraph/RenderAssignBuffer.h b/src/SceneGraph/RenderAssignBuffer.h index 1eb16243..abad0ee3 100644 --- a/src/SceneGraph/RenderAssignBuffer.h +++ b/src/SceneGraph/RenderAssignBuffer.h @@ -21,7 +21,6 @@ VK_NAMESPACE_BEGIN // 我们天然要求将材质实例数据分为两个等级,同时要求一次渲染不能超过256种材质实例。 // 所以 UBO Range为16k时,实例数据不能超过64字节。UBO Range为64k时,实例数据不能超过256字节。 -constexpr const uint ASSIGNS_VBO_STRIP_BYTES=2; /// #include #include +#include #include"GLSLCompiler.h" #include"common/MFCommon.h" @@ -39,9 +40,10 @@ void ShaderCreateInfoVertex::AddJoint() void ShaderCreateInfoVertex::AddAssign() { - char name[]="Assign"; - - AddInput(VAT_UINT,name,VK_VERTEX_INPUT_RATE_INSTANCE,VertexInputGroup::Assign); + AddInput( ASSIGN_VAT_FMT, + ASSIGN_VIS_NAME, + VK_VERTEX_INPUT_RATE_INSTANCE, + VertexInputGroup::Assign); AddFunction(mtl::func::GetLocalToWorld); }