From c25dc67f446cdddad631f2f6edf80cbaa70a555a Mon Sep 17 00:00:00 2001 From: Jim Heising Date: Tue, 3 Nov 2026 08:09:46 -0800 Subject: [PATCH] fix(webgpu): pass `depth_slice` to the browser's color attachments (#10693) --- CHANGELOG.md | 1 + wgpu/src/backend/webgpu.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfb6542f0..b771a8a1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -326,6 +326,7 @@ By @sagudev in [#10307](https://github.com/gfx-rs/wgpu/pull/10307). - Recognize `GPUInternalError` when converting a WebGPU error, mapping it to `Error::Internal` instead of panicking with "Unexpected error". By @evilpies in [#9919](https://github.com/gfx-rs/wgpu/pull/9919). - Fix `pop_error_scope` panics when it returns `null`. By @beicause in [#10039](https://github.com/gfx-rs/wgpu/pull/10039). - Fix `Device::on_uncaptured_error` never firing in browsers that do not implement `GPUDevice.onuncapturederror`, such as Safari, by listening for the `uncapturederror` event instead of assigning to that attribute. By @zemse in [#10270](https://github.com/gfx-rs/wgpu/pull/10270). +- Pass `RenderPassColorAttachment::depth_slice` to the browser, so a render pass into a 3D texture no longer fails validation with "depthSlice is required for a 3D attachment". By @jheising in [#10693](https://github.com/gfx-rs/wgpu/pull/10693). ### Performance diff --git a/wgpu/src/backend/webgpu.rs b/wgpu/src/backend/webgpu.rs index 2ac362391..f7a2edc5b 100644 --- a/wgpu/src/backend/webgpu.rs +++ b/wgpu/src/backend/webgpu.rs @@ -3487,6 +3487,9 @@ impl dispatch::CommandEncoderInterface for WebCommandEncoder { if let Some(cv) = clear_value { mapped_color_attachment.set_clear_value_gpu_color_dict(&cv); } + if let Some(slice) = ca.depth_slice { + mapped_color_attachment.set_depth_slice(slice); + } if let Some(rt) = ca.resolve_target { let resolve_target_view = &rt.inner.as_webgpu().inner; mapped_color_attachment