Skip to content

Commit eb2907d

Browse files
committed
fix(shaders): divide by rounding down to create buffer
Fixes #133
1 parent c105b3a commit eb2907d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

crates/tattoy/src/tattoys/gpu/pipeline.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,16 @@ impl GPU {
211211
}
212212

213213
/// Align a buffer or texture dimension to a consistent multiple.
214+
#[expect(
215+
clippy::unwrap_used,
216+
reason = "
217+
`checked_div()` only returns `None` when the right-hand side is 0, which is clearly
218+
impossible here.
219+
"
220+
)]
214221
const fn align_dimension(number: u32) -> u32 {
215222
let multiple = 256;
216-
number.div_ceil(multiple) - 1 + multiple
223+
(number.checked_div(multiple).unwrap() * multiple) + multiple
217224
}
218225

219226
/// Create the bind group layout that defines where the various shader data is located.

0 commit comments

Comments
 (0)