From 4ef1283fce2ae92d658929d126da4f19cdfb2641 Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Thu, 11 May 2023 21:07:26 +0800 Subject: [PATCH] added uint8 IndexType --- inc/hgl/graph/VK.h | 5 +++-- inc/hgl/graph/VKIndexBuffer.h | 4 ++-- src/SceneGraph/Vulkan/VKDeviceBuffer.cpp | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/inc/hgl/graph/VK.h b/inc/hgl/graph/VK.h index 16880ae9..488c649f 100644 --- a/inc/hgl/graph/VK.h +++ b/inc/hgl/graph/VK.h @@ -136,10 +136,11 @@ inline const uint32_t GetMipLevel(const VkExtent3D &ext) /** * 索引类型,等同于VkIndexType */ -enum IndexType +enum IndexType:uint { U16=0, - U32 + U32, + U8=VK_INDEX_TYPE_UINT8_EXT, }; /** diff --git a/inc/hgl/graph/VKIndexBuffer.h b/inc/hgl/graph/VKIndexBuffer.h index 757ad6d1..ff29484b 100644 --- a/inc/hgl/graph/VKIndexBuffer.h +++ b/inc/hgl/graph/VKIndexBuffer.h @@ -26,8 +26,8 @@ namespace hgl ~IndexBuffer()=default; - const IndexType GetType ()const{return index_type;} - const uint32 GetCount()const{return count;} + const IndexType GetType ()const{return index_type;} + const uint32 GetCount()const{return count;} };//class IndexBuffer:public DeviceBuffer }//namespace graph }//namespace hgl diff --git a/src/SceneGraph/Vulkan/VKDeviceBuffer.cpp b/src/SceneGraph/Vulkan/VKDeviceBuffer.cpp index 95968186..55a2720d 100644 --- a/src/SceneGraph/Vulkan/VKDeviceBuffer.cpp +++ b/src/SceneGraph/Vulkan/VKDeviceBuffer.cpp @@ -76,6 +76,7 @@ IndexBuffer *GPUDevice::CreateIBO(IndexType index_type,uint32_t count,const void { uint32_t stride; + if(index_type==IndexType::U8 )stride=1;else if(index_type==IndexType::U16)stride=2;else if(index_type==IndexType::U32)stride=4;else return(nullptr);