From b6167e9f0b157f66a0eecfee9a2d4d9199bca0cf Mon Sep 17 00:00:00 2001 From: hyzboy Date: Sun, 6 Jul 2025 18:12:55 +0800 Subject: [PATCH] =?UTF-8?q?VulkanDevice=E5=A2=9E=E5=8A=A0IsSupport(IndexTy?= =?UTF-8?q?pe)=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/hgl/graph/VKDevice.h | 1 + src/SceneGraph/Vulkan/VKDeviceBuffer.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) 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);