diff --git a/crates/victory-gpu/src/pipeline/library.rs b/crates/victory-gpu/src/pipeline/library.rs index a903934907..6219b54068 100644 --- a/crates/victory-gpu/src/pipeline/library.rs +++ b/crates/victory-gpu/src/pipeline/library.rs @@ -487,7 +487,35 @@ fn open(device: &ID3D12Device1, blob: Blob) -> Option { // The rejected bytes are let go (a mapped file is unmapped) before the // empty library is made: nothing reads them any more. drop(blob); - let library = make(&[]).ok()?; + // An empty library is asked for with a null blob. An empty Rust slice + // has a dangling, non-null pointer; Windows only looks at the length, + // but the host's D3D12 on Linux (vkd3d-proton) refuses a non-null blob + // of length 0 with E_INVALIDARG, and no pipeline was ever kept there + // ("no host pipeline library" at every start). As upstream PR #1722. + let empty = || -> windows::core::Result { + use windows::core::Interface; + let mut out = std::ptr::null_mut(); + // SAFETY: the method's own arguments; a null blob of length 0 makes + // an empty library, written to `out`. + unsafe { + (Interface::vtable(device).CreatePipelineLibrary)( + Interface::as_raw(device), + std::ptr::null(), + 0, + &ID3D12PipelineLibrary::IID, + &mut out, + ) + .ok()?; + ID3D12PipelineLibrary::from_raw(out).cast() + } + }; + let library = match empty() { + Ok(library) => library, + Err(e) => { + tracing::info!(error = %e, "empty host pipeline library refused"); + return None; + } + }; Some(Library { library, _blob: Blob::None,