fixed VABMap
This commit is contained in:
parent
66ef3160e1
commit
01bb4b2153
@ -138,7 +138,10 @@ public:
|
||||
buf_map=pc->MapVAB(name,T::GetVulkanFormat());
|
||||
|
||||
if(buf_map)
|
||||
map_ptr=(T *)(buf_map->Map());
|
||||
{
|
||||
map_ptr=T::Create(buf_map->GetSize(),buf_map->Map());
|
||||
map_ptr->Begin();
|
||||
}
|
||||
else
|
||||
map_ptr=nullptr;
|
||||
}
|
||||
@ -146,12 +149,20 @@ public:
|
||||
~VABMap()
|
||||
{
|
||||
if(map_ptr)
|
||||
{
|
||||
buf_map->Unmap();
|
||||
delete map_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
const bool IsValid()const{ return buf_map?buf_map->IsValid():false; }
|
||||
const bool IsValid()const{ return map_ptr?map_ptr:false; }
|
||||
|
||||
void Restart()
|
||||
{
|
||||
if(map_ptr)
|
||||
map_ptr->Begin();
|
||||
}
|
||||
|
||||
operator T *(){ return map_ptr; }
|
||||
T *operator->(){ return map_ptr; }
|
||||
};//template<typename T> class VABMap
|
||||
|
||||
|
@ -22,6 +22,7 @@ public:
|
||||
|
||||
void Set(DeviceBuffer *buf_ptr,VkDeviceSize off,VkDeviceSize s);
|
||||
|
||||
const VkDeviceSize GetSize()const{ return size; }
|
||||
const bool IsValid()const{ return buffer; }
|
||||
void Clear();
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include<hgl/graph/VKBufferMap.h>
|
||||
#include<hgl/graph/VKVertexAttribBuffer.h>
|
||||
#include<iostream>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
@ -27,8 +26,6 @@ void VKBufferMap::Clear()
|
||||
VKBufferMap::VKBufferMap()
|
||||
{
|
||||
Set(nullptr,0,0);
|
||||
|
||||
std::cout<<"VKBufferMap Create"<<std::endl;
|
||||
}
|
||||
|
||||
VKBufferMap::VKBufferMap(DeviceBuffer *buf,VkDeviceSize off,VkDeviceSize s)
|
||||
@ -40,8 +37,6 @@ VKBufferMap::~VKBufferMap()
|
||||
{
|
||||
if(buffer&&map_ptr)
|
||||
buffer->Unmap();
|
||||
|
||||
std::cout<<"VKBufferMap Destory"<<std::endl;
|
||||
}
|
||||
|
||||
void *VKBufferMap::Map()
|
||||
@ -54,7 +49,6 @@ void *VKBufferMap::Map()
|
||||
|
||||
map_ptr=buffer->Map(offset,size);
|
||||
return map_ptr;
|
||||
|
||||
}
|
||||
|
||||
void VKBufferMap::Unmap()
|
||||
|
Loading…
x
Reference in New Issue
Block a user