diff --git a/inc/hgl/graph/VKDevice.h b/inc/hgl/graph/VKDevice.h index 65dac1f6..fa23e7d4 100644 --- a/inc/hgl/graph/VKDevice.h +++ b/inc/hgl/graph/VKDevice.h @@ -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; ///<检测一个索引类型是否合适 diff --git a/src/SceneGraph/Vulkan/VKDeviceBuffer.cpp b/src/SceneGraph/Vulkan/VKDeviceBuffer.cpp index 5b5cfade..377bc4f2 100644 --- a/src/SceneGraph/Vulkan/VKDeviceBuffer.cpp +++ b/src/SceneGraph/Vulkan/VKDeviceBuffer.cpp @@ -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);