Repository: gfx-rs/wgpu (2026-03-25T05:08:59Z)

Issue:
Using `binding_array` should require an enable extension
Naga's WGSL front end requires a directive like `enable wgpu_mesh_shader;` or `enable wgpu_ray_query;` to use WGPU-specific features like mesh shaders or ray tracing, but nothing to use `binding_array`. It would be more consistent to require `enable wgpu_binding_array;`.


Discussion:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index afecebbb52e..ebdf156f2b5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -109,6 +109,7 @@ Bottom level categories:
 - Fixed handling of unterminated block comments. By @BKDaugherty in [#9356](https://github.com/gfx-rs/wgpu/pull/9356).
 - Enforce that `@must_use` appear only on function declarations. By @dnsn021 in [#9367](https://github.com/gfx-rs/wgpu/pull/9367).
 - Fix typo in `naga::back::msl::Error::UnsupportedWritable*` variant names. By @ErichDonGubler in [#9376](https://github.com/gfx-rs/wgpu/pull/9376).
+- Added support for `enable wgpu_binding_array;`. By @39ali in [#9298](https://github.com/gfx-rs/wgpu/pull/9298).
 
 #### Vulkan
 
diff --git a/benches/benches/wgpu-benchmark/computepass-bindless.wgsl b/benches/benches/wgpu-benchmark/computepass-bindless.wgsl
index 402ff944894..59aedcf4062 100644
--- a/benches/benches/wgpu-benchmark/computepass-bindless.wgsl
+++ b/benches/benches/wgpu-benchmark/computepass-bindless.wgsl
@@ -1,3 +1,4 @@
+enable wgpu_binding_array;
 @group(0) @binding(0)
 var tex: binding_array<texture_2d<f32>>;
 
diff --git a/benches/benches/wgpu-benchmark/renderpass-bindless.wgsl b/benches/benches/wgpu-benchmark/renderpass-bindless.wgsl
index 0277ef63be0..48f87a24659 100644
--- a/benches/benches/wgpu-benchmark/renderpass-bindless.wgsl
+++ b/benches/benches/wgpu-benchmark/renderpass-bindless.wgsl
@@ -1,3 +1,4 @@
+enable wgpu_binding_array;
 @group(0) @binding(0)
 var tex: binding_array<texture_2d<f32>>;
 
diff --git a/examples/features/src/big_compute_buffers/shader.wgsl b/examples/features/src/big_compute_buffers/shader.wgsl
index 253e7637287..936f129d1b0 100644
--- a/examples/features/src/big_compute_buffers/shader.wgsl
+++ b/examples/features/src/big_compute_buffers/shader.wgsl
@@ -1,3 +1,5 @@
+enable wgpu_binding_array;
+
 const OFFSET: u32 = 1u << 8u;
 const BUFFER_MAX_ELEMENTS: u32 = 1u << 25u; // Think `buffer.len()`
 const NUM_BUFFERS: u32 = 8u;
diff --git a/examples/features/src/texture_arrays/indexing.wgsl b/examples/features/src/texture_arrays/indexing.wgsl
index aad090c12ef..aa0e0581488 100644
--- a/examples/features/src/texture_arrays/indexing.wgsl
+++ b/examples/features/src/texture_arrays/indexing.wgsl
@@ -1,3 +1,4 @@
+enable wgpu_binding_array;
 struct VertexInput {
     @location(0) position: vec2<f32>,
     @location(1) tex_coord: vec2<f32>,
diff --git a/examples/features/src/texture_arrays/non_uniform_indexing.wgsl b/examples/features/src/texture_arrays/non_uniform_indexing.wgsl
index 7fb30e79294..8c896454ddb 100644
--- a/examples/features/src/texture_arrays/non_uniform_indexing.wgsl
+++ b/examples/features/src/texture_arrays/non_uniform_indexing.wgsl
@@ -1,3 +1,4 @@
+enable wgpu_binding_array;
 struct FragmentInput {
     @location(0) tex_coord: vec2<f32>,
     @location(1) index: i32,
diff --git a/naga/src/back/wgsl/writer.rs b/naga/src/back/wgsl/writer.rs
index 17d8a7e85f9..993b3869c43 100644
--- a/naga/src/back/wgsl/writer.rs
+++ b/naga/src/back/wgsl/writer.rs
@@ -297,6 +297,7 @@ impl<W: Write> Writer<W> {
             draw_index: bool,
             ray_tracing_pipeline: bool,
             per_vertex: bool,
+            binding_array: bool,
         }
         let mut needed = RequiredEnabled {
             mesh_shaders: module.uses_mesh_shaders(),
@@ -367,6 +368,9 @@ impl<W: Write> Writer<W> {
                 TypeInner::AccelerationStructure { .. } => {
                     needed.ray_tracing_pipeline = true;
                 }
+                TypeInner::BindingArray { .. } => {
+                    needed.binding_array = true;
+                }
                 _ => {}
             }
         }
@@ -441,6 +445,10 @@ impl<W: Write> Writer<W> {
             writeln!(self.out, "enable wgpu_mesh_shader;")?;
             any_written = true;
         }
+        if needed.binding_array {
+            writeln!(self.out, "enable wgpu_binding_array;")?;
+            any_written = true;
+        }
         if needed.draw_index {
             writeln!(self.out, "enable draw_index;")?;
             any_written = true;
diff --git a/naga/src/front/wgsl/parse/conv.rs b/naga/src/front/wgsl/parse/conv.rs
index 6270d4b96a6..9fb003dcbe1 100644
--- a/naga/src/front/wgsl/parse/conv.rs
+++ b/naga/src/front/wgsl/parse/conv.rs
@@ -583,6 +583,9 @@ pub fn map_predeclared_type(
         PredeclaredType::TypeGenerator(TypeGenerator::CooperativeMatrix { .. }) => {
             Some(&[ImplementedEnableExtension::WgpuCooperativeMatrix])
         }
+        PredeclaredType::TypeGenerator(TypeGenerator::BindingArray) => {
+            Some(&[ImplementedEnableExtension::WgpuBindingArray])
+        }
         _ => None,
     };
     if let Some(extensions_needed) = extensions_needed {
diff --git a/naga/src/front/wgsl/parse/directive/enable_extension.rs b/naga/src/front/wgsl/parse/directive/enable_extension.rs
index a6d728551f7..80e58e6078a 100644
--- a/naga/src/front/wgsl/parse/directive/enable_extension.rs
+++ b/naga/src/front/wgsl/parse/directive/enable_extension.rs
@@ -22,6 +22,7 @@ pub(crate) struct EnableExtensions {
     draw_index: bool,
     primitive_index: bool,
     per_vertex: bool,
+    wgpu_binding_array: bool,
 }
 
 impl EnableExtensions {
@@ -38,6 +39,7 @@ impl EnableExtensions {
             draw_index: false,
             primitive_index: false,
             per_vertex: false,
+            wgpu_binding_array: false,
         }
     }
 
@@ -59,6 +61,7 @@ impl EnableExtensions {
             ImplementedEnableExtension::DrawIndex => &mut self.draw_index,
             ImplementedEnableExtension::PrimitiveIndex => &mut self.primitive_index,
             ImplementedEnableExtension::PerVertex => &mut self.per_vertex,
+            ImplementedEnableExtension::WgpuBindingArray => &mut self.wgpu_binding_array,
         };
         *field = true;
     }
@@ -79,6 +82,7 @@ impl EnableExtensions {
             ImplementedEnableExtension::DrawIndex => self.draw_index,
             ImplementedEnableExtension::PrimitiveIndex => self.primitive_index,
             ImplementedEnableExtension::PerVertex => self.per_vertex,
+            ImplementedEnableExtension::WgpuBindingArray => self.wgpu_binding_array,
         }
     }
 
@@ -132,6 +136,7 @@ impl EnableExtension {
     const PRIMITIVE_INDEX: &'static str = "primitive_index";
     const DRAW_INDEX: &'static str = "draw_index";
     const PER_VERTEX: &'static str = "wgpu_per_vertex";
+    const BINDING_ARRAY: &'static str = "wgpu_binding_array";
 
     /// Convert from a sentinel word in WGSL into its associated [`EnableExtension`], if possible.
     pub(crate) fn from_ident(word: &str, span: Span) -> Result<'_, Self> {
@@ -156,6 +161,7 @@ impl EnableExtension {
             Self::DRAW_INDEX => Self::Implemented(ImplementedEnableExtension::DrawIndex),
             Self::PRIMITIVE_INDEX => Self::Implemented(ImplementedEnableExtension::PrimitiveIndex),
             Self::PER_VERTEX => Self::Implemented(ImplementedEnableExtension::PerVertex),
+            Self::BINDING_ARRAY => Self::Implemented(ImplementedEnableExtension::WgpuBindingArray),
             _ => return Err(Box::new(Error::UnknownEnableExtension(span, word))),
         })
     }
@@ -177,6 +183,7 @@ impl EnableExtension {
                 ImplementedEnableExtension::PrimitiveIndex => Self::PRIMITIVE_INDEX,
                 ImplementedEnableExtension::WgpuRayTracingPipeline => Self::RAY_TRACING_PIPELINE,
                 ImplementedEnableExtension::PerVertex => Self::PER_VERTEX,
+                ImplementedEnableExtension::WgpuBindingArray => Self::BINDING_ARRAY,
             },
             Self::Unimplemented(kind) => match kind {
                 UnimplementedEnableExtension::Subgroups => Self::SUBGROUPS,
@@ -227,6 +234,8 @@ pub enum ImplementedEnableExtension {
     PrimitiveIndex,
     /// Enables the `wgpu_per_vertex` extension, allows using `@interpolate(per_vertex)` attribute in WGSL, native only.
     PerVertex,
+    /// Enables the `wgpu_binding_array` extension, native only.
+    WgpuBindingArray,
 }
 
 impl ImplementedEnableExtension {
@@ -243,6 +252,7 @@ impl ImplementedEnableExtension {
         Self::DrawIndex,
         Self::PrimitiveIndex,
         Self::PerVertex,
+        Self::WgpuBindingArray,
     ];
 
     /// Returns slice of all variants of [`ImplementedEnableExtension`].
@@ -265,6 +275,15 @@ impl ImplementedEnableExtension {
             Self::DrawIndex => C::DRAW_INDEX,
             Self::PrimitiveIndex => C::PRIMITIVE_INDEX,
             Self::PerVertex => C::PER_VERTEX,
+            Self::WgpuBindingArray => C::BUFFER_BINDING_ARRAY
+                .union(C::BUFFER_BINDING_ARRAY_NON_UNIFORM_INDEXING)
+                .union(C::STORAGE_BUFFER_BINDING_ARRAY)
+                .union(C::STORAGE_BUFFER_BINDING_ARRAY_NON_UNIFORM_INDEXING)
+                .union(C::STORAGE_TEXTURE_BINDING_ARRAY)
+                .union(C::STORAGE_TEXTURE_BINDING_ARRAY_NON_UNIFORM_INDEXING)
+                .union(C::TEXTURE_AND_SAMPLER_BINDING_ARRAY)
+                .union(C::TEXTURE_AND_SAMPLER_BINDING_ARRAY_NON_UNIFORM_INDEXING)
+                .union(C::ACCELERATION_STRUCTURE_BINDING_ARRAY),
         }
     }
 }
diff --git a/naga/src/front/wgsl/parse/mod.rs b/naga/src/front/wgsl/parse/mod.rs
index 5f503ef2207..2acfe3cfa25 100644
--- a/naga/src/front/wgsl/parse/mod.rs
+++ b/naga/src/front/wgsl/parse/mod.rs
@@ -2273,7 +2273,7 @@ impl Parser {
                             };
                             // Check if the required capability is supported
                             let required_capability = extension.capability();
-                            if !options.capabilities.contains(required_capability) {
+                            if !options.capabilities.intersects(required_capability) {
                                 return Err(Box::new(Error::EnableExtensionNotSupported {
                                     kind,
                                     span,
diff --git a/naga/src/valid/mod.rs b/naga/src/valid/mod.rs
index cbc10ced176..5eca1549ebb 100644
--- a/naga/src/valid/mod.rs
+++ b/naga/src/valid/mod.rs
@@ -238,6 +238,16 @@ impl Capabilities {
             Self::COOPERATIVE_MATRIX => Some(Ext::WgpuCooperativeMatrix),
             Self::RAY_TRACING_PIPELINE => Some(Ext::WgpuRayTracingPipeline),
             Self::PER_VERTEX => Some(Ext::PerVertex),
+            Self::BUFFER_BINDING_ARRAY
+            | Self::BUFFER_BINDING_ARRAY_NON_UNIFORM_INDEXING
+            | Self::STORAGE_BUFFER_BINDING_ARRAY
+            | Self::STORAGE_BUFFER_BINDING_ARRAY_NON_UNIFORM_INDEXING
+            | Self::STORAGE_TEXTURE_BINDING_ARRAY
+            | Self::STORAGE_TEXTURE_BINDING_ARRAY_NON_UNIFORM_INDEXING
+            | Self::TEXTURE_AND_SAMPLER_BINDING_ARRAY
+            | Self::TEXTURE_AND_SAMPLER_BINDING_ARRAY_NON_UNIFORM_INDEXING => {
+                Some(Ext::WgpuBindingArray)
+            }
             _ => None,
         }
     }


Test patch:
diff --git a/naga/tests/in/wgsl/binding-arrays.wgsl b/naga/tests/in/wgsl/binding-arrays.wgsl
index d1bf1210d73..211de0ae631 100644
--- a/naga/tests/in/wgsl/binding-arrays.wgsl
+++ b/naga/tests/in/wgsl/binding-arrays.wgsl
@@ -1,3 +1,4 @@
+enable wgpu_binding_array;
 struct UniformIndex {
     index: u32
 };
diff --git a/naga/tests/in/wgsl/binding-buffer-arrays.wgsl b/naga/tests/in/wgsl/binding-buffer-arrays.wgsl
index fb25623962c..3de53c646ff 100644
--- a/naga/tests/in/wgsl/binding-buffer-arrays.wgsl
+++ b/naga/tests/in/wgsl/binding-buffer-arrays.wgsl
@@ -1,3 +1,4 @@
+enable wgpu_binding_array;
 struct UniformIndex {
     index: u32
 }
diff --git a/naga/tests/naga/wgsl_errors.rs b/naga/tests/naga/wgsl_errors.rs
index 97bed72b7ad..fbcd4866d65 100644
--- a/naga/tests/naga/wgsl_errors.rs
+++ b/naga/tests/naga/wgsl_errors.rs
@@ -3317,7 +3317,8 @@ fn global_initialization_type_mismatch() {
 #[test]
 fn binding_array_local() {
     check_validation! {
-        "fn f() { var x: binding_array<sampler, 4>; }":
+        "enable wgpu_binding_array;
+         fn f() { var x: binding_array<sampler, 4>; }":
         Err(_)
     }
 }
@@ -3325,7 +3326,8 @@ fn binding_array_local() {
 #[test]
 fn binding_array_private() {
     check_validation! {
-        "var<private> x: binding_array<sampler, 4>;":
+        "enable wgpu_binding_array;
+         var<private> x: binding_array<sampler, 4>;":
         Err(_)
     }
 }
@@ -3333,7 +3335,8 @@ fn binding_array_private() {
 #[test]
 fn binding_array_non_struct() {
     check_validation! {
-        "var<storage> x: binding_array<i32, 4>;":
+        "enable wgpu_binding_array;
+         var<storage> x: binding_array<i32, 4>;":
         Err(naga::valid::ValidationError::Type {
             source: naga::valid::TypeError::BindingArrayBaseTypeNotStruct(_),
             ..
@@ -3343,6 +3346,7 @@ fn binding_array_non_struct() {
     check_validation! {
         r#"
             enable wgpu_ray_query;
+            enable wgpu_binding_array;
             @group(0) @binding(0)
             var<storage> ray_query_array: binding_array<ray_query, 10>;
         "#:
@@ -4693,10 +4697,166 @@ fn ray_query_vertex_return_enable_extension() {
     );
 }
 
+#[test]
+fn binding_array_enable_extension() {
+    //buffers
+
+    check_extension_validation!(
+        Capabilities::BUFFER_BINDING_ARRAY,
+        r#"struct UniformBuffer { data: u32 }
+@group(0) @binding(0)
+var<uniform> uniform_array: binding_array<UniformBuffer, 5>;"#,
+        r#"error: the `wgpu_binding_array` enable extension is not enabled
+  ┌─ wgsl:3:29
+  │
+3 │ var<uniform> uniform_array: binding_array<UniformBuffer, 5>;
+  │                             ^^^^^^^^^^^^^ the `wgpu_binding_array` "Enable Extension" is needed for this functionality, but it is not currently enabled.
+  │
+  = note: You can enable this extension by adding `enable wgpu_binding_array;` at the top of the shader, before any other items.
+
+"#,
+        Err(naga::valid::ValidationError::GlobalVariable {
+            source: naga::valid::GlobalVariableError::UnsupportedCapability(
+                Capabilities::BUFFER_BINDING_ARRAY
+            ),
+            ..
+        })
+    );
+
+    check_extension_validation!(
+        Capabilities::STORAGE_BUFFER_BINDING_ARRAY,
+        r#"struct Buffer { data: u32 }
+@group(0) @binding(0)
+var<storage, read> storage_array: binding_array<Buffer, 5>;"#,
+        r#"error: the `wgpu_binding_array` enable extension is not enabled
+  ┌─ wgsl:3:35
+  │
+3 │ var<storage, read> storage_array: binding_array<Buffer, 5>;
+  │                                   ^^^^^^^^^^^^^ the `wgpu_binding_array` "Enable Extension" is needed for this functionality, but it is not currently enabled.
+  │
+  = note: You can enable this extension by adding `enable wgpu_binding_array;` at the top of the shader, before any other items.
+
+"#,
+        Err(naga::valid::ValidationError::GlobalVariable {
+            source: naga::valid::GlobalVariableError::UnsupportedCapability(
+                Capabilities::STORAGE_BUFFER_BINDING_ARRAY
+            ),
+            ..
+        })
+    );
+
+    //textures and samplers
+    check_extension_validation!(
+        Capabilities::TEXTURE_AND_SAMPLER_BINDING_ARRAY,
+        r#"@group(0) @binding(0)
+        var texture_array_unbounded: binding_array<texture_2d<f32>>;"#,
+        r#"error: the `wgpu_binding_array` enable extension is not enabled
+  ┌─ wgsl:2:38
+  │
+2 │         var texture_array_unbounded: binding_array<texture_2d<f32>>;
+  │                                      ^^^^^^^^^^^^^ the `wgpu_binding_array` "Enable Extension" is needed for this functionality, but it is not currently enabled.
+  │
+  = note: You can enable this extension by adding `enable wgpu_binding_array;` at the top of the shader, before any other items.
+
+"#,
+        Err(naga::valid::ValidationError::GlobalVariable {
+            source: naga::valid::GlobalVariableError::UnsupportedCapability(
+                Capabilities::TEXTURE_AND_SAMPLER_BINDING_ARRAY
+            ),
+            ..
+        })
+    );
+
+    check_extension_validation!(
+        Capabilities::TEXTURE_AND_SAMPLER_BINDING_ARRAY,
+        r#"@group(0) @binding(0)
+        var texture_array_bounded: binding_array<texture_2d<f32>, 5>;"#,
+        r#"error: the `wgpu_binding_array` enable extension is not enabled
+  ┌─ wgsl:2:36
+  │
+2 │         var texture_array_bounded: binding_array<texture_2d<f32>, 5>;
+  │                                    ^^^^^^^^^^^^^ the `wgpu_binding_array` "Enable Extension" is needed for this functionality, but it is not currently enabled.
+  │
+  = note: You can enable this extension by adding `enable wgpu_binding_array;` at the top of the shader, before any other items.
+
+"#,
+        Err(naga::valid::ValidationError::GlobalVariable {
+            source: naga::valid::GlobalVariableError::UnsupportedCapability(
+                Capabilities::TEXTURE_AND_SAMPLER_BINDING_ARRAY
+            ),
+            ..
+        })
+    );
+
+    check_extension_validation!(
+        Capabilities::TEXTURE_AND_SAMPLER_BINDING_ARRAY,
+        r#"@group(0) @binding(0)
+        var texture_array_2darray: binding_array<texture_2d_array<f32>, 5>;"#,
+        r#"error: the `wgpu_binding_array` enable extension is not enabled
+  ┌─ wgsl:2:36
+  │
+2 │         var texture_array_2darray: binding_array<texture_2d_array<f32>, 5>;
+  │                                    ^^^^^^^^^^^^^ the `wgpu_binding_array` "Enable Extension" is needed for this functionality, but it is not currently enabled.
+  │
+  = note: You can enable this extension by adding `enable wgpu_binding_array;` at the top of the shader, before any other items.
+
+"#,
+        Err(naga::valid::ValidationError::GlobalVariable {
+            source: naga::valid::GlobalVariableError::UnsupportedCapability(
+                Capabilities::TEXTURE_AND_SAMPLER_BINDING_ARRAY
+            ),
+            ..
+        })
+    );
+
+    check_extension_validation!(
+        Capabilities::TEXTURE_AND_SAMPLER_BINDING_ARRAY,
+        r#"@group(0) @binding(0)
+        var samp: binding_array<sampler, 5>;"#,
+        r#"error: the `wgpu_binding_array` enable extension is not enabled
+  ┌─ wgsl:2:19
+  │
+2 │         var samp: binding_array<sampler, 5>;
+  │                   ^^^^^^^^^^^^^ the `wgpu_binding_array` "Enable Extension" is needed for this functionality, but it is not currently enabled.
+  │
+  = note: You can enable this extension by adding `enable wgpu_binding_array;` at the top of the shader, before any other items.
+
+"#,
+        Err(naga::valid::ValidationError::GlobalVariable {
+            source: naga::valid::GlobalVariableError::UnsupportedCapability(
+                Capabilities::TEXTURE_AND_SAMPLER_BINDING_ARRAY
+            ),
+            ..
+        })
+    );
+
+    check_extension_validation!(
+        Capabilities::STORAGE_TEXTURE_BINDING_ARRAY,
+        r#"@group(0) @binding(0)
+        var texture_array_storage: binding_array<texture_storage_2d<rgba32float, write>, 5>;"#,
+        r#"error: the `wgpu_binding_array` enable extension is not enabled
+  ┌─ wgsl:2:36
+  │
+2 │         var texture_array_storage: binding_array<texture_storage_2d<rgba32float, write>, 5>;
+  │                                    ^^^^^^^^^^^^^ the `wgpu_binding_array` "Enable Extension" is needed for this functionality, but it is not currently enabled.
+  │
+  = note: You can enable this extension by adding `enable wgpu_binding_array;` at the top of the shader, before any other items.
+
+"#,
+        Err(naga::valid::ValidationError::GlobalVariable {
+            source: naga::valid::GlobalVariableError::UnsupportedCapability(
+                Capabilities::STORAGE_TEXTURE_BINDING_ARRAY
+            ),
+            ..
+        })
+    );
+}
+
 #[test]
 fn binding_array_requires_capability() {
     check_validation! {
         r#"
+            enable wgpu_binding_array;
             struct Buffer { data: u32 }
             @group(0) @binding(0)
             var<storage> storage_array: binding_array<Buffer, 10>;
@@ -4711,6 +4871,7 @@ fn binding_array_requires_capability() {
 
     check_validation! {
         r#"
+            enable wgpu_binding_array; 
             struct Buffer { data: u32 }
             @group(0) @binding(0)
             var<uniform> uniform_array: binding_array<Buffer, 10>;
@@ -4725,6 +4886,7 @@ fn binding_array_requires_capability() {
 
     check_validation! {
         r#"
+            enable wgpu_binding_array;
             @group(0) @binding(0)
             var storage_texture_array: binding_array<texture_storage_2d<rgba8unorm, write>, 10>;
         "#:
@@ -4738,6 +4900,7 @@ fn binding_array_requires_capability() {
 
     check_validation! {
         r#"
+            enable wgpu_binding_array;
             @group(0) @binding(0)
             var sampled_texture_array: binding_array<texture_2d<f32>, 10>;
         "#:
@@ -4751,6 +4914,7 @@ fn binding_array_requires_capability() {
 
     check_validation! {
         r#"
+            enable wgpu_binding_array;
             @group(0) @binding(0)
             var sampler_array: binding_array<sampler, 10>;
         "#:
@@ -4765,6 +4929,7 @@ fn binding_array_requires_capability() {
     // Binding arrays of external textures are not yet supported.
     check_validation! {
         r#"
+            enable wgpu_binding_array;
             @group(0) @binding(0)
             var external_texture_array: binding_array<texture_external, 10>;
         "#:
@@ -4778,6 +4943,7 @@ fn binding_array_requires_capability() {
     // Binding arrays of acceleration structures require a capability.
     check_validation! {
         r#"
+            enable wgpu_binding_array;
             enable wgpu_ray_query;
             @group(0) @binding(0)
             var acc_struct_array: binding_array<acceleration_structure, 10>;
diff --git a/naga/tests/out/wgsl/spv-binding-arrays.dynamic.wgsl b/naga/tests/out/wgsl/spv-binding-arrays.dynamic.wgsl
index bb277d351e9..43d859484df 100644
--- a/naga/tests/out/wgsl/spv-binding-arrays.dynamic.wgsl
+++ b/naga/tests/out/wgsl/spv-binding-arrays.dynamic.wgsl
@@ -1,3 +1,5 @@
+enable wgpu_binding_array;
+
 @group(0) @binding(0) 
 var global: binding_array<texture_2d<f32>>;
 @group(0) @binding(1) 
diff --git a/naga/tests/out/wgsl/spv-binding-arrays.runtime.wgsl b/naga/tests/out/wgsl/spv-binding-arrays.runtime.wgsl
index 72b8244c573..d673183cdd6 100644
--- a/naga/tests/out/wgsl/spv-binding-arrays.runtime.wgsl
+++ b/naga/tests/out/wgsl/spv-binding-arrays.runtime.wgsl
@@ -1,3 +1,5 @@
+enable wgpu_binding_array;
+
 var<private> input_u002e_texture_coordinates_1: vec2<f32>;
 var<private> input_u002e_texture_index_1: u32;
 @group(0) @binding(0) 
diff --git a/naga/tests/out/wgsl/spv-binding-arrays.static.wgsl b/naga/tests/out/wgsl/spv-binding-arrays.static.wgsl
index f0a89c67807..9c58221aabf 100644
--- a/naga/tests/out/wgsl/spv-binding-arrays.static.wgsl
+++ b/naga/tests/out/wgsl/spv-binding-arrays.static.wgsl
@@ -1,3 +1,5 @@
+enable wgpu_binding_array;
+
 @group(0) @binding(0) 
 var global: binding_array<texture_2d<f32>, 256>;
 @group(0) @binding(1) 
diff --git a/naga/tests/out/wgsl/wgsl-binding-arrays.wgsl b/naga/tests/out/wgsl/wgsl-binding-arrays.wgsl
index f82561c12b9..0b38fc7b5ab 100644
--- a/naga/tests/out/wgsl/wgsl-binding-arrays.wgsl
+++ b/naga/tests/out/wgsl/wgsl-binding-arrays.wgsl
@@ -1,3 +1,5 @@
+enable wgpu_binding_array;
+
 struct UniformIndex {
     index: u32,
 }
diff --git a/naga/tests/out/wgsl/wgsl-binding-buffer-arrays.wgsl b/naga/tests/out/wgsl/wgsl-binding-buffer-arrays.wgsl
index b30a75c2131..cdf519705a5 100644
--- a/naga/tests/out/wgsl/wgsl-binding-buffer-arrays.wgsl
+++ b/naga/tests/out/wgsl/wgsl-binding-buffer-arrays.wgsl
@@ -1,3 +1,5 @@
+enable wgpu_binding_array;
+
 struct UniformIndex {
     index: u32,
 }
diff --git a/tests/tests/wgpu-gpu/binding_array/buffers.rs b/tests/tests/wgpu-gpu/binding_array/buffers.rs
index 61ba386a4f5..456b0a82a04 100644
--- a/tests/tests/wgpu-gpu/binding_array/buffers.rs
+++ b/tests/tests/wgpu-gpu/binding_array/buffers.rs
@@ -107,6 +107,7 @@ async fn binding_array_buffers(
     };
 
     let shader = r#"
+        enable wgpu_binding_array;
         struct ImAU32 {
             value: u32,
             _padding: u32,
diff --git a/tests/tests/wgpu-gpu/binding_array/sampled_textures.rs b/tests/tests/wgpu-gpu/binding_array/sampled_textures.rs
index 9f664d2018a..e5d7a465959 100644
--- a/tests/tests/wgpu-gpu/binding_array/sampled_textures.rs
+++ b/tests/tests/wgpu-gpu/binding_array/sampled_textures.rs
@@ -65,6 +65,7 @@ static PARTIAL_BINDING_ARRAY_SAMPLED_TEXTURES: GpuTestConfiguration = GpuTestCon
 /// output due to non-native support for non-uniform indexing within a WARP.
 async fn binding_array_sampled_textures(ctx: TestingContext, partially_bound: bool) {
     let shader = r#"
+        enable wgpu_binding_array;
         @group(0) @binding(0)
         var textures: binding_array<texture_2d<f32>>;
 
diff --git a/tests/tests/wgpu-gpu/binding_array/samplers.rs b/tests/tests/wgpu-gpu/binding_array/samplers.rs
index 8098e762f6f..46627112212 100644
--- a/tests/tests/wgpu-gpu/binding_array/samplers.rs
+++ b/tests/tests/wgpu-gpu/binding_array/samplers.rs
@@ -58,6 +58,7 @@ static PARTIAL_BINDING_ARRAY_SAMPLERS: GpuTestConfiguration = GpuTestConfigurati
 
 async fn binding_array_samplers(ctx: TestingContext, partially_bound: bool) {
     let shader = r#"
+        enable wgpu_binding_array;
         @group(0) @binding(0)
         var samplers: binding_array<sampler>;
         @group(0) @binding(1)
diff --git a/tests/tests/wgpu-gpu/binding_array/storage_textures.rs b/tests/tests/wgpu-gpu/binding_array/storage_textures.rs
index cec6a837774..95d4aeddd05 100644
--- a/tests/tests/wgpu-gpu/binding_array/storage_textures.rs
+++ b/tests/tests/wgpu-gpu/binding_array/storage_textures.rs
@@ -52,6 +52,7 @@ static PARTIAL_BINDING_ARRAY_STORAGE_TEXTURES: GpuTestConfiguration = GpuTestCon
 
 async fn binding_array_storage_textures(ctx: TestingContext, partially_bound: bool) {
     let shader = r#"
+        enable wgpu_binding_array;
         @group(0) @binding(0)
         var textures: binding_array<texture_storage_2d<rgba8unorm, read_write> >;
 
diff --git a/tests/tests/wgpu-gpu/binding_array/tlas.rs b/tests/tests/wgpu-gpu/binding_array/tlas.rs
index 566f6042d9e..f44f6dddaeb 100644
--- a/tests/tests/wgpu-gpu/binding_array/tlas.rs
+++ b/tests/tests/wgpu-gpu/binding_array/tlas.rs
@@ -39,6 +39,7 @@ async fn binding_array_tlas(ctx: TestingContext) {
     // Creating a `ray_query` and initializing it against element 0 forces the binding to be used.
     let shader = r#"
         enable wgpu_ray_query;
+        enable wgpu_binding_array;
 
         @group(0) @binding(0)
         var tlas_array: binding_array<acceleration_structure>;