{"record":{"id":"9badb6657b10a145","repo":"gfx-rs/wgpu","slug":"web-backend-does-not-support-arrays-of-buffers","errorCode":null,"errorMessage":"Web backend does not support arrays of buffers","messagePattern":"Web backend does not support arrays of buffers","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu/src/backend/webgpu.rs","lineNumber":2312,"sourceCode":"                crate::BindingResource::Buffer(crate::BufferBinding {\n                    buffer,\n                    offset,\n                    size,\n                }) => {\n                    let buffer = buffer.inner.as_webgpu();\n                    let mapped_buffer_binding = webgpu_sys::GpuBufferBinding::new(&buffer.inner);\n                    mapped_buffer_binding.set_offset_f64(offset as f64);\n                    if let Some(s) = size {\n                        mapped_buffer_binding.set_size_f64(s.get() as f64);\n                    }\n\n                    webgpu_sys::GpuBindGroupEntry::new_with_gpu_buffer_binding(\n                        binding.binding,\n                        &mapped_buffer_binding,\n                    )\n                }\n                crate::BindingResource::BufferArray(..) => {\n                    panic!(\"Web backend does not support arrays of buffers\")\n                }\n                crate::BindingResource::Sampler(sampler) => {\n                    let sampler = &sampler.inner.as_webgpu().inner;\n                    webgpu_sys::GpuBindGroupEntry::new(binding.binding, sampler)\n                }\n                crate::BindingResource::SamplerArray(..) => {\n                    panic!(\"Web backend does not support arrays of samplers\")\n                }\n                crate::BindingResource::TextureView(texture_view) => {\n                    let texture_view = &texture_view.inner.as_webgpu().inner;\n                    webgpu_sys::GpuBindGroupEntry::new_with_gpu_texture_view(\n                        binding.binding,\n                        texture_view,\n                    )\n                }\n                crate::BindingResource::TextureViewArray(..) => {\n                    panic!(\"Web backend does not support BINDING_INDEXING extension\")\n                }","sourceCodeStart":2294,"sourceCodeEnd":2330,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu/src/backend/webgpu.rs#L2294-L2330","documentation":"Raised when creating a bind group whose entry is a BindingResource::BufferArray. Browser WebGPU bind group entries bind one buffer per entry, so an array-of-buffers binding (native-only feature used with non-uniform binding arrays) cannot be expressed and the backend panics.","triggerScenarios":"Calling device.create_bind_group with a BindGroupEntry whose resource is BindingResource::BufferArray(&[...]) on the web backend, typically for bindings declared as arrays of storage/uniform buffers.","commonSituations":"Using the bindless-style buffer-array patterns on wasm32-web; shared bind group layout code written for native backends; batching many uniform buffers into one array binding.","solutions":["Bind each buffer as a separate BindGroupEntry with its own binding index.","Pack per-object data into a single larger uniform/storage buffer with dynamic offsets, and use set_bind_group dynamic offsets per draw.","Restrict buffer-array bindings to native backends and provide a web-specific bind group layout."],"exampleFix":"// before\nentries.push(wgpu::BindGroupEntry { binding: 0, resource: wgpu::BindingResource::BufferArray(&buffers) });\n// after\nfor (i, buf) in buffers.iter().enumerate() {\n    entries.push(wgpu::BindGroupEntry { binding: i as u32, resource: wgpu::BindingResource::Buffer(buf.slice(..)) });\n}","handlingStrategy":"validation","validationCode":"for e in &entries {\n    assert!(!matches!(e.resource, wgpu::BindingResource::BufferArray(_)), \"BufferArray unsupported on web backend\");\n}","typeGuard":"fn is_web_safe_resource(r: &wgpu::BindingResource) -> bool {\n    !matches!(r, wgpu::BindingResource::BufferArray(_) | wgpu::BindingResource::SamplerArray(_) | wgpu::BindingResource::TextureViewArray(_))\n}","tryCatchPattern":null,"preventionTips":["Use one bind group entry per buffer with dynamic offsets instead of buffer arrays.","Pack per-object uniforms into a single buffer with dynamic offset alignment.","Validate bind group entries against the backend before create_bind_group in debug builds."],"tags":["webgpu","wasm","bind-group","unsupported-feature"],"backgroundTag":"buffer-array-unsupported-on-web","analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}