1 // Copyright © 2024 Collabora, Ltd. 2 // SPDX-License-Identifier: MIT 3 4 extern crate nil_rs_bindings; 5 extern crate nvidia_headers; 6 7 mod copy; 8 mod extent; 9 mod format; 10 mod image; 11 mod modifiers; 12 mod tic; 13 mod tiling; 14 15 pub trait ILog2Ceil { ilog2_ceil(self) -> Self16 fn ilog2_ceil(self) -> Self; 17 } 18 19 impl ILog2Ceil for u32 { ilog2_ceil(self) -> Self20 fn ilog2_ceil(self) -> Self { 21 if self <= 1 { 22 0 23 } else { 24 (self - 1).ilog2() + 1 25 } 26 } 27 } 28 29 pub trait Minify<Rhs> { 30 // Required method minify(self, rhs: Rhs) -> Self31 fn minify(self, rhs: Rhs) -> Self; 32 } 33 34 impl Minify<u32> for u32 { minify(self, level: u32) -> u3235 fn minify(self, level: u32) -> u32 { 36 std::cmp::max(1, self >> level) 37 } 38 } 39