added VABView,preparing new VABViewStadnalone,VABViewVDM
This commit is contained in:
parent
4e6adcd765
commit
14fbbd6fa6
2
CMCore
2
CMCore
@ -1 +1 @@
|
|||||||
Subproject commit 5e08153800ef4b0f46b9cad44b1e7e05415befef
|
Subproject commit 8f184a87fbd630da45b6708ee0fcfcb8372fdef1
|
@ -73,6 +73,8 @@ public:
|
|||||||
|
|
||||||
using VABAccessMap=Map<AnsiString,VABAccess>;
|
using VABAccessMap=Map<AnsiString,VABAccess>;
|
||||||
|
|
||||||
|
class VABView;
|
||||||
|
|
||||||
class IndexBuffer;
|
class IndexBuffer;
|
||||||
|
|
||||||
struct IndexBufferAccess
|
struct IndexBufferAccess
|
||||||
|
@ -36,6 +36,21 @@ namespace hgl
|
|||||||
};//class VertexAttribBuffer:public DeviceBuffer
|
};//class VertexAttribBuffer:public DeviceBuffer
|
||||||
|
|
||||||
using VAB=VertexAttribBuffer;
|
using VAB=VertexAttribBuffer;
|
||||||
|
|
||||||
|
class VABView
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
VABView()=default;
|
||||||
|
virtual ~VABView()=default;
|
||||||
|
|
||||||
|
virtual VAB *GetVAB()=0;
|
||||||
|
virtual VkDeviceSize GetStart()const=0;
|
||||||
|
virtual VkDeviceSize GetSize()const=0;
|
||||||
|
|
||||||
|
virtual void *Map()=0;
|
||||||
|
virtual void Unmap()=0;
|
||||||
|
};//class VABView
|
||||||
}//namespace graph
|
}//namespace graph
|
||||||
}//namespace hgl
|
}//namespace hgl
|
||||||
#endif//HGL_GRAPH_VULKAN_VERTEX_ATTRIB_BUFFER_INCLUDE
|
#endif//HGL_GRAPH_VULKAN_VERTEX_ATTRIB_BUFFER_INCLUDE
|
||||||
|
@ -3,11 +3,45 @@
|
|||||||
#include<hgl/graph/VK.h>
|
#include<hgl/graph/VK.h>
|
||||||
#include<hgl/graph/VKIndexBuffer.h>
|
#include<hgl/graph/VKIndexBuffer.h>
|
||||||
#include<hgl/type/DataChain.h>
|
#include<hgl/type/DataChain.h>
|
||||||
|
#include<hgl/type/Pair.h>
|
||||||
|
|
||||||
namespace hgl
|
namespace hgl
|
||||||
{
|
{
|
||||||
namespace graph
|
namespace graph
|
||||||
{
|
{
|
||||||
|
class VertexDataManager;
|
||||||
|
|
||||||
|
struct IBAccessNode:public IBAccess
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
VertexDataManager *vdm;
|
||||||
|
DataChain::UserNode *dc_node;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
friend class VertexDataManager;
|
||||||
|
|
||||||
|
~IBAccessNode();
|
||||||
|
};
|
||||||
|
|
||||||
|
struct VABAccessNode
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
VertexDataManager *vdm;
|
||||||
|
DataChain::UserNode *dc_node;
|
||||||
|
const VIL *vil;
|
||||||
|
|
||||||
|
VABAccess **vab;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
friend class VertexDataManager;
|
||||||
|
|
||||||
|
~VABAccessNode();
|
||||||
|
};
|
||||||
|
|
||||||
class VertexDataManager
|
class VertexDataManager
|
||||||
{
|
{
|
||||||
GPUDevice *device;
|
GPUDevice *device;
|
||||||
@ -30,6 +64,14 @@ namespace hgl
|
|||||||
DataChain vbo_data_chain; ///<数据链
|
DataChain vbo_data_chain; ///<数据链
|
||||||
DataChain ibo_data_chain; ///<数据链
|
DataChain ibo_data_chain; ///<数据链
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
friend struct IBAccessNode;
|
||||||
|
friend struct VABAccessNode;
|
||||||
|
|
||||||
|
bool ReleaseIB(DataChain::UserNode *);
|
||||||
|
bool ReleaseVAB(DataChain::UserNode *);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VertexDataManager(GPUDevice *dev,const VIL *_vil);
|
VertexDataManager(GPUDevice *dev,const VIL *_vil);
|
||||||
@ -49,6 +91,10 @@ namespace hgl
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
bool Init(const VkDeviceSize vbo_size,const VkDeviceSize ibo_size,const IndexType index_type);
|
bool Init(const VkDeviceSize vbo_size,const VkDeviceSize ibo_size,const IndexType index_type);
|
||||||
|
|
||||||
|
IBAccessNode *AcquireIB(const VkDeviceSize count);
|
||||||
|
|
||||||
|
VABAccessNode *AcquireVAB(const VkDeviceSize count);
|
||||||
};//class VertexDataManager
|
};//class VertexDataManager
|
||||||
}//namespace graph
|
}//namespace graph
|
||||||
}//namespace hgl
|
}//namespace hgl
|
||||||
|
@ -6,6 +6,19 @@
|
|||||||
|
|
||||||
namespace hgl
|
namespace hgl
|
||||||
{
|
{
|
||||||
|
namespace graph
|
||||||
|
{
|
||||||
|
IBAccessNode::~IBAccessNode()
|
||||||
|
{
|
||||||
|
vdm->ReleaseIB(dc_node);
|
||||||
|
}
|
||||||
|
|
||||||
|
VABAccessNode::~VABAccessNode()
|
||||||
|
{
|
||||||
|
vdm->ReleaseVAB(dc_node);
|
||||||
|
}
|
||||||
|
}//namespace graph
|
||||||
|
|
||||||
namespace graph
|
namespace graph
|
||||||
{
|
{
|
||||||
VertexDataManager::VertexDataManager(GPUDevice *dev,const VIL *_vil)
|
VertexDataManager::VertexDataManager(GPUDevice *dev,const VIL *_vil)
|
||||||
@ -70,5 +83,76 @@ namespace hgl
|
|||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IBAccessNode *VertexDataManager::AcquireIB(const VkDeviceSize count)
|
||||||
|
{
|
||||||
|
if(count<=0)return(false);
|
||||||
|
|
||||||
|
DataChain::UserNode *un=ibo_data_chain.Acquire(count);
|
||||||
|
|
||||||
|
if(!un)return(false);
|
||||||
|
|
||||||
|
IBAccessNode *node=new IBAccessNode;
|
||||||
|
|
||||||
|
node->vdm=this;
|
||||||
|
node->dc_node=un;
|
||||||
|
|
||||||
|
node->buffer=ibo;
|
||||||
|
node->start=un->GetStart();
|
||||||
|
node->count=un->GetCount();
|
||||||
|
|
||||||
|
ibo_cur_size+=count;
|
||||||
|
|
||||||
|
return(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VertexDataManager::ReleaseIB(DataChain::UserNode *un)
|
||||||
|
{
|
||||||
|
if(!un)return(false);
|
||||||
|
|
||||||
|
const auto count=un->GetCount();
|
||||||
|
|
||||||
|
if(!ibo_data_chain.Release(un))
|
||||||
|
return(false);
|
||||||
|
|
||||||
|
ibo_cur_size-=count;
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
VABAccessNode *VertexDataManager::AcquireVAB(const VkDeviceSize count)
|
||||||
|
{
|
||||||
|
if(count<=0)return(false);
|
||||||
|
|
||||||
|
DataChain::UserNode *un=vbo_data_chain.Acquire(count);
|
||||||
|
|
||||||
|
if(!un)return(false);
|
||||||
|
|
||||||
|
VABAccessNode *node=new VABAccessNode;
|
||||||
|
|
||||||
|
node->vdm=this;
|
||||||
|
node->dc_node=un;
|
||||||
|
node->vil=vil;
|
||||||
|
|
||||||
|
//node->buffer=vab[0];
|
||||||
|
//node->start=un->GetStart();
|
||||||
|
//node->count=un->GetCount();
|
||||||
|
|
||||||
|
vab_cur_size+=count;
|
||||||
|
|
||||||
|
return(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VertexDataManager::ReleaseVAB(DataChain::UserNode *un)
|
||||||
|
{
|
||||||
|
if(!un)return(false);
|
||||||
|
|
||||||
|
const auto count=un->GetCount();
|
||||||
|
|
||||||
|
if(!vbo_data_chain.Release(un))
|
||||||
|
return(false);
|
||||||
|
|
||||||
|
vab_cur_size-=count;
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
}//namespace graph
|
}//namespace graph
|
||||||
}//namespace hgl
|
}//namespace hgl
|
||||||
|
Loading…
x
Reference in New Issue
Block a user