From 2d730cdf657ee7b70ce749a200820760bc3e21aa Mon Sep 17 00:00:00 2001 From: Maik Klein Date: Sat, 9 Mar 2019 19:52:25 +0100 Subject: [PATCH] Add ptrchain external test file --- ash/tests/ptrchain.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 ash/tests/ptrchain.rs diff --git a/ash/tests/ptrchain.rs b/ash/tests/ptrchain.rs new file mode 100644 index 0000000..eca4d09 --- /dev/null +++ b/ash/tests/ptrchain.rs @@ -0,0 +1,21 @@ +extern crate ash; +use ash::vk; +#[test] +fn test_ptr_chains() { + let mut variable_pointers = vk::PhysicalDeviceVariablePointerFeatures::builder(); + let mut corner = vk::PhysicalDeviceCornerSampledImageFeaturesNV::builder(); + let chain = vec![ + &variable_pointers as *const _ as usize, + &corner as *const _ as usize, + ]; + let mut device_create_info = vk::DeviceCreateInfo::builder() + .push_next(&mut corner) + .push_next(&mut variable_pointers); + let chain2: Vec = unsafe { + vk::ptr_chain_iter(&mut device_create_info) + .skip(1) + .map(|ptr| ptr as usize) + .collect() + }; + assert_eq!(chain, chain2); +}