ULRE/inc/hgl/graph/VKArrayBuffer.h

50 lines
1.4 KiB
C
Raw Normal View History

2021-03-25 20:00:19 +08:00
#ifndef HGL_GRAPH_VULKAN_ARRAY_BUFFER_INCLUDE
2021-02-10 18:53:07 +08:00
#define HGL_GRAPH_VULKAN_ARRAY_BUFFER_INCLUDE
#include<hgl/graph/VK.h>
2021-02-10 18:53:07 +08:00
namespace hgl
{
class Collection;
2021-02-10 18:53:07 +08:00
namespace graph
{
class VKMemoryAllocator;
2021-02-10 18:53:07 +08:00
/**
2021-03-25 20:00:19 +08:00
* GPU数据阵列缓冲区<br>
* instance等
2021-02-10 18:53:07 +08:00
*/
2023-03-22 21:18:46 +08:00
class GPUArrayBuffer
2021-02-10 18:53:07 +08:00
{
protected:
GPUDevice *device;
VkBufferUsageFlags buffer_usage_flags;
2023-03-22 21:18:46 +08:00
uint item_length; ///<单个数据长度
VKMemoryAllocator *vk_ma;
2023-03-24 22:14:05 +08:00
uint32_t offset_alignment;
2021-02-10 18:53:07 +08:00
2021-05-08 18:14:44 +08:00
Collection *coll;
2021-02-10 18:53:07 +08:00
public:
2023-03-24 22:14:05 +08:00
GPUArrayBuffer(GPUDevice *dev,VkBufferUsageFlags flags,const uint il,VkDescriptorType dt);
virtual ~GPUArrayBuffer();
2021-02-10 18:53:07 +08:00
2023-03-24 22:14:05 +08:00
const uint32_t GetOffsetAlignment()const{return offset_alignment;}
const uint32_t GetUnitSize()const;
DeviceBuffer * GetBuffer();
2021-03-25 20:00:19 +08:00
uint32 Alloc(const uint32 max_count); ///<预分配空间
void Clear();
void * Map(const uint32 start,const uint32 count);
void Flush(const uint32 count);
2021-02-10 18:53:07 +08:00
};//class GPUArrayBuffer
}//namespace graph
}//namespace hgl
#endif//HGL_GRAPH_VULKAN_ARRAY_BUFFER_INCLUDE