From 2c95b330e56022f076b26511753b24c64db2eaf2 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Mon, 23 Nov 2026 21:40:13 -0800 Subject: [PATCH] Runtime: the unslotted-attachment-read check reads the heap block's own id and lets go of the pass before the draw is recorded ae4dfd67b9 did not build: memory::Block keeps its id under its memory, and the pass borrowed for the check was held by the resolves iterator past the draw's mutable borrows. The check now runs in its own block. Verified by the clippy, lavapipe and RADV 780M jobs named with this branch's report. --- crates/metal2vulkan-runtime/src/render_encoder.rs | 15 ++++++++------- crates/metal2vulkan-runtime/src/texture.rs | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/render_encoder.rs b/crates/metal2vulkan-runtime/src/render_encoder.rs index 9cb6dd4d5..7d1aadc60 100644 --- a/crates/metal2vulkan-runtime/src/render_encoder.rs +++ b/crates/metal2vulkan-runtime/src/render_encoder.rs @@ -3141,15 +3141,16 @@ impl RenderCommandEncoder { // A draw that may read beyond its slots, while a declared read covers an attachment the // pass holds out of its home layout: such a read names the texture's own element, whose // layout is the home one (`Metrics::unslotted_attachment_reads`). - let pass = &self.pass; - let resolves = (pass.resolving.then(|| pass.resolves())) - .into_iter() - .flatten(); - let unslotted = (draws.reads_unbound || commands) - && (pass.targets()) + let unslotted = (draws.reads_unbound || commands) && { + let pass = &self.pass; + let resolves = (pass.resolving.then(|| pass.resolves())) + .into_iter() + .flatten(); + (pass.targets()) .map(|t| (&t.texture, t.moves())) .chain(resolves.map(|r| (&r.texture, r.moves()))) - .any(|(texture, moved)| moved && self.declared.reads(texture)); + .any(|(texture, moved)| moved && self.declared.reads(texture)) + }; let tables = &self.tables; let factors = (self.factors.as_ref()) .filter(|_| draws.patches) diff --git a/crates/metal2vulkan-runtime/src/texture.rs b/crates/metal2vulkan-runtime/src/texture.rs index c50294a38..322619876 100644 --- a/crates/metal2vulkan-runtime/src/texture.rs +++ b/crates/metal2vulkan-runtime/src/texture.rs @@ -3925,7 +3925,7 @@ impl TextureInner { /// `use_heap` declaration names. pub(crate) fn heap_block(&self) -> Option { match &self.image_of()?._under { - Some(Under::Heap { block, .. }) => Some(block.id), + Some(Under::Heap { block, .. }) => Some(block.memory.id), _ => None, } }