VulkanDevice增加IsSupport(IndexType)函数

This commit is contained in:
2025-07-06 18:12:55 +08:00
parent 5cec598a02
commit b6167e9f0b
2 changed files with 9 additions and 0 deletions

View File

@@ -96,6 +96,7 @@ public: //Buffer相关
VAB * CreateVAB (VkFormat format, uint32_t count,const void *data, SharingMode sm=SharingMode::Exclusive);
VAB * CreateVAB (VkFormat format, uint32_t count, SharingMode sm=SharingMode::Exclusive){return CreateVAB(format,count,nullptr,sm);}
const bool IsSupport (const IndexType &type)const; ///<检测是否支持某种索引类型
const IndexType ChooseIndexType (const VkDeviceSize &vertex_count)const; ///<求一个合适的索引类型
const bool CheckIndexType (const IndexType,const VkDeviceSize &vertex_count)const; ///<检测一个索引类型是否合适

View File

@@ -77,6 +77,14 @@ VAB *VulkanDevice::CreateVAB(VkFormat format,uint32_t count,const void *data,Sha
return(new VertexAttribBuffer(attr->device,buf,format,stride,count));
}
const bool VulkanDevice::IsSupport(const IndexType &type)const
{
if(type==IndexType::U16)return(true);
if(type==IndexType::U8 &&attr->uint8_index_type)return(true);
if(type==IndexType::U32&&attr->uint32_index_type)return(true);
return(false);
}
const IndexType VulkanDevice::ChooseIndexType(const VkDeviceSize &vertex_count)const
{
if(vertex_count<=0)return(IndexType::ERR);