2022-06-24 17:51:39 +08:00
|
|
|
|
#include<hgl/graph/VKPrimitive.h>
|
|
|
|
|
#include<hgl/graph/VKBuffer.h>
|
|
|
|
|
#include<hgl/graph/VKShaderModule.h>
|
|
|
|
|
#include<hgl/graph/VKVertexAttribBuffer.h>
|
2024-04-27 03:09:16 +08:00
|
|
|
|
#include<hgl/graph/VKIndexBuffer.h>
|
2024-05-25 01:46:19 +08:00
|
|
|
|
#include"VKPrimitiveData.h"
|
2022-06-24 17:51:39 +08:00
|
|
|
|
|
2023-10-12 05:55:39 +08:00
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
#include<hgl/graph/VKDevice.h>
|
|
|
|
|
#include<hgl/graph/VKDeviceAttribute.h>
|
|
|
|
|
#endif//_DEBUG
|
|
|
|
|
|
2022-06-24 17:51:39 +08:00
|
|
|
|
VK_NAMESPACE_BEGIN
|
2024-05-23 02:19:40 +08:00
|
|
|
|
|
2022-10-11 19:16:06 +08:00
|
|
|
|
//bool Renderable::Set(const int stage_input_binding,VIL *vil,VkDeviceSize offset)
|
2022-06-24 17:51:39 +08:00
|
|
|
|
//{
|
2022-10-11 19:16:06 +08:00
|
|
|
|
// if(stage_input_binding<0||stage_input_binding>=buf_count||!vil)return(false);
|
2022-06-24 17:51:39 +08:00
|
|
|
|
//
|
|
|
|
|
// const VkVertexInputBindingDescription *desc=vertex_sm->GetDesc(stage_input_binding);
|
|
|
|
|
// const VkVertexInputAttributeDescription *attr=vertex_sm->GetAttr(stage_input_binding);
|
|
|
|
|
//
|
2022-10-11 19:16:06 +08:00
|
|
|
|
// if(vil->GetFormat()!=attr->format)return(false);
|
|
|
|
|
// if(vil->GetStride()!=desc->stride)return(false);
|
2022-06-24 17:51:39 +08:00
|
|
|
|
//
|
|
|
|
|
// //format信息来自于shader,实际中可以不一样。但那样需要为每一个格式产生一个同样shader的material instance,不同的格式又需要不同的pipeline,我们不支持这种行为
|
|
|
|
|
//
|
2022-10-11 19:16:06 +08:00
|
|
|
|
// buf_list[stage_input_binding]=vil->GetBuffer();
|
2022-06-24 17:51:39 +08:00
|
|
|
|
// buf_offset[stage_input_binding]=offset;
|
|
|
|
|
//
|
|
|
|
|
// return(true);
|
|
|
|
|
//}
|
|
|
|
|
|
2024-05-25 01:46:19 +08:00
|
|
|
|
Primitive::Primitive(const AnsiString &pn,PrimitiveData *pd)
|
|
|
|
|
{
|
|
|
|
|
prim_name=pn;
|
|
|
|
|
prim_data=pd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Primitive::~Primitive()
|
|
|
|
|
{
|
|
|
|
|
SAFE_CLEAR(prim_data);
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-23 02:19:40 +08:00
|
|
|
|
const VkDeviceSize Primitive::GetVertexCount()const
|
2022-06-24 17:51:39 +08:00
|
|
|
|
{
|
2024-05-25 01:46:19 +08:00
|
|
|
|
return prim_data->GetVertexCount();
|
2022-06-24 17:51:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-25 01:46:19 +08:00
|
|
|
|
const int Primitive::GetVABCount()const
|
2022-06-24 17:51:39 +08:00
|
|
|
|
{
|
2024-05-25 01:46:19 +08:00
|
|
|
|
return prim_data->GetVABCount();
|
2022-06-24 17:51:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-28 23:10:50 +08:00
|
|
|
|
const int Primitive::GetVABIndex(const AnsiString &name)const
|
2023-10-12 05:55:39 +08:00
|
|
|
|
{
|
2024-05-28 23:10:50 +08:00
|
|
|
|
return prim_data->GetVABIndex(name);
|
2024-05-23 02:19:40 +08:00
|
|
|
|
}
|
2023-10-13 01:48:07 +08:00
|
|
|
|
|
2024-05-28 23:10:50 +08:00
|
|
|
|
VAB *Primitive::GetVAB(const int vab_index)
|
2024-05-23 02:19:40 +08:00
|
|
|
|
{
|
2024-05-28 23:10:50 +08:00
|
|
|
|
return prim_data->GetVAB(vab_index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const int32_t Primitive::GetVertexOffset()const
|
|
|
|
|
{
|
|
|
|
|
return prim_data->GetVertexOffset();
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-12 02:07:54 +08:00
|
|
|
|
VABMap *Primitive::GetVABMap(const int vab_index)
|
|
|
|
|
{
|
|
|
|
|
return prim_data->GetVABMap(vab_index);
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-28 23:10:50 +08:00
|
|
|
|
const uint32_t Primitive::GetIndexCount()const
|
|
|
|
|
{
|
|
|
|
|
return prim_data->GetIndexCount();
|
2023-10-12 05:55:39 +08:00
|
|
|
|
}
|
2024-05-23 02:19:40 +08:00
|
|
|
|
|
2024-05-25 22:08:01 +08:00
|
|
|
|
IndexBuffer *Primitive::GetIBO()
|
|
|
|
|
{
|
|
|
|
|
return prim_data->GetIBO();
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-28 23:10:50 +08:00
|
|
|
|
const uint32_t Primitive::GetFirstIndex()const
|
|
|
|
|
{
|
|
|
|
|
return prim_data->GetFirstIndex();
|
|
|
|
|
}
|
2024-05-28 23:33:15 +08:00
|
|
|
|
|
2024-06-12 02:07:54 +08:00
|
|
|
|
IBMap *Primitive::GetIBMap()
|
|
|
|
|
{
|
|
|
|
|
return prim_data->GetIBMap();
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-28 23:33:15 +08:00
|
|
|
|
VertexDataManager *Primitive::GetVDM()
|
|
|
|
|
{
|
|
|
|
|
return prim_data->GetVDM();
|
|
|
|
|
}
|
2022-06-24 17:51:39 +08:00
|
|
|
|
VK_NAMESPACE_END
|