Only scan memory_type_count memory types in examples

The example code originally checked all 32 memory types even if the
instance returned fewer memory types.
This commit is contained in:
Steve Wooster 2020-10-28 23:37:31 -07:00 committed by Benjamin Saunders
parent 648c4a5019
commit cb2d94c3c7

View file

@ -122,8 +122,7 @@ pub fn find_memorytype_index(
memory_prop: &vk::PhysicalDeviceMemoryProperties,
flags: vk::MemoryPropertyFlags,
) -> Option<u32> {
memory_prop
.memory_types
memory_prop.memory_types[..memory_prop.memory_type_count as _]
.iter()
.enumerate()
.find(|(index, memory_type)| {