supported uint8_index_type
This commit is contained in:
@@ -77,6 +77,30 @@ VBO *GPUDevice::CreateVBO(VkFormat format,uint32_t count,const void *data,Sharin
|
||||
return(new VertexAttribBuffer(attr->device,buf,format,stride,count));
|
||||
}
|
||||
|
||||
const IndexType GPUDevice::GetIndexType(const VkDeviceSize &vertex_count)const
|
||||
{
|
||||
if(vertex_count<=0)return(IndexType::ERR);
|
||||
|
||||
if(attr->uint8_index_type&& vertex_count<=0xFF )return IndexType::U8; else
|
||||
if( vertex_count<=0xFFFF)return IndexType::U16; else
|
||||
if(attr->physical_device->SupportU32Index() )return IndexType::U32; else
|
||||
|
||||
return IndexType::ERR;
|
||||
}
|
||||
|
||||
const bool GPUDevice::CheckIndexType(const IndexType it,const VkDeviceSize &vertex_count)const
|
||||
{
|
||||
if(vertex_count<=0)return(false);
|
||||
|
||||
if(it==IndexType::U16&&vertex_count<=0xFFFF)return(true);
|
||||
|
||||
if(it==IndexType::U32&&attr->physical_device->SupportU32Index())return(true);
|
||||
|
||||
if(it==IndexType::U8 &&vertex_count<=0xFF&&attr->uint8_index_type)return(true);
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
||||
IndexBuffer *GPUDevice::CreateIBO(IndexType index_type,uint32_t count,const void *data,SharingMode sharing_mode)
|
||||
{
|
||||
if(count==0)return(nullptr);
|
||||
|
@@ -229,6 +229,18 @@ VkDevice VulkanDeviceCreater::CreateDevice(const uint32_t graphics_family)
|
||||
create_info.ppEnabledLayerNames =nullptr;
|
||||
create_info.pEnabledFeatures =&features;
|
||||
|
||||
VkPhysicalDeviceIndexTypeUint8FeaturesEXT index_type_uint8_features;
|
||||
|
||||
if(physical_device->SupportU8Index()
|
||||
&&require.fullDrawIndexUint8>=VulkanHardwareRequirement::SupportLevel::Want)
|
||||
{
|
||||
create_info.pNext=&index_type_uint8_features;
|
||||
|
||||
index_type_uint8_features.sType =VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT;
|
||||
index_type_uint8_features.pNext =nullptr;
|
||||
index_type_uint8_features.indexTypeUint8=VK_TRUE;
|
||||
}
|
||||
|
||||
VkDevice device;
|
||||
|
||||
if(vkCreateDevice(*physical_device,&create_info,nullptr,&device)==VK_SUCCESS)
|
||||
@@ -300,6 +312,12 @@ GPUDevice *VulkanDeviceCreater::CreateRenderDevice()
|
||||
|
||||
ChooseSurfaceFormat();
|
||||
|
||||
if(physical_device->SupportU8Index()
|
||||
&&require.fullDrawIndexUint8>=VulkanHardwareRequirement::SupportLevel::Want)
|
||||
{
|
||||
device_attr->uint8_index_type=true;
|
||||
}
|
||||
|
||||
device_attr->surface_format=surface_format;
|
||||
|
||||
GetDeviceQueue(device_attr);
|
||||
|
Reference in New Issue
Block a user