diff --git a/inc/hgl/graph/PrimitiveCreater.h b/inc/hgl/graph/PrimitiveCreater.h index 057e6238..13d7af73 100644 --- a/inc/hgl/graph/PrimitiveCreater.h +++ b/inc/hgl/graph/PrimitiveCreater.h @@ -55,6 +55,7 @@ public: return(nullptr); VABAccess vad; + if(!this->AcquirePVB(&vad,name,nullptr)) return(nullptr); diff --git a/inc/hgl/graph/VKDeviceAttribute.h b/inc/hgl/graph/VKDeviceAttribute.h index 5c7d4b5e..9de75c3f 100644 --- a/inc/hgl/graph/VKDeviceAttribute.h +++ b/inc/hgl/graph/VKDeviceAttribute.h @@ -40,6 +40,7 @@ struct GPUDeviceAttribute VkCompositeAlphaFlagBitsKHR compositeAlpha =VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; bool uint8_index_type=false; + bool uint32_index_type=false; VkDevice device =VK_NULL_HANDLE; VkCommandPool cmd_pool =VK_NULL_HANDLE; diff --git a/inc/hgl/graph/VKDeviceCreater.h b/inc/hgl/graph/VKDeviceCreater.h index 60c381ff..07ed0511 100644 --- a/inc/hgl/graph/VKDeviceCreater.h +++ b/inc/hgl/graph/VKDeviceCreater.h @@ -14,6 +14,8 @@ struct VulkanHardwareRequirement Must, ///<必须支持 }; + //这里使用这种大小写是为了和VulkanSDK中的定义保持一致,cpp中使用宏比较和复制时只使用一个名字即可 + uint maxImageDimension1D; uint maxImageDimension2D; uint maxImageDimension3D; diff --git a/src/SceneGraph/PrimitiveCreater.cpp b/src/SceneGraph/PrimitiveCreater.cpp index 5169dcd5..26f90e38 100644 --- a/src/SceneGraph/PrimitiveCreater.cpp +++ b/src/SceneGraph/PrimitiveCreater.cpp @@ -195,4 +195,4 @@ Primitive *PrimitiveCreater::Finish(const AnsiString &prim_name) return primitive; } -VK_NAMESPACE_END \ No newline at end of file +VK_NAMESPACE_END diff --git a/src/SceneGraph/Vulkan/VKDeviceBuffer.cpp b/src/SceneGraph/Vulkan/VKDeviceBuffer.cpp index 40c8e1c2..88f1cbfe 100644 --- a/src/SceneGraph/Vulkan/VKDeviceBuffer.cpp +++ b/src/SceneGraph/Vulkan/VKDeviceBuffer.cpp @@ -81,9 +81,9 @@ const IndexType GPUDevice::ChooseIndexType(const VkDeviceSize &vertex_count)cons { 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 + if(attr->uint8_index_type&& vertex_count<=0xFF )return IndexType::U8; else + if( vertex_count<=0xFFFF)return IndexType::U16; else + if(attr->uint32_index_type )return IndexType::U32; else 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::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); } diff --git a/src/SceneGraph/Vulkan/VKDeviceCreater.cpp b/src/SceneGraph/Vulkan/VKDeviceCreater.cpp index 2299e694..9e5e8d92 100644 --- a/src/SceneGraph/Vulkan/VKDeviceCreater.cpp +++ b/src/SceneGraph/Vulkan/VKDeviceCreater.cpp @@ -318,6 +318,12 @@ GPUDevice *VulkanDeviceCreater::CreateRenderDevice() 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; GetDeviceQueue(device_attr);