[naga] Constrain textureLoad array index args to i32 or u32.

In `naga::valid::expression`, require that
`Expression::ImageLoad::array_index` be either `i32` or `u32`, not
just an integral type of any size.
This commit is contained in:
Jim Blandy 2025-04-24 08:58:05 -07:00
parent 7c5f705580
commit 5bc3c9da3c

View File

@ -648,12 +648,8 @@ impl super::Validator {
return Err(ExpressionError::InvalidImageArrayIndex);
}
if let Some(expr) = array_index {
match resolver[expr] {
Ti::Scalar(Sc {
kind: Sk::Sint | Sk::Uint,
width: _,
}) => {}
_ => return Err(ExpressionError::InvalidImageArrayIndexType(expr)),
if !matches!(resolver[expr], Ti::Scalar(Sc::I32 | Sc::U32)) {
return Err(ExpressionError::InvalidImageArrayIndexType(expr));
}
}