From ee716d0137c939a56b37977b279318644139796b Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Tue, 28 Jul 2026 17:57:05 +0200 Subject: [PATCH] fix(encode): pf-encode did not build on Linux without `vulkan-encode` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `vulkan_encode_available_at` and `vulkan_encode_caps` were gated on bare `target_os = "linux"`, but the second returns `vulkan_video::VulkanEncodeCaps` and both reference that module — which only exists under the feature. Every CALL SITE was already correctly gated, so nothing pointed at them; the two definitions alone were enough to fail the build. That is CI's default-feature line (`cargo clippy --workspace --all-targets`), so this was going to be caught — it was caught on a Fedora 44 box first. `cursor_blend_capable`'s `ten_bit` goes unused in the featureless arm for the same reason, which `-D warnings` also rejects. Co-Authored-By: Claude Opus 5 (1M context) --- crates/pf-encode/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/pf-encode/src/lib.rs b/crates/pf-encode/src/lib.rs index 82a813e4..9ada3ab1 100644 --- a/crates/pf-encode/src/lib.rs +++ b/crates/pf-encode/src/lib.rs @@ -1081,6 +1081,7 @@ pub fn cursor_blend_capable(codec: Codec, cuda_planned: bool, ten_bit: bool) -> } #[cfg(not(feature = "vulkan-encode"))] { + let _ = ten_bit; // the depth only ever narrows the Vulkan arm false } }; @@ -1138,7 +1139,7 @@ fn vulkan_encode_available(codec: Codec) -> bool { /// decides whether an HDR session gets the good path (real RFI + the compute CSC's cursor blend) /// or falls back to libav VAAPI — asked per codec, because a device can advertise HEVC Main10 and /// still decline 10-bit AV1. -#[cfg(target_os = "linux")] +#[cfg(all(target_os = "linux", feature = "vulkan-encode"))] fn vulkan_encode_available_at(codec: Codec, ten_bit: bool) -> bool { let caps = vulkan_encode_caps(codec); caps.supported @@ -1153,7 +1154,12 @@ fn vulkan_encode_available_at(codec: Codec, ten_bit: bool) -> bool { /// a web-console GPU change re-probes on the new adapter before the next Welcome, mirroring /// `can_encode_444`/`can_encode_10bit`. The probe creates and destroys its own Vulkan instance, /// so it is worth caching but safe to call from anywhere. -#[cfg(target_os = "linux")] +/// +/// The `vulkan-encode` half of the cfg is not decoration: the return type comes from the +/// `vulkan_video` module, which only exists under that feature. Every caller is already gated; +/// leaving these two definitions on bare `target_os = "linux"` is what broke a featureless Linux +/// build (caught on Fedora 44, 2026-07-28). +#[cfg(all(target_os = "linux", feature = "vulkan-encode"))] fn vulkan_encode_caps(codec: Codec) -> vulkan_video::VulkanEncodeCaps { use std::collections::HashMap; use std::sync::{Mutex, OnceLock};