finished dynamic UBO for RenderList,,,but rendering breakout error.

This commit is contained in:
2021-06-22 21:33:47 +08:00
parent bbab22304d
commit c3e9015d95
16 changed files with 152 additions and 80 deletions

View File

@@ -33,16 +33,17 @@ namespace hgl
buffer_usage_flags=flags;
{
uint32_t unit_size=sizeof(T);
vk_ma=new VKMemoryAllocator(device,buffer_usage_flags); // construct function is going to set AllocUnitSize by minUniformOffsetAlignment
MemoryBlock *mb=new MemoryBlock(vk_ma);
ubo_offset_alignment=device->GetUBOAlign();
ubo_offset_alignment=vk_ma->GetAllocUnitSize();
uint32_t unit_size=sizeof(T);
const uint32_t align_size=ubo_offset_alignment-1;
unit_size=(unit_size+align_size)&(~align_size);
vk_ma=new VKMemoryAllocator(device,buffer_usage_flags,unit_size); // construct function is going to set AllocUnitSize by minUniformOffsetAlignment
MemoryBlock *mb=new MemoryBlock(vk_ma);
coll=new Collection(unit_size,mb);
}
}
@@ -84,6 +85,11 @@ namespace hgl
{
return (T *)(coll->Map(start,count));
}
void Flush(const uint32 count)
{
vk_ma->Flush(count*GetUnitSize());
}
};//class GPUArrayBuffer
}//namespace graph
}//namespace hgl