From 55c7f91ef6d1c8648dfe14c778c3706ed09024eb Mon Sep 17 00:00:00 2001 From: Andy Leiserson Date: Tue, 1 Sep 2026 03:20:18 -0700 Subject: [PATCH] chore(core): Add comments on bind group init actions (#10224) --- wgpu-core/src/device/resource.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index def79de6d..a2b81e3de 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -3403,6 +3403,9 @@ impl Device { bb.offset..bb.offset + visible_size }; + // Once a buffer is initialized, nothing can cause the contents to revert to an + // unknown state, so we do not record an init action in the bind group when that is + // the case. (The same is not true of textures.) buffer_init_actions.extend(buffer.initialization_status.read().create_action( buffer, init_range, @@ -3484,6 +3487,10 @@ impl Device { let texture = &view.parent; + // Unlike buffers, textures contents can revert to being undefined if used as a + // render attachment with `StoreOp::Discard`. Therefore, we must always register + // the init action in the bind group, and check the initialization state every + // time the binding is used. texture_init_actions.push(TextureInitTrackerAction { texture: texture.clone(), range: TextureInitRange {