moved few values to VKRenderAssign.h

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-09-06 16:55:04 +08:00
parent 202bff5870
commit d959e7988d
5 changed files with 10 additions and 26 deletions

@ -1 +1 @@
Subproject commit 8b585e15eb31c5f412f838a1ec78c529c1a5a2fd Subproject commit 3fe2e7b806b1d2fd222e4e12daf4ccad5797b19e

View File

@ -3,6 +3,7 @@
#include<hgl/graph/VKDevice.h> #include<hgl/graph/VKDevice.h>
#include<hgl/graph/VKCommandBuffer.h> #include<hgl/graph/VKCommandBuffer.h>
#include<hgl/graph/VKVertexInput.h> #include<hgl/graph/VKVertexInput.h>
#include<hgl/graph/VKRenderAssign.h>
#include<hgl/util/sort/Sort.h> #include<hgl/util/sort/Sort.h>
#include"RenderAssignBuffer.h" #include"RenderAssignBuffer.h"
@ -225,24 +226,6 @@ bool MaterialRenderList::Bind(const VertexInputData *vid,const uint ri_index)
// } // }
//} //}
//if(count<binding_count)//LocalToWorld组由RenderList合成
//{
// const uint l2w_binding_count=vil->GetCount(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()) if(!vbo_list->IsFull())
{ {
const uint assign_binding_count=vil->GetCount(VertexInputGroup::Assign); 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) if(assign_binding_count!=1)
return(false); 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); // return(false);
//} //}
//cmd_buf->BindVBO(0,count,buffer_list,buffer_offset);
cmd_buf->BindVBO(vbo_list); cmd_buf->BindVBO(vbo_list);
return(true); return(true);

View File

@ -3,6 +3,7 @@
#include<hgl/graph/VKDevice.h> #include<hgl/graph/VKDevice.h>
#include<hgl/graph/VKMaterialInstance.h> #include<hgl/graph/VKMaterialInstance.h>
#include<hgl/graph/RenderNode.h> #include<hgl/graph/RenderNode.h>
#include<hgl/graph/VKRenderAssign.h>
#include<hgl/graph/mtl/UBOCommon.h> #include<hgl/graph/mtl/UBOCommon.h>
VK_NAMESPACE_BEGIN VK_NAMESPACE_BEGIN
@ -49,7 +50,7 @@ void RenderAssignBuffer::NodeAlloc(GPUDevice *dev,const uint c)
ubo_l2w=dev->CreateUBO(node_count*sizeof(Matrix4f)); ubo_l2w=dev->CreateUBO(node_count*sizeof(Matrix4f));
//ubo_mi=dev->CreateUBO(node_count*sizeof(uint8)); //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) //void MIAlloc(GPUDevice *dev,const uint c,const uint mis)

View File

@ -21,7 +21,6 @@ VK_NAMESPACE_BEGIN
// 我们天然要求将材质实例数据分为两个等级同时要求一次渲染不能超过256种材质实例。 // 我们天然要求将材质实例数据分为两个等级同时要求一次渲染不能超过256种材质实例。
// 所以 UBO Range为16k时实例数据不能超过64字节。UBO Range为64k时实例数据不能超过256字节。 // 所以 UBO Range为16k时实例数据不能超过64字节。UBO Range为64k时实例数据不能超过256字节。
constexpr const uint ASSIGNS_VBO_STRIP_BYTES=2; ///<Assign VBO的每个节点的字节数
struct RenderNode; struct RenderNode;
class MaterialInstance; class MaterialInstance;

View File

@ -2,6 +2,7 @@
#include<hgl/shadergen/ShaderDescriptorInfo.h> #include<hgl/shadergen/ShaderDescriptorInfo.h>
#include<hgl/graph/VertexAttrib.h> #include<hgl/graph/VertexAttrib.h>
#include<hgl/graph/VKShaderStage.h> #include<hgl/graph/VKShaderStage.h>
#include<hgl/graph/VKRenderAssign.h>
#include"GLSLCompiler.h" #include"GLSLCompiler.h"
#include"common/MFCommon.h" #include"common/MFCommon.h"
@ -39,9 +40,10 @@ void ShaderCreateInfoVertex::AddJoint()
void ShaderCreateInfoVertex::AddAssign() void ShaderCreateInfoVertex::AddAssign()
{ {
char name[]="Assign"; AddInput( ASSIGN_VAT_FMT,
ASSIGN_VIS_NAME,
AddInput(VAT_UINT,name,VK_VERTEX_INPUT_RATE_INSTANCE,VertexInputGroup::Assign); VK_VERTEX_INPUT_RATE_INSTANCE,
VertexInputGroup::Assign);
AddFunction(mtl::func::GetLocalToWorld); AddFunction(mtl::func::GetLocalToWorld);
} }