changed GPUArrayBuffer to non-template
This commit is contained in:
parent
5d9aab7dda
commit
5f830b8d57
@ -13,12 +13,15 @@ namespace hgl
|
||||
* GPU数据阵列缓冲区<br>
|
||||
* 它用于储存多份相同格式的数据,常用于多物件渲染,instance等
|
||||
*/
|
||||
template<typename T> class GPUArrayBuffer
|
||||
class GPUArrayBuffer
|
||||
{
|
||||
protected:
|
||||
|
||||
GPUDevice *device;
|
||||
VkBufferUsageFlags buffer_usage_flags;
|
||||
|
||||
uint item_length; ///<单个数据长度
|
||||
|
||||
VKMemoryAllocator *vk_ma;
|
||||
|
||||
uint32_t ubo_offset_alignment;
|
||||
@ -27,15 +30,16 @@ namespace hgl
|
||||
|
||||
public:
|
||||
|
||||
GPUArrayBuffer(GPUDevice *dev,VkBufferUsageFlags flags)
|
||||
GPUArrayBuffer(GPUDevice *dev,VkBufferUsageFlags flags,const uint il)
|
||||
{
|
||||
device=dev;
|
||||
buffer_usage_flags=flags;
|
||||
item_length=il;
|
||||
|
||||
{
|
||||
ubo_offset_alignment=device->GetUBOAlign();
|
||||
|
||||
const uint32_t unit_size=hgl_align<uint32_t>(sizeof(T),ubo_offset_alignment);
|
||||
const uint32_t unit_size=hgl_align<uint32_t>(item_length,ubo_offset_alignment);
|
||||
|
||||
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);
|
||||
@ -77,9 +81,9 @@ namespace hgl
|
||||
coll->Clear();
|
||||
}
|
||||
|
||||
T *Map(const uint32 start,const uint32 count)
|
||||
void *Map(const uint32 start,const uint32 count)
|
||||
{
|
||||
return (T *)(coll->Map(start,count));
|
||||
return coll->Map(start,count);
|
||||
}
|
||||
|
||||
void Flush(const uint32 count)
|
||||
|
Loading…
x
Reference in New Issue
Block a user