Skip to main content

alpha_texture_height

Function alpha_texture_height 

Source
pub fn alpha_texture_height(
    alphas_len: usize,
    resource_texture_dim: u32,
) -> Result<u32, EngineError>
Expand description

The alpha-texture height needed to hold alphas_len coverage bytes in a texture resource_texture_dim texels wide.

Each texel holds ALPHAS_PER_TEXEL alpha values, so one row holds resource_texture_dim << 4 of them. The result never drops below MIN_RESOURCE_TEXTURE_HEIGHT, since a texture of height zero cannot be created.

§Errors

Returns EngineError::AlphaCapacity when the required height exceeds resource_texture_dim — the point at which the reference renderer asserts. Coverage past that ceiling has nowhere to live, and a frame path reports it rather than panicking.