Skip to main content

check_bitfield_range

Function check_bitfield_range 

Source
pub fn check_bitfield_range(
    builtin: &'static str,
    offset: u32,
    count: u32,
    width: u32,
) -> Result<(), ConstantEvaluatorError>
Expand description

Reject the offset and count arguments of extractBits and insertBits if they select bits outside an operand width bits wide.

The WGSL specification says that this is a shader creation error if offset and count are const expressions, even if the operand is not, so the WGSL front end will fail immediately if it sees both are const.