From 112481d57649233cba42b7ca304432433858b46c Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 16 Sep 2024 10:59:28 -0500 Subject: [PATCH] nil: Assert array_len == 0 in Extent4D::size_B() Part-of: --- src/nouveau/nil/extent.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/nouveau/nil/extent.rs b/src/nouveau/nil/extent.rs index bef49a70128..b29cfd8f288 100644 --- a/src/nouveau/nil/extent.rs +++ b/src/nouveau/nil/extent.rs @@ -167,8 +167,11 @@ impl Extent4D { } impl Extent4D { - pub fn size_B(&self) -> u32 { - self.width * self.height * self.depth + pub fn size_B(&self) -> u64 { + // size_B of something with layers doesn't make sense because we can't + // know the array stride based only on the other dimensions. + assert!(self.array_len == 1); + u64::from(self.width) * u64::from(self.height) * u64::from(self.depth) } pub fn to_GOB(self, gob_height_is_8: bool) -> Extent4D {