moved GPUArrayBuffer construct function to private scope.

This commit is contained in:
hyzboy 2021-04-06 19:13:53 +08:00
parent fa26330c42
commit 8f1fc82697
3 changed files with 13 additions and 3 deletions

View File

@ -26,9 +26,14 @@ namespace hgl
uint8 * buf_cpu; uint8 * buf_cpu;
uint32_t * offset; ///<数据偏移地址 uint32_t * offset; ///<数据偏移地址
private:
GPUArrayBuffer(GPUDevice *,const uint32_t s=0,const uint32_t c=0);
friend class GPUDevice;
public: public:
GPUArrayBuffer(GPUDevice *,const uint32_t s=0,const uint32_t c=0);
virtual ~GPUArrayBuffer(); virtual ~GPUArrayBuffer();
void Clear(); ///<清空缓冲区 void Clear(); ///<清空缓冲区

View File

@ -1,5 +1,6 @@
#include<hgl/graph/VKDevice.h> #include<hgl/graph/VKDevice.h>
#include<hgl/graph/VKBuffer.h> #include<hgl/graph/VKIndexBuffer.h>
#include<hgl/graph/VKVertexAttribBuffer.h>
VK_NAMESPACE_BEGIN VK_NAMESPACE_BEGIN
bool GPUDevice::CreateBuffer(GPUBufferData *buf,VkBufferUsageFlags buf_usage,VkDeviceSize size,const void *data,SharingMode sharing_mode) bool GPUDevice::CreateBuffer(GPUBufferData *buf,VkBufferUsageFlags buf_usage,VkDeviceSize size,const void *data,SharingMode sharing_mode)

View File

@ -17,7 +17,11 @@ VKMemoryAllocator::VKMemoryAllocator(GPUDevice *d,const uint32_t flags)
VKMemoryAllocator::~VKMemoryAllocator() VKMemoryAllocator::~VKMemoryAllocator()
{ {
SAFE_CLEAR(gpu_buffer); if(gpu_buffer)
{
gpu_buffer->Unmap();
delete gpu_buffer;
}
} }
bool VKMemoryAllocator::Alloc() bool VKMemoryAllocator::Alloc()