Files
qbz/crates/qbz-slint/Cargo.toml
T
vicrodh fb0aa619a7 fix(slint): use Skia renderer on macOS (femtovg-wgpu pegs CPU on Metal)
The wgpu underlay spike validated the GPU-shader path, but femtovg-wgpu has a
high per-frame CPU cost on macOS/Metal: continuously-animating views
(ImmersiveView atmosphere, Discover) hit 100-120% CPU on a Mac mini M2 vs
0.5-4% for the same view on Linux. Skia is Slint's mature Metal renderer and
does not have this cost (immersive ~55%, never 100%); text renders correctly.
Static views stay lazy/idle on both renderers.

Choose the renderer per-platform: Linux/Windows keep renderer-femtovg-wgpu
(cheap per-frame there + the femtovg text fixes #5177/#11335); macOS (Intel and
Apple Silicon, CICD included) uses renderer-skia. Both keep unstable-wgpu-28 and
resolve to a *-wgpu renderer, so the shader underlay (require_wgpu_28 +
Image::try_from) works unchanged on both.

Cargo.lock updated with the Skia dependency graph.

cc
2026-06-14 23:52:33 -06:00

135 lines
5.8 KiB
TOML

[package]
name = "qbz-slint"
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
description = "Slint functional MVP shell for QBZ (private branch only)"
[[bin]]
name = "qbz-slint"
path = "src/main.rs"
[dependencies]
# WGPU UNDERLAY SPIKE (feature/wgpu-underlay-spike): we render WGSL fragment
# shaders into a wgpu texture composited under ImmersiveView (`unstable-wgpu-28`
# + the BackendSelector in main.rs). The RENDERER is chosen PER-PLATFORM in the
# target tables below — NOT here — because femtovg-wgpu has a high per-frame CPU
# cost on macOS/Metal (slint #8693) that pegs CPU on any continuously-animating
# view (ImmersiveView atmosphere, Discover): ~60-120% on a Mac mini M2 vs
# 0.5-4% for the identical view on Linux. Skia is Slint's mature Metal renderer
# and does not have this cost. So: Linux/Windows keep femtovg-wgpu (cheap there +
# the femtovg text fixes #5177/#11335); macOS (BOTH Intel and Apple Silicon —
# `cfg(target_os="macos")` covers both, CICD x86_64-apple-darwin included) uses
# Skia. Both keep `unstable-wgpu-28`, and skia-wgpu shares the same wgpu device
# as femtovg-wgpu, so the shader underlay works unchanged on both renderers.
# Pinned =1.16.1 because the wgpu_28 / GraphicsAPI::WGPU28 / require_wgpu_28 API
# is behind an `unstable-*` flag that may change on a minor bump.
# A/B vs the GL build: `git checkout slint-mvp`.
slint = { version = "=1.16.1", default-features = false, features = [
"std",
"backend-winit",
"renderer-software",
"accessibility",
"compat-1-2",
"unstable-wgpu-28",
] }
# Direct access to the winit backend for the system tray: WinitWindowAccessor
# (hide/show the OS window without quitting the event loop) and, later, the
# CustomApplicationHandler (tray event pump + close-to-tray intercept). MUST be
# pinned to the exact version Slint resolves (1.16.1) — i-slint-backend-winit
# does not follow semver, and a mismatch makes with_winit_window() return None.
i-slint-backend-winit = "=1.16.1"
log = { workspace = true }
env_logger = "0.11"
tokio = { workspace = true }
async-trait = { workspace = true }
reqwest = { workspace = true }
image = { version = "0.25", default-features = false, features = ["jpeg", "png"] }
urlencoding = "2"
open = "5"
arboard = "3"
rfd = { version = "0.15", default-features = false, features = ["xdg-portal", "tokio"] }
serde = { workspace = true }
serde_json = { workspace = true }
dirs = "5"
chrono = { workspace = true, features = ["unstable-locales"] }
qbz-app = { path = "../qbz-app" }
qbz-media-controls = { path = "../qbz-media-controls" }
qbz-audio = { path = "../qbz-audio" }
qbz-core = { path = "../qbz-core" }
qbz-player = { path = "../qbz-player" }
qconnect-app = { path = "../qconnect-app" }
qconnect-transport-ws = { path = "../qconnect-transport-ws" }
futures-util = { workspace = true }
uuid = { version = "1", features = ["v4"] }
qbz-library = { path = "../qbz-library" }
qbz-plex = { path = "../qbz-plex" }
qbz-offline-cache = { path = "../qbz-offline-cache" }
qbz-models = { path = "../qbz-models" }
qbz-mixtape = { path = "../qbz-mixtape" }
qbz-playlist-import = { path = "../qbz-playlist-import" }
qbz-qobuz = { path = "../qbz-qobuz" }
qbz-lyrics = { path = "../qbz-lyrics" }
qbz-integrations = { path = "../qbz-integrations" }
rusqlite = { version = "0.31", features = ["bundled"] }
# DJ-mix sampler thread RNG (rand::rng()), confined to a sync scope — the
# same crate qbz-mixtape::shuffle is generic over (spec 40 §6).
rand = { workspace = true }
qbz-cache = { path = "../qbz-cache" }
qbz-credentials = { path = "../qbz-credentials" }
# PER-PLATFORM RENDERER (see the slint comment in [dependencies]). Linux/Windows:
# femtovg-wgpu (cheap per-frame + the femtovg text fixes). macOS: Skia (femtovg-
# wgpu pegs CPU on Metal for animated views). Both resolve to a *-wgpu renderer
# (require_wgpu_28 in main.rs), so the shader underlay works on both. Features
# merge with the base `slint` dep above for the matching target.
[target.'cfg(not(target_os = "macos"))'.dependencies]
slint = { version = "=1.16.1", features = ["renderer-femtovg-wgpu"] }
# Linux system tray via StatusNotifierItem. Same crate + rationale as the
# Tauri build (src-tauri/Cargo.toml): libayatana-appindicator never dispatches
# primary-activate (left-click), so we use ksni's pure-Rust SNI which exposes
# Activate / SecondaryActivate / Scroll. macOS/Windows use `tray-icon` instead
# (added with the CustomApplicationHandler slice).
[target.'cfg(target_os = "linux")'.dependencies]
ksni = { version = "0.3", features = ["blocking"] }
# macOS menu-bar tray (NSStatusItem), hand-rolled directly on objc2 0.5 /
# app-kit 0.2 — the SAME objc2 generation winit 0.30 uses — so the NSMenu lives
# in winit's NSApplication runtime and `[NSApp sendAction:]` dispatches the menu
# item target-action. A second `muda` (from tray-icon) registers a duplicate
# `MudaMenuItem` objc class and either silently fails to dispatch (objc2 0.6) or
# panics at startup (objc2 0.5), so tray-icon/muda is dropped on macOS. Windows
# has no tray for now (untested/unshipped).
[target.'cfg(target_os = "macos")'.dependencies]
# macOS renderer: Skia (femtovg-wgpu pegs CPU on Metal — see [dependencies]).
# Covers BOTH Apple Silicon and Intel (x86_64-apple-darwin / CICD). skia-wgpu
# still serves the shader underlay via require_wgpu_28.
slint = { version = "=1.16.1", features = ["renderer-skia"] }
objc2 = "0.5"
objc2-foundation = { version = "0.2", default-features = false, features = [
"std",
"NSData",
"NSString",
] }
objc2-app-kit = { version = "0.2", default-features = false, features = [
"std",
"NSApplication",
"NSResponder",
"NSRunningApplication",
"NSStatusBar",
"NSStatusItem",
"NSStatusBarButton",
"NSMenu",
"NSMenuItem",
"NSImage",
"NSButton",
"NSControl",
"NSView",
"NSEvent",
] }
[build-dependencies]
slint-build = "1.16"