use VAB instead of VBO

This commit is contained in:
2024-04-24 01:38:55 +08:00
parent acb69d3bf5
commit d8140ae64e
26 changed files with 167 additions and 152 deletions

View File

@@ -16,9 +16,9 @@ namespace hgl
vi_count=_vil->GetCount();
vif_list=_vil->GetVIFList(); //来自于Material不会被释放所以指针有效
vbo_max_size=0;
vbo_cur_size=0;
vbo=hgl_zero_new<VBO *>(vi_count);
vab_max_size=0;
vab_cur_size=0;
vab=hgl_zero_new<VAB *>(vi_count);
ibo_cur_size=0;
ibo=nullptr;
@@ -26,7 +26,7 @@ namespace hgl
VertexDataManager::~VertexDataManager()
{
SAFE_CLEAR_OBJECT_ARRAY(vbo,vi_count);
SAFE_CLEAR_OBJECT_ARRAY(vab,vi_count);
SAFE_CLEAR(ibo);
}
@@ -38,26 +38,26 @@ namespace hgl
*/
bool VertexDataManager::Init(const VkDeviceSize vbo_size,const VkDeviceSize ibo_size,const IndexType index_type)
{
if(vbo[0]||ibo) //已经初始化过了
if(vab[0]||ibo) //已经初始化过了
return(false);
if(vbo_size<=0)
return(false);
vbo_max_size=vbo_size;
vab_max_size=vbo_size;
ibo_cur_size=ibo_size;
vbo_cur_size=0;
vab_cur_size=0;
ibo_cur_size=0;
for(uint i=0;i<vi_count;i++)
{
vbo[i]=device->CreateVBO(vif_list[i].format,vbo_max_size);
if(!vbo[i])
vab[i]=device->CreateVAB(vif_list[i].format,vab_max_size);
if(!vab[i])
return(false);
}
vbo_data_chain.Init(vbo_max_size);
vbo_data_chain.Init(vab_max_size);
if(ibo_size>0)
{