diff --git a/crates/metal2vulkan-runtime/src/binding.rs b/crates/metal2vulkan-runtime/src/binding.rs index c609f7014..72a379974 100644 --- a/crates/metal2vulkan-runtime/src/binding.rs +++ b/crates/metal2vulkan-runtime/src/binding.rs @@ -301,7 +301,7 @@ impl TwinProofs { /// The slots of `plan` a command of it only reads, each once, in the order of its uses, as /// [`read_only_buffer_slot`] and [`read_only_slot`] prove them under `unproven`. fn proven(plan: &BindingPlan, unproven: bool) -> Vec<(SlotRef, Proven)> { - #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] + #[cfg(all(test, debug_assertions, any(m2v_gpu, m2v_cpu_icd)))] PLAN_WALKS.with(|walks| walks.set(walks.get() + plan.uses.len() as u64)); let mut seen: Vec = Vec::new(); let mut proven = Vec::new(); @@ -332,7 +332,7 @@ impl TwinProofs { /// uniform buffer, and every descriptor of the plan that names the slot is its buffer's, none of /// it a vertex buffer. fn read_only_buffer_slot(slot: SlotRef, plan: &BindingPlan, unproven: bool) -> bool { - #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] + #[cfg(all(test, debug_assertions, any(m2v_gpu, m2v_cpu_icd)))] PLAN_WALKS.with(|walks| { let walked = plan.uses.len() + plan.descriptors.len(); walks.set(walks.get() + walked as u64) @@ -373,7 +373,7 @@ fn read_only_buffer_slot(slot: SlotRef, plan: &BindingPlan, unproven: bool) -> b /// texture's or a combined image sampler's): the kinds of its bindings, a storage image's and a /// sampled one's ([`TwinKinds`]); else `None`. fn read_only_slot(slot: SlotRef, plan: &BindingPlan, unproven: bool) -> Option { - #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] + #[cfg(all(test, debug_assertions, any(m2v_gpu, m2v_cpu_icd)))] PLAN_WALKS.with(|walks| { let walked = plan.uses.len() + plan.descriptors.len(); walks.set(walks.get() + walked as u64) @@ -425,7 +425,7 @@ fn read_only_slot(slot: SlotRef, plan: &BindingPlan, unproven: bool) -> Option u64 { PLAN_WALKS.with(std::cell::Cell::get) } @@ -2652,7 +2652,7 @@ fn read_only_buffer(ty: vk::DescriptorType) -> bool { /// It walks every write of the plan, one for each resource its heap reaches in each heap array, /// so a draw asks its plan's facts (`render/plan_facts.rs`), which hold the answer. pub(super) fn binds_own_zeros(plan: &BindingPlan) -> bool { - #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] + #[cfg(all(test, debug_assertions, any(m2v_gpu, m2v_cpu_icd)))] PLAN_WALKS.with(|walks| walks.set(walks.get() + plan.descriptors.len() as u64)); plan.descriptors.iter().any(|write| { let neutral = matches!( diff --git a/crates/metal2vulkan-runtime/src/encoder.rs b/crates/metal2vulkan-runtime/src/encoder.rs index 932949c6e..598ee28bd 100644 --- a/crates/metal2vulkan-runtime/src/encoder.rs +++ b/crates/metal2vulkan-runtime/src/encoder.rs @@ -4280,12 +4280,12 @@ pub(super) fn count_shadow_copies(counts: &Counters, copies: &[ShadowCopy]) { /// Whether one of `uses` writes a read twin's key (`EncoderCore::refuses_twin_write`). fn writes_twin(uses: &[Use]) -> bool { - #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] + #[cfg(all(test, debug_assertions, any(m2v_gpu, m2v_cpu_icd)))] TWIN_USES_CHECKED.with(|checked| checked.set(checked.get() + uses.len() as u64)); (uses.iter()).any(|used| used.key.is_read_twin() && !used.write.is_empty()) } -#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] +#[cfg(all(test, debug_assertions, any(m2v_gpu, m2v_cpu_icd)))] thread_local! { /// The uses this thread's encoders checked for a write of a read twin ([`writes_twin`]), in /// the device tests that read it (`tests::resident_uses`). @@ -4293,7 +4293,7 @@ thread_local! { } /// How many uses this thread's encoders checked so far for a write of a read twin. -#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] +#[cfg(all(test, debug_assertions, any(m2v_gpu, m2v_cpu_icd)))] pub(crate) fn twin_uses_checked() -> u64 { TWIN_USES_CHECKED.with(std::cell::Cell::get) }