1 /// Holds 24 bits in the least significant bits of memory, 2 /// and 8 bytes in the most significant bits of that memory, 3 /// occupying a single [`u32`] in total. This is commonly used in 4 /// [acceleration structure instances] such as 5 /// [`vk::AccelerationStructureInstanceKHR`][super::AccelerationStructureInstanceKHR], 6 /// [`vk::AccelerationStructureSRTMotionInstanceNV`][super::AccelerationStructureSRTMotionInstanceNV] and 7 /// [`vk::AccelerationStructureMatrixMotionInstanceNV`][super::AccelerationStructureMatrixMotionInstanceNV]. 8 /// 9 /// [acceleration structure instances]: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkAccelerationStructureInstanceKHR.html#_description 10 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)] 11 #[repr(transparent)] 12 pub struct Packed24_8(u32); 13 14 impl Packed24_8 { new(low_24: u32, high_8: u8) -> Self15 pub fn new(low_24: u32, high_8: u8) -> Self { 16 Self((low_24 & 0x00ff_ffff) | (u32::from(high_8) << 24)) 17 } 18 19 /// Extracts the least-significant 24 bits (3 bytes) of this integer low_24(&self) -> u3220 pub fn low_24(&self) -> u32 { 21 self.0 & 0xffffff 22 } 23 24 /// Extracts the most significant 8 bits (single byte) of this integer high_8(&self) -> u825 pub fn high_8(&self) -> u8 { 26 (self.0 >> 24) as u8 27 } 28 } 29