ef5808254a
The real Windows client is the spawned punktfunk-session Vulkan binary (pf-client-core); the in-process builtin GUI stream — reachable only via PUNKTFUNK_BUILTIN_STREAM=1 — was dead weight kept alive by nothing and a recurring source of wasted effort. Remove it: delete present/render/input/ audio.rs and the builtin remainder of session/video.rs, rip all the builtin wiring (app/mod, connect, stream), and make connect always spawn. Preserve the two shipped keepers that happened to live in those files by relocating them to a new probe.rs: run_speed_probe (the per-host network speed test used by the Settings speed page and --headless --speed-test) and decodable_codecs (the codec-capability advert on the probe connect). Trim gpu.rs to just the Settings adapter picker (adapter_names + helpers). --headless now supports only --speed-test — the in-process decode/frame-counter went with the pump. Drops the now-orphaned deps opus, wasapi, crossbeam-channel, anyhow; keeps ffmpeg-next (probe::decodable_codecs still needs it). Net 4432 deletions. Statically verified (module wiring, imports, orphaned symbols/deps all clean); the type-level compile runs on the windows-amd64 CI runner, which has the toolchain this non-Windows host lacks. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
57 lines
2.0 KiB
Rust
57 lines
2.0 KiB
Rust
//! DXGI adapter enumeration for the Settings "GPU" picker.
|
|
//!
|
|
//! Streaming (decode + present) runs in the spawned `punktfunk-session` binary; the shell only
|
|
//! needs the list of real (hardware) adapters to offer on a multi-GPU box (a hybrid laptop or an
|
|
//! eGPU). The picked adapter description is persisted (`crate::trust::Settings::adapter`) and read
|
|
//! by the session child at connect (`PUNKTFUNK_ADAPTER` remains the session binary's env override).
|
|
|
|
use windows::core::Interface;
|
|
use windows::Win32::Graphics::Dxgi::{CreateDXGIFactory1, IDXGIAdapter, IDXGIFactory1};
|
|
|
|
/// The adapter's human-readable description.
|
|
fn adapter_name(adapter: &IDXGIAdapter) -> String {
|
|
unsafe {
|
|
adapter
|
|
.GetDesc()
|
|
.map(|d| {
|
|
String::from_utf16_lossy(&d.Description)
|
|
.trim_end_matches('\0')
|
|
.to_string()
|
|
})
|
|
.unwrap_or_else(|_| "<unknown adapter>".into())
|
|
}
|
|
}
|
|
|
|
/// Every DXGI adapter, in enumeration order.
|
|
fn all_adapters() -> Vec<IDXGIAdapter> {
|
|
let factory: IDXGIFactory1 = match unsafe { CreateDXGIFactory1() } {
|
|
Ok(f) => f,
|
|
Err(_) => return Vec::new(),
|
|
};
|
|
let mut v = Vec::new();
|
|
let mut i = 0u32;
|
|
while let Ok(a) = unsafe { factory.EnumAdapters1(i) } {
|
|
i += 1;
|
|
if let Ok(a) = a.cast::<IDXGIAdapter>() {
|
|
v.push(a);
|
|
}
|
|
}
|
|
v
|
|
}
|
|
|
|
/// Descriptions of the real (hardware, non-WARP) GPUs — the Settings GPU picker's option list.
|
|
/// The picker only shows when this has more than one entry.
|
|
pub fn adapter_names() -> Vec<String> {
|
|
const DXGI_ADAPTER_FLAG_SOFTWARE: u32 = 2; // dxgi.h; not in this windows-rs feature set
|
|
all_adapters()
|
|
.iter()
|
|
.filter(|a| {
|
|
a.cast::<windows::Win32::Graphics::Dxgi::IDXGIAdapter1>()
|
|
.and_then(|a1| unsafe { a1.GetDesc1() })
|
|
.map(|d| d.Flags & DXGI_ADAPTER_FLAG_SOFTWARE == 0)
|
|
.unwrap_or(true)
|
|
})
|
|
.map(adapter_name)
|
|
.collect()
|
|
}
|