增加CreateVB函数,用于根据基础类型创建VertexBuffer
This commit is contained in:
parent
b4dcd029f9
commit
4950a33ae5
@ -1 +1 @@
|
|||||||
Subproject commit 5530bcc0dc92f76adc0716a4c3c0ca64d8240642
|
Subproject commit 321991587905e07076574f104831bc8457f630b3
|
2
CMCore
2
CMCore
@ -1 +1 @@
|
|||||||
Subproject commit 77a570d6beb4d7bc68333b7063cadcf69b891589
|
Subproject commit 353bdef68b704d92a82adc55e65a0627bc857b54
|
@ -1 +1 @@
|
|||||||
Subproject commit cdd9d4eb14f4c7f852362f59c14d680f39370685
|
Subproject commit c041a934174d21e75a37d1315abcd8f89503f5e6
|
@ -1 +1 @@
|
|||||||
Subproject commit c4f5e3d339dac74cfb48f7cf17ea18e51990c709
|
Subproject commit 3acc9851166e41f2560b968791f43477ab524cc7
|
@ -1128,6 +1128,14 @@ namespace hgl
|
|||||||
typedef VertexBuffer4<uint32> VB4u32 ,VB4ui; template<> inline VkFormat VertexBuffer4<uint32 >::GetDataType()const{return FMT_RGBA32U; }
|
typedef VertexBuffer4<uint32> VB4u32 ,VB4ui; template<> inline VkFormat VertexBuffer4<uint32 >::GetDataType()const{return FMT_RGBA32U; }
|
||||||
typedef VertexBuffer4<float > VB4f; template<> inline VkFormat VertexBuffer4<float >::GetDataType()const{return FMT_RGBA32F; }
|
typedef VertexBuffer4<float > VB4f; template<> inline VkFormat VertexBuffer4<float >::GetDataType()const{return FMT_RGBA32F; }
|
||||||
typedef VertexBuffer4<double> VB4d; template<> inline VkFormat VertexBuffer4<double >::GetDataType()const{return FMT_RGBA64F; }
|
typedef VertexBuffer4<double> VB4d; template<> inline VkFormat VertexBuffer4<double >::GetDataType()const{return FMT_RGBA64F; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据格式要求,创建对应的VBC
|
||||||
|
* @param base_type 基础格式,参见spirv_cross/spirv_common.hpp中的spirv_cross::SPIRType
|
||||||
|
* @param vecsize vec数量
|
||||||
|
* @param vertex_count 顶点数量
|
||||||
|
*/
|
||||||
|
VertexBufferCreater *CreateVB(const uint32_t base_type,const uint32_t vecsize,const uint32_t vertex_count);
|
||||||
}//namespace graph
|
}//namespace graph
|
||||||
}//namespace hgl
|
}//namespace hgl
|
||||||
#endif//HGL_GRAPH_VERTEX_BUFFER_INCLUDE
|
#endif//HGL_GRAPH_VERTEX_BUFFER_INCLUDE
|
||||||
|
@ -9,13 +9,80 @@ Buffer::~Buffer()
|
|||||||
vkDestroyBuffer(device,buf.buffer,nullptr);
|
vkDestroyBuffer(device,buf.buffer,nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VertexBufferCreater *CreateVB(const uint32_t base_type,const uint32_t vecsize,const uint32_t vertex_count)
|
||||||
|
{
|
||||||
VertexBufferCreater *CreateVBO(const uint32_t base_type,const uint32_t vecsize,const uint32_t vertex_count)
|
if(base_type==spirv_cross::SPIRType::SByte)
|
||||||
|
{
|
||||||
|
if(vecsize==1)return(new VB1i8(vertex_count));else
|
||||||
|
if(vecsize==2)return(new VB2i8(vertex_count));else
|
||||||
|
//if(vecsize==3)return(new VB3i8(vertex_count));else
|
||||||
|
if(vecsize==4)return(new VB4i8(vertex_count));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(base_type==spirv_cross::SPIRType::UByte)
|
||||||
|
{
|
||||||
|
if(vecsize==1)return(new VB1u8(vertex_count));else
|
||||||
|
if(vecsize==2)return(new VB2u8(vertex_count));else
|
||||||
|
//if(vecsize==3)return(new VB3u8(vertex_count));else
|
||||||
|
if(vecsize==4)return(new VB4u8(vertex_count));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(base_type==spirv_cross::SPIRType::Short)
|
||||||
|
{
|
||||||
|
if(vecsize==1)return(new VB1i16(vertex_count));else
|
||||||
|
if(vecsize==2)return(new VB2i16(vertex_count));else
|
||||||
|
//if(vecsize==3)return(new VB3i16(vertex_count));else
|
||||||
|
if(vecsize==4)return(new VB4i16(vertex_count));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(base_type==spirv_cross::SPIRType::UShort)
|
||||||
|
{
|
||||||
|
if(vecsize==1)return(new VB1u16(vertex_count));else
|
||||||
|
if(vecsize==2)return(new VB2u16(vertex_count));else
|
||||||
|
//if(vecsize==3)return(new VB3u16(vertex_count));else
|
||||||
|
if(vecsize==4)return(new VB4u16(vertex_count));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(base_type==spirv_cross::SPIRType::Int)
|
||||||
|
{
|
||||||
|
if(vecsize==1)return(new VB1i32(vertex_count));else
|
||||||
|
if(vecsize==2)return(new VB2i32(vertex_count));else
|
||||||
|
if(vecsize==3)return(new VB3i32(vertex_count));else
|
||||||
|
if(vecsize==4)return(new VB4i32(vertex_count));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(base_type==spirv_cross::SPIRType::UInt)
|
||||||
|
{
|
||||||
|
if(vecsize==1)return(new VB1u32(vertex_count));else
|
||||||
|
if(vecsize==2)return(new VB2u32(vertex_count));else
|
||||||
|
if(vecsize==3)return(new VB3u32(vertex_count));else
|
||||||
|
if(vecsize==4)return(new VB4u32(vertex_count));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(base_type==spirv_cross::SPIRType::Half)
|
||||||
|
{
|
||||||
|
//if(vecsize==1)return(new VB1hf(vertex_count));else
|
||||||
|
//if(vecsize==2)return(new VB2hf(vertex_count));else
|
||||||
|
//if(vecsize==3)return(new VB3hf(vertex_count));else
|
||||||
|
//if(vecsize==4)return(new VB4hf(vertex_count));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(base_type==spirv_cross::SPIRType::Float)
|
||||||
{
|
{
|
||||||
if(vecsize==1)return(new VB1f(vertex_count));else
|
if(vecsize==1)return(new VB1f(vertex_count));else
|
||||||
if(vecsize==2)return(new VB2f(vertex_count));else
|
if(vecsize==2)return(new VB2f(vertex_count));else
|
||||||
if(vecsize==3)return(new VB3f(vertex_count));else
|
if(vecsize==3)return(new VB3f(vertex_count));else
|
||||||
if(vecsize==4)return(new VB4f(vertex_count));else
|
if(vecsize==4)return(new VB4f(vertex_count));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(base_type==spirv_cross::SPIRType::Double)
|
||||||
|
{
|
||||||
|
if(vecsize==1)return(new VB1d(vertex_count));else
|
||||||
|
if(vecsize==2)return(new VB2d(vertex_count));else
|
||||||
|
if(vecsize==3)return(new VB3d(vertex_count));else
|
||||||
|
if(vecsize==4)return(new VB4d(vertex_count));
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
Loading…
x
Reference in New Issue
Block a user