From 14a8d488fa09f75aa38fa95bd911450773e1655e Mon Sep 17 00:00:00 2001 From: LloydNicholson <34131158+LloydNicholson@users.noreply.github.com> Date: Wed, 25 Nov 2026 18:37:05 +0200 Subject: [PATCH] GPU: the host pipeline library works under Wine An empty library is made with a null blob: vkd3d-proton refuses a non-null blob of length 0, so no pipeline was ever kept. Ported from victory-fork ea43d73 (cf. Marvisak/VIctory#1722). Co-Authored-By: Claude Opus 5.5 --- crates/victory-gpu/src/pipeline/library.rs | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) 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,