[WIP] comments VDM, preparing double PrimitiveCreater
This commit is contained in:
parent
c49feac2e6
commit
cfd67e1a42
@ -10,7 +10,7 @@
|
||||
#include<hgl/graph/VKVertexAttribBuffer.h>
|
||||
#include<hgl/graph/mtl/Material3DCreateConfig.h>
|
||||
#include<hgl/graph/mtl/BlinnPhong.h>
|
||||
#include<hgl/graph/VertexDataManager.h>
|
||||
//#include<hgl/graph/VertexDataManager.h>
|
||||
|
||||
using namespace hgl;
|
||||
using namespace hgl::graph;
|
||||
@ -49,7 +49,7 @@ private:
|
||||
private: //sphere
|
||||
|
||||
Material * mtl_blinnphong =nullptr;
|
||||
VertexDataManager * vdm_blinnphong =nullptr;
|
||||
//VertexDataManager * vdm_blinnphong =nullptr;
|
||||
|
||||
MaterialInstance * mi_blinnphong[4]{};
|
||||
Pipeline * p_blinnphong =nullptr;
|
||||
@ -100,7 +100,7 @@ private:
|
||||
mtl_blinnphong->BindUBO(DescriptorSetType::Global,"sun",ubo_sun);
|
||||
mtl_blinnphong->Update();
|
||||
|
||||
vdm_blinnphong=new VertexDataManager(device,mtl_blinnphong->GetDefaultVIL());
|
||||
//vdm_blinnphong=new VertexDataManager(device,mtl_blinnphong->GetDefaultVIL());
|
||||
|
||||
Color4f mi_data;
|
||||
for(uint i=0;i<4;i++)
|
||||
|
@ -38,7 +38,7 @@ protected:
|
||||
public:
|
||||
|
||||
PrimitiveCreater(GPUDevice *,const VIL *,const AnsiString &name);
|
||||
//PrimitiveCreater(VertexDataManager *);
|
||||
PrimitiveCreater(VertexDataManager *);
|
||||
virtual ~PrimitiveCreater()
|
||||
{
|
||||
ClearAllData();
|
||||
|
51
inc/hgl/graph/VDMAccess.h
Normal file
51
inc/hgl/graph/VDMAccess.h
Normal file
@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/VK.h>
|
||||
#include<hgl/type/DataChain.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
class VDMAccess
|
||||
{
|
||||
protected:
|
||||
|
||||
VertexDataManager *vdm;
|
||||
DataChain::UserNode *dc_node;
|
||||
const VIL *vil;
|
||||
|
||||
public:
|
||||
|
||||
VDMAccess(VertexDataManager *_vdm,const VIL *_vil)
|
||||
{
|
||||
vdm=_vdm;
|
||||
vil=_vil;
|
||||
dc_node=nullptr;
|
||||
}
|
||||
|
||||
virtual ~VDMAccess()=default;
|
||||
|
||||
const VIL * GetVIL ()const{ return vil; }
|
||||
const DataChain::UserNode * GetDCNode ()const{ return dc_node; }
|
||||
};//class VDMAccess
|
||||
|
||||
class VABAccessVDM:public VDMAccess
|
||||
{
|
||||
VABAccess **vab;
|
||||
|
||||
public:
|
||||
|
||||
~VABAccessVDM() override
|
||||
{
|
||||
vdm->ReleaseVAB(dc_node);
|
||||
}
|
||||
|
||||
};//class VABAccessVDM:public VDMAccess
|
||||
|
||||
class IBAccessVDM:public VDMAccess
|
||||
{
|
||||
IBAccess *iba;
|
||||
|
||||
public:
|
||||
|
||||
};//class IBAccessVDM:public VDMAccess
|
||||
VK_NAMESPACE_END
|
@ -2,97 +2,64 @@
|
||||
|
||||
#include<hgl/graph/VK.h>
|
||||
#include<hgl/graph/VKIndexBuffer.h>
|
||||
#include<hgl/type/DataChain.h>
|
||||
#include<hgl/type/Pair.h>
|
||||
#include<hgl/graph/VDMAccess.h>
|
||||
|
||||
namespace hgl
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
class VertexDataManager
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
struct IBAccessNode:public IBAccess
|
||||
{
|
||||
private:
|
||||
GPUDevice *device;
|
||||
|
||||
VertexDataManager *vdm;
|
||||
DataChain::UserNode *dc_node;
|
||||
protected:
|
||||
|
||||
public:
|
||||
const VIL * vil; ///<顶点输入格式列表
|
||||
uint vi_count; ///<顶点输入流数量
|
||||
const VIF * vif_list; ///<顶点输入格式列表
|
||||
|
||||
friend class VertexDataManager;
|
||||
VkDeviceSize vab_max_size; ///<顶点缓冲区分配空间大小
|
||||
VkDeviceSize vab_cur_size; ///<顶点缓冲区当前使用大小
|
||||
VAB ** vab; ///<顶点缓冲区列表
|
||||
|
||||
~IBAccessNode();
|
||||
};
|
||||
VkDeviceSize ibo_cur_size; ///<索引缓冲区当前使用大小
|
||||
IndexBuffer * ibo; ///<索引缓冲区
|
||||
|
||||
struct VABAccessNode
|
||||
{
|
||||
private:
|
||||
protected:
|
||||
|
||||
VertexDataManager *vdm;
|
||||
DataChain::UserNode *dc_node;
|
||||
const VIL *vil;
|
||||
DataChain vbo_data_chain; ///<数据链
|
||||
DataChain ibo_data_chain; ///<数据链
|
||||
|
||||
VABAccess **vab;
|
||||
protected:
|
||||
|
||||
public:
|
||||
friend struct IBAccessVDM;
|
||||
friend struct VABAccessVDM;
|
||||
|
||||
friend class VertexDataManager;
|
||||
bool ReleaseIB(DataChain::UserNode *);
|
||||
bool ReleaseVAB(DataChain::UserNode *);
|
||||
|
||||
~VABAccessNode();
|
||||
};
|
||||
public:
|
||||
|
||||
class VertexDataManager
|
||||
{
|
||||
GPUDevice *device;
|
||||
VertexDataManager(GPUDevice *dev,const VIL *_vil);
|
||||
~VertexDataManager();
|
||||
|
||||
protected:
|
||||
GPUDevice * GetDevice ()const{return device;} ///<取得GPU设备
|
||||
|
||||
const VIL * vil; ///<顶点输入格式列表
|
||||
uint vi_count; ///<顶点输入流数量
|
||||
const VIF * vif_list; ///<顶点输入格式列表
|
||||
const VIL * GetVIL ()const{return vil;} ///<取得顶点输入格式列表
|
||||
|
||||
VkDeviceSize vab_max_size; ///<顶点缓冲区分配空间大小
|
||||
VkDeviceSize vab_cur_size; ///<顶点缓冲区当前使用大小
|
||||
VAB ** vab; ///<顶点缓冲区列表
|
||||
const VkDeviceSize GetVABMaxCount ()const{return vab_max_size;} ///<取得顶点属性缓冲区分配的空间最大数量
|
||||
const VkDeviceSize GetVABCurCount ()const{return vab_cur_size;} ///<取得顶点属性缓冲区当前数量
|
||||
|
||||
VkDeviceSize ibo_cur_size; ///<索引缓冲区当前使用大小
|
||||
IndexBuffer * ibo; ///<索引缓冲区
|
||||
const IndexType GetIBOType ()const{return ibo?ibo->GetType():IndexType::ERR;} ///<取得索引缓冲区类型
|
||||
const VkDeviceSize GetIBOMaxCount ()const{return ibo?ibo->GetCount():-1;} ///<取得索引缓冲区分配的空间最大数量
|
||||
const VkDeviceSize GetIBOCurCount ()const{return ibo?ibo_cur_size:-1;} ///<取得索引缓冲区当前数量
|
||||
|
||||
protected:
|
||||
public:
|
||||
|
||||
DataChain vbo_data_chain; ///<数据链
|
||||
DataChain ibo_data_chain; ///<数据链
|
||||
bool Init(const VkDeviceSize vbo_size,const VkDeviceSize ibo_size,const IndexType index_type);
|
||||
|
||||
protected:
|
||||
IBAccessVDM *AcquireIB(const VkDeviceSize count);
|
||||
VABAccessVDM *AcquireVAB(const VkDeviceSize count);
|
||||
|
||||
friend struct IBAccessNode;
|
||||
friend struct VABAccessNode;
|
||||
|
||||
bool ReleaseIB(DataChain::UserNode *);
|
||||
bool ReleaseVAB(DataChain::UserNode *);
|
||||
|
||||
public:
|
||||
|
||||
VertexDataManager(GPUDevice *dev,const VIL *_vil);
|
||||
~VertexDataManager();
|
||||
|
||||
GPUDevice * GetDevice ()const{return device;} ///<取得GPU设备
|
||||
|
||||
const VIL * GetVIL ()const{return vil;} ///<取得顶点输入格式列表
|
||||
|
||||
const VkDeviceSize GetVABMaxCount ()const{return vab_max_size;} ///<取得顶点属性缓冲区分配的空间最大数量
|
||||
const VkDeviceSize GetVABCurCount ()const{return vab_cur_size;} ///<取得顶点属性缓冲区当前数量
|
||||
|
||||
const IndexType GetIBOType ()const{return ibo?ibo->GetType():IndexType::ERR;} ///<取得索引缓冲区类型
|
||||
const VkDeviceSize GetIBOMaxCount ()const{return ibo?ibo->GetCount():-1;} ///<取得索引缓冲区分配的空间最大数量
|
||||
const VkDeviceSize GetIBOCurCount ()const{return ibo?ibo_cur_size:-1;} ///<取得索引缓冲区当前数量
|
||||
|
||||
public:
|
||||
|
||||
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
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
void Release(VABAccessVDM *);
|
||||
void Release(IBAccessVDM *);
|
||||
};//class VertexDataManager
|
||||
VK_NAMESPACE_END
|
||||
|
@ -9,6 +9,7 @@ SOURCE_GROUP("Texture" FILES ${SG_TEXTURE_SOURCE})
|
||||
|
||||
SET(SG_VDM_SOURCE ${SG_INCLUDE_PATH}/VertexAttribDataAccess.h
|
||||
${SG_INCLUDE_PATH}/VertexDataManager.h
|
||||
${SG_INCLUDE_PATH}/VDMAccess.h
|
||||
VertexDataManager.cpp)
|
||||
|
||||
SOURCE_GROUP("VertexDataManager" FILES ${SG_VDM_SOURCE})
|
||||
@ -307,7 +308,7 @@ add_cm_library(ULRE.SceneGraph "ULRE" ${SCENE_GRAPH_HEADER}
|
||||
|
||||
${SG_TEXTURE_SOURCE}
|
||||
${TILE_SOURCE}
|
||||
${SG_VDM_SOURCE}
|
||||
#${SG_VDM_SOURCE}
|
||||
|
||||
# ${FONT_MANAGE_SOURCE}
|
||||
# ${FONT_SOURCE}
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include<hgl/graph/VKShaderModule.h>
|
||||
#include<hgl/graph/VKVertexAttribBuffer.h>
|
||||
#include<hgl/graph/VKPrimitive.h>
|
||||
#include<hgl/graph/VertexDataManager.h>
|
||||
//#include<hgl/graph/VertexDataManager.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
|
@ -8,15 +8,29 @@ namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
IBAccessNode::~IBAccessNode()
|
||||
class IBAccessVDM:public VDMAccess
|
||||
{
|
||||
vdm->ReleaseIB(dc_node);
|
||||
}
|
||||
IBAccess *iba;
|
||||
|
||||
VABAccessNode::~VABAccessNode()
|
||||
public:
|
||||
|
||||
~IBAccessVDM() override
|
||||
{
|
||||
vdm->ReleaseIB(dc_node);
|
||||
}
|
||||
};//struct IBAccessVDM
|
||||
|
||||
class VABAccessVDM:public VDMAccess
|
||||
{
|
||||
vdm->ReleaseVAB(dc_node);
|
||||
}
|
||||
VABAccess **vab;
|
||||
|
||||
public:
|
||||
|
||||
~VABAccessVDM() override
|
||||
{
|
||||
vdm->ReleaseVAB(dc_node);
|
||||
}
|
||||
};//struct VABAccessVDM
|
||||
}//namespace graph
|
||||
|
||||
namespace graph
|
||||
@ -84,7 +98,7 @@ namespace hgl
|
||||
return(true);
|
||||
}
|
||||
|
||||
IBAccessNode *VertexDataManager::AcquireIB(const VkDeviceSize count)
|
||||
IBAccessVDM *VertexDataManager::AcquireIB(const VkDeviceSize count)
|
||||
{
|
||||
if(count<=0)return(false);
|
||||
|
||||
@ -92,7 +106,7 @@ namespace hgl
|
||||
|
||||
if(!un)return(false);
|
||||
|
||||
IBAccessNode *node=new IBAccessNode;
|
||||
IBAccessVDM *node=new IBAccessVDM;
|
||||
|
||||
node->vdm=this;
|
||||
node->dc_node=un;
|
||||
@ -119,7 +133,7 @@ namespace hgl
|
||||
return(true);
|
||||
}
|
||||
|
||||
VABAccessNode *VertexDataManager::AcquireVAB(const VkDeviceSize count)
|
||||
VABAccessVDM *VertexDataManager::AcquireVAB(const VkDeviceSize count)
|
||||
{
|
||||
if(count<=0)return(false);
|
||||
|
||||
@ -127,7 +141,7 @@ namespace hgl
|
||||
|
||||
if(!un)return(false);
|
||||
|
||||
VABAccessNode *node=new VABAccessNode;
|
||||
VABAccessVDM *node=new VABAccessVDM;
|
||||
|
||||
node->vdm=this;
|
||||
node->dc_node=un;
|
||||
|
Loading…
x
Reference in New Issue
Block a user