Skip to main content

quantize_extent

Function quantize_extent 

Source
pub fn quantize_extent(
    width: u32,
    height: u32,
    max_dimension: u32,
) -> (u32, u32)
Expand description

Rounds width and height up to the next multiple of SIZE_QUANTUM, never past max_dimension.

The clamp keeps quantization from pushing a request that already sits just under the adapter’s ceiling over it. A dimension that is itself above max_dimension is passed through unchanged rather than silently shrunk, so the device reports the real error instead of the pool handing back a texture that is not the size anyone asked for. A zero extent is likewise passed through — it is a caller bug, and the device names it.