1.added GetRangeSize at VKArrayBuffer

2.renamed to align_size instead of unit_size
This commit is contained in:
2023-04-25 11:36:50 +08:00
parent 0e589e8bcd
commit d163f914c7
4 changed files with 25 additions and 24 deletions

View File

@@ -19,7 +19,8 @@ namespace hgl
{
protected:
uint unit_size;
uint align_size;
uint range_size;
VKMemoryAllocator *vk_ma;
@@ -32,7 +33,7 @@ namespace hgl
private:
GPUArrayBuffer(VKMemoryAllocator *,const uint);
GPUArrayBuffer(VKMemoryAllocator *,const uint,const uint);
friend class GPUDevice;
@@ -40,10 +41,12 @@ namespace hgl
virtual ~GPUArrayBuffer();
const uint32_t GetUnitSize()const{return unit_size;}
const uint32_t GetAlignSize()const{return align_size;} ///<数据对齐字节数
const uint32_t GetRangeSize()const{return range_size;} ///<单次渲染访问最大字节数
DeviceBuffer * GetBuffer();
uint32 Alloc(const uint32 max_count); ///<预分配空间
uint32 Alloc(const uint32 max_count); ///<预分配空间
void Clear();
template<typename T>
@@ -55,7 +58,7 @@ namespace hgl
if(!ptr)return(false);
ubo_access->Start((uchar *)ptr,unit_size,count);
ubo_access->Start((uchar *)ptr,align_size,count);
return(true);
}

View File

@@ -137,6 +137,8 @@ public: //Buffer相关
const VkDeviceSize GetUBOAlign();
const VkDeviceSize GetSSBOAlign();
const VkDeviceSize GetUBORange();
const VkDeviceSize GetSSBORange();
#define CREATE_BUFFER_OBJECT(LargeName,type) DeviceBuffer *Create##LargeName( VkDeviceSize size,void *data, SharingMode sm=SharingMode::Exclusive) {return CreateBuffer(VK_BUFFER_USAGE_##type##_BUFFER_BIT,size ,size,data, sm);} \
DeviceBuffer *Create##LargeName( VkDeviceSize size, SharingMode sm=SharingMode::Exclusive) {return CreateBuffer(VK_BUFFER_USAGE_##type##_BUFFER_BIT,size ,size,nullptr, sm);} \