fixed uint8 indextype

This commit is contained in:
hyzboy 2024-05-05 15:12:14 +08:00
parent 03491dbed8
commit 310cc151fa
6 changed files with 16 additions and 6 deletions

View File

@ -55,6 +55,7 @@ public:
return(nullptr); return(nullptr);
VABAccess vad; VABAccess vad;
if(!this->AcquirePVB(&vad,name,nullptr)) if(!this->AcquirePVB(&vad,name,nullptr))
return(nullptr); return(nullptr);

View File

@ -40,6 +40,7 @@ struct GPUDeviceAttribute
VkCompositeAlphaFlagBitsKHR compositeAlpha =VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; VkCompositeAlphaFlagBitsKHR compositeAlpha =VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
bool uint8_index_type=false; bool uint8_index_type=false;
bool uint32_index_type=false;
VkDevice device =VK_NULL_HANDLE; VkDevice device =VK_NULL_HANDLE;
VkCommandPool cmd_pool =VK_NULL_HANDLE; VkCommandPool cmd_pool =VK_NULL_HANDLE;

View File

@ -14,6 +14,8 @@ struct VulkanHardwareRequirement
Must, ///<必须支持 Must, ///<必须支持
}; };
//这里使用这种大小写是为了和VulkanSDK中的定义保持一致cpp中使用宏比较和复制时只使用一个名字即可
uint maxImageDimension1D; uint maxImageDimension1D;
uint maxImageDimension2D; uint maxImageDimension2D;
uint maxImageDimension3D; uint maxImageDimension3D;

View File

@ -81,9 +81,9 @@ const IndexType GPUDevice::ChooseIndexType(const VkDeviceSize &vertex_count)cons
{ {
if(vertex_count<=0)return(IndexType::ERR); if(vertex_count<=0)return(IndexType::ERR);
if(attr->uint8_index_type&& vertex_count<=0xFF )return IndexType::U8; else if(attr->uint8_index_type&& vertex_count<=0xFF )return IndexType::U8; else
if( vertex_count<=0xFFFF)return IndexType::U16; else if( vertex_count<=0xFFFF)return IndexType::U16; else
if(attr->physical_device->SupportU32Index() )return IndexType::U32; else if(attr->uint32_index_type )return IndexType::U32; else
return IndexType::ERR; return IndexType::ERR;
} }
@ -94,9 +94,9 @@ const bool GPUDevice::CheckIndexType(const IndexType it,const VkDeviceSize &vert
if(it==IndexType::U16&&vertex_count<=0xFFFF)return(true); if(it==IndexType::U16&&vertex_count<=0xFFFF)return(true);
if(it==IndexType::U32&&attr->physical_device->SupportU32Index())return(true); if(it==IndexType::U32&& attr->uint32_index_type)return(true);
if(it==IndexType::U8 &&vertex_count<=0xFF&&attr->uint8_index_type)return(true); if(it==IndexType::U8 &&vertex_count<=0xFF&& attr->uint8_index_type)return(true);
return(false); return(false);
} }

View File

@ -318,6 +318,12 @@ GPUDevice *VulkanDeviceCreater::CreateRenderDevice()
device_attr->uint8_index_type=true; device_attr->uint8_index_type=true;
} }
if(physical_device->SupportU32Index()
&&require.fullDrawIndexUint32>=VulkanHardwareRequirement::SupportLevel::Want)
{
device_attr->uint32_index_type=true;
}
device_attr->surface_format=surface_format; device_attr->surface_format=surface_format;
GetDeviceQueue(device_attr); GetDeviceQueue(device_attr);