diff --git a/crates/xcl/src/shaders.rs b/crates/xcl/src/shaders.rs index 427de54058..f0ab2a1d46 100644 --- a/crates/xcl/src/shaders.rs +++ b/crates/xcl/src/shaders.rs @@ -1947,6 +1947,8 @@ mod pipeline_cap_tests { fn stale_blob_cannot_bypass_the_offline_pipeline_cap() { use super::{Pipelines, recomp, Ordering}; use std::time::{Instant, SystemTime, UNIX_EPOCH}; + // Pipelines::make* stores into the process-wide library builder that the library tests begin. + let _serial = crate::shaders::pipeline_library::BUILD_TEST.lock().unwrap_or_else(|e| e.into_inner()); struct Scratch(std::path::PathBuf); impl Drop for Scratch { @@ -1992,6 +1994,7 @@ mod pipeline_cap_tests { use std::sync::Arc; use std::time::{SystemTime, UNIX_EPOCH}; use windows::Win32::Graphics::Direct3D12::*; + let _serial = crate::shaders::pipeline_library::BUILD_TEST.lock().unwrap_or_else(|e| e.into_inner()); struct Scratch(std::path::PathBuf); impl Drop for Scratch { @@ -4386,6 +4389,7 @@ mod tests { recomp::runner::skip_test(&e); return; } + let _serial = crate::shaders::pipeline_library::BUILD_TEST.lock().unwrap_or_else(|e| e.into_inner()); struct Temp(std::path::PathBuf); impl Drop for Temp { fn drop(&mut self) { diff --git a/crates/xcl/src/shaders/pipeline_library.rs b/crates/xcl/src/shaders/pipeline_library.rs index 470de7fde0..1defc75600 100644 --- a/crates/xcl/src/shaders/pipeline_library.rs +++ b/crates/xcl/src/shaders/pipeline_library.rs @@ -384,7 +384,7 @@ void main() {{ output.Store(0, {n}); }} #[test] fn builder_deduplicates_names_and_atomically_replaces_output() { - let _serial = BUILD_TEST.lock().unwrap(); + let _serial = BUILD_TEST.lock().unwrap_or_else(|e| e.into_inner()); let Some((pipelines, dxil, root)) = fixture() else { return }; let desc = compute_desc(&dxil, &root); let pso = unsafe { pipelines.dev.CreateComputePipelineState::(&desc) } @@ -426,7 +426,7 @@ void main() {{ output.Store(0, {n}); }} #[test] fn graphics_pipeline_round_trips_through_serialized_library() { - let _serial = BUILD_TEST.lock().unwrap(); + let _serial = BUILD_TEST.lock().unwrap_or_else(|e| e.into_inner()); let Some((pipelines, _, _)) = fixture() else { return }; let source = r#" #define RS "" @@ -490,7 +490,7 @@ struct V { float4 p : SV_Position; }; #[test] fn mesh_pipeline_round_trips_through_serialized_library() { - let _serial = BUILD_TEST.lock().unwrap(); + let _serial = BUILD_TEST.lock().unwrap_or_else(|e| e.into_inner()); let Some((pipelines, _, _)) = fixture() else { return }; let mut options = D3D12_FEATURE_DATA_D3D12_OPTIONS7::default(); if unsafe { diff --git a/crates/xcl/src/shaders/warm_library.rs b/crates/xcl/src/shaders/warm_library.rs index 56c5993de8..de51a59ff4 100644 --- a/crates/xcl/src/shaders/warm_library.rs +++ b/crates/xcl/src/shaders/warm_library.rs @@ -230,7 +230,7 @@ mod tests { ..Default::default() }; let pso = unsafe { pipelines.dev.CreateComputePipelineState::(&desc) }.unwrap(); - let _serial = super::super::pipeline_library::BUILD_TEST.lock().unwrap(); + let _serial = super::super::pipeline_library::BUILD_TEST.lock().unwrap_or_else(|e| e.into_inner()); super::super::pipeline_library::abort(); assert!(super::super::pipeline_library::begin(&pipelines.dev, None).unwrap()); super::super::pipeline_library::store("fixture.pso".into(), &pso).unwrap();