2024-05-25 01:46:19 +08:00
|
|
|
|
#include<hgl/graph/VK.h>
|
|
|
|
|
|
|
|
|
|
VK_NAMESPACE_BEGIN
|
|
|
|
|
/*
|
|
|
|
|
1.截止2024.4.27,根据vulkan.gpuinfo.org统计,只有9%的设备maxVertexInputAttributes为16,不存在低于16的设备。
|
|
|
|
|
9.0%的设备为28 - 31
|
|
|
|
|
70.7%的设备为32
|
|
|
|
|
9.6%的设备为64
|
|
|
|
|
|
|
|
|
|
由于我们暂时没有发现需要使用16个以上属性的情况,所以这里暂定使用16。
|
|
|
|
|
(如果时间过去久远,可再次查询此值是否可改成更高的值,以及是否需要)
|
|
|
|
|
|
|
|
|
|
2.为何va_name使用char[][]而不是String以及动态分配内存?
|
|
|
|
|
|
|
|
|
|
就是为了必避动态分配内存,以及可以直接memcpy处理,所以此处这样定义。
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
class PrimitiveData
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
|
2024-05-28 02:21:33 +08:00
|
|
|
|
const VIL * vil;
|
2024-05-25 01:46:19 +08:00
|
|
|
|
|
2024-05-28 02:21:33 +08:00
|
|
|
|
uint32_t vertex_count;
|
|
|
|
|
uint32_t index_count;
|
2024-05-25 01:46:19 +08:00
|
|
|
|
|
2024-05-28 02:21:33 +08:00
|
|
|
|
VAB ** vab_list;
|
|
|
|
|
IndexBuffer * ibo;
|
2024-05-25 01:46:19 +08:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2024-05-26 15:04:44 +08:00
|
|
|
|
PrimitiveData(const VIL *_vil,const uint32_t vc);
|
2024-05-25 01:46:19 +08:00
|
|
|
|
virtual ~PrimitiveData();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2024-05-26 15:04:44 +08:00
|
|
|
|
const uint32_t GetVertexCount ()const{return vertex_count;}
|
2024-05-25 01:46:19 +08:00
|
|
|
|
const int GetVABCount ()const;
|
|
|
|
|
const int GetVABIndex (const AnsiString &name)const;
|
2024-05-28 02:21:33 +08:00
|
|
|
|
VAB * GetVAB (const int index);
|
2024-05-28 23:10:50 +08:00
|
|
|
|
VAB * GetVAB (const AnsiString &name){return GetVAB(GetVABIndex(name));}
|
2024-05-25 22:08:01 +08:00
|
|
|
|
|
2024-05-28 02:21:33 +08:00
|
|
|
|
IndexBuffer * GetIBO (){return ibo;}
|
|
|
|
|
uint32_t GetIndexCount ()const{return index_count;}
|
2024-05-25 01:46:19 +08:00
|
|
|
|
|
2024-05-28 02:21:33 +08:00
|
|
|
|
virtual int32_t GetVertexOffset ()const=0; ///<取得顶点偏移(注意是顶点不是字节)
|
|
|
|
|
virtual uint32_t GetFirstIndex ()const=0; ///<取得第一个索引
|
2024-05-25 13:48:15 +08:00
|
|
|
|
|
2024-05-28 23:33:15 +08:00
|
|
|
|
virtual VertexDataManager * GetVDM()const=0; ///<取得顶点数据管理器
|
|
|
|
|
|
2024-05-25 01:46:19 +08:00
|
|
|
|
public:
|
|
|
|
|
|
2024-05-28 02:21:33 +08:00
|
|
|
|
virtual IndexBuffer * InitIBO(const uint32_t index_count,IndexType it)=0;
|
2024-06-12 00:23:09 +08:00
|
|
|
|
virtual VAB * InitVAB(const int vab_index,const void *data)=0;
|
2024-05-25 01:46:19 +08:00
|
|
|
|
};//class PrimitiveData
|
|
|
|
|
|
2024-05-26 15:04:44 +08:00
|
|
|
|
PrimitiveData *CreatePrimitiveData(GPUDevice *dev,const VIL *_vil,const uint32_t vc);
|
|
|
|
|
PrimitiveData *CreatePrimitiveData(VertexDataManager *vdm,const uint32_t vc);
|
2024-05-28 02:21:33 +08:00
|
|
|
|
VK_NAMESPACE_END
|