diff --git a/crates/metal2vulkan-runtime/src/command_buffer/submit.rs b/crates/metal2vulkan-runtime/src/command_buffer/submit.rs index 4143838df..3c446f2cd 100644 --- a/crates/metal2vulkan-runtime/src/command_buffer/submit.rs +++ b/crates/metal2vulkan-runtime/src/command_buffer/submit.rs @@ -227,7 +227,6 @@ use crate::tracker::{Barrier, Point, Summary}; use crate::work_counts::Begun; use ash::vk; use std::collections::BTreeSet; -use std::sync::atomic::Ordering; use std::sync::Arc; #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] use {crate::tracker::Footprint, std::sync::Mutex}; @@ -1160,7 +1159,7 @@ impl CommandBufferShared { // (`shadow_standing.rs`): its writes let go of those they meet; then, where it ends the // command buffer with its last encoder and nothing failed it or reached memory unnamed, // the shadows its end left holding every texel of their truth stand. - let unnamed = state.reaches_unnamed || self.unnoted.load(Ordering::Relaxed); + let unnamed = state.reaches_unnamed; let clean = state.failure.is_none() && state.fails_from.is_none() && state.faulted.is_empty() @@ -1484,10 +1483,9 @@ impl CommandBufferShared { /// names. fn stands(&self, state: &State, encoder: usize, copies: &ShadowCopies) -> bool { let keys = copies.standing_keys(); - let unnamed = state.reaches_unnamed || self.unnoted.load(Ordering::Relaxed); let wrote = (state.recorded[..encoder].iter()).any(|recorded| recorded.summary.writes_any(&keys)); - !unnamed && !wrote && self.device.shared().standings.stands(copies) + !state.reaches_unnamed && !wrote && self.device.shared().standings.stands(copies) } /// Record the decodes into ASTC carriers' second decoded twins (`texture/decoded_twin.rs`) of diff --git a/crates/metal2vulkan-runtime/src/shadow_standing.rs b/crates/metal2vulkan-runtime/src/shadow_standing.rs index ee663b42c..1e3d456d9 100644 --- a/crates/metal2vulkan-runtime/src/shadow_standing.rs +++ b/crates/metal2vulkan-runtime/src/shadow_standing.rs @@ -18,9 +18,12 @@ //! key, whatever the range) lets go of the standing: another shadow's copy back over the same //! bytes, a blit's or a pass's write, a copy in that a command buffer's end did not leave //! standing. So does any batch of a command buffer whose commands may reach memory no use names -//! (a root table, an execution resolved from records: `State::reaches_unnamed`, or one that -//! noted nothing as it encoded), for every shadow. A shadow over a buffer whose `VkBuffer` was -//! handed out (`Buffer::vk_buffer`), which the caller's own work may write, never stands. +//! (a root table, an execution resolved from records: `State::reaches_unnamed`), for every +//! shadow. Every other command's tracked uses are in its encoder's summary, whether or not the +//! device's logs of host pages collected them (`CommandBuffer::note_dirty`). A shadow over a +//! buffer whose uses are untracked, whose writes no summary holds, never stands; nor does one +//! over a buffer whose `VkBuffer` was handed out (`Buffer::vk_buffer`), which the caller's own +//! work may write. //! - **The copy in.** A command buffer's first copy in of such a shadow, before any command of //! its encoder wrote what it reads, goes to its batch's submission (`shadow::GatedCopyIn`), and //! copies nothing there where the shadow stands and no earlier encoder of the command buffer @@ -32,7 +35,7 @@ use super::key_hash::KeyMap; use super::resource::ResourceKey; use super::shadow::ShadowCopies; use super::tracker::Summary; -use super::values::StorageMode; +use super::values::{HazardTrackingMode, StorageMode}; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, Mutex, MutexGuard, Weak}; @@ -74,17 +77,18 @@ struct Stood { impl StandingAcross { /// The standing of a shadow over `buffer`'s bytes: one that may stand where the buffer is a - /// `Private` or `Memoryless` buffer the runtime made of its own (not a heap's, nor over the - /// caller's memory), until its `VkBuffer` is handed out; none for any other. + /// tracked `Private` or `Memoryless` buffer the runtime made of its own (not a heap's, nor + /// over the caller's memory), until its `VkBuffer` is handed out; none for any other. pub(super) fn over(buffer: &Buffer) -> StandingAcross { let private = matches!( buffer.resource_options().storage_mode(), Ok(StorageMode::Private | StorageMode::Memoryless) ); let own = buffer.caller_memory().is_none() && buffer.heap().is_none(); + let tracked = buffer.hazard_tracking_mode() == HazardTrackingMode::Tracked; StandingAcross { stood: Mutex::new(None), - handed_out: (private && own).then(|| buffer.handed_out()), + handed_out: (private && own && tracked).then(|| buffer.handed_out()), } } diff --git a/docs/API.md b/docs/API.md index 2602b87c1..e357583c2 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1460,11 +1460,11 @@ bound. image before each use and back after each write (over a buffer's bytes but a tracked private buffer's, kept before a write and merged back after it; over a tracked private buffer of the runtime's own, copied in again only once another command buffer wrote it). That buffer is a - `Private` or `Memoryless` one the runtime made, of no heap and over none of the caller's memory, - whose `VkBuffer` was never handed out; a command buffer whose commands may reach memory no use - names (a function that reaches buffers through their addresses, work resolved from records) also - lets go of every such image, and `WorkCounts::shadow_copies_in_skipped_by_standing` counts each - copy in a standing image saved. A render pass that loads it as an attachment, takes it in no other way and draws under + tracked `Private` or `Memoryless` one the runtime made, of no heap and over none of the caller's + memory, whose `VkBuffer` was never handed out; a command buffer whose commands may reach memory + no use names (a function that reaches buffers through their addresses, work resolved from + records) also lets go of every such image, and `WorkCounts::shadow_copies_in_skipped_by_standing` + counts each copy in a standing image saved. A render pass that loads it as an attachment, takes it in no other way and draws under scissors copies in only the texels inside them (`WorkCounts::shadow_texels_copied_in`). Over a buffer's bytes that another writer may write while a command buffer runs, the image is kept in a scratch buffer before the first command