From 5bc3c9da3c0229c1364cab4b3b06d715d1267f0f Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Thu, 24 Apr 2025 08:58:05 -0700 Subject: [PATCH] [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. --- naga/src/valid/expression.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/naga/src/valid/expression.rs b/naga/src/valid/expression.rs index 7b4482bdd..63de45037 100644 --- a/naga/src/valid/expression.rs +++ b/naga/src/valid/expression.rs @@ -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)); } }