mirror of
https://github.com/anomalyco/hex.git
synced 2026-12-04 02:05:29 +08:00
Windows: make the capture picker at its first open (#1226)
On Windows a prewarmed overlay keeps no pixels while hidden, only its surface. The picker's surface covers the whole primary display, so a tray Hex held it in GPU memory from launch. The picker is now made the first time it opens. It shows only before the capture it starts, so that capture still knows its window. The idle memory case also reports gpu.vram.
This commit is contained in:
@@ -546,6 +546,9 @@ The on-screen picker // capture.picker (capture_capsule/pick
|
||||
├── A full-screen Rune overlay on the pointer's display, under the capsule,
|
||||
│ left out of recordings (`OwnWindow::Picker`); it takes the pointer only while
|
||||
│ picking and never takes focus; it follows the pointer to another display
|
||||
├── Made at launch, hidden; on Windows at its first open instead, since a
|
||||
│ hidden full-screen surface there holds GPU memory and no pixels
|
||||
│ (`perf/idle.bench.ts#window-closed-memory`, `gpu.vram`)
|
||||
├── Everything but the target dims; the dim moves with the target as one piece
|
||||
├── Window -> the window under the pointer: tinted, ringed, its title in a badge;
|
||||
│ the cursor becomes Scrawl's camera; no window under it -> the display
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ The copy loads no model, except in the listening cases below.
|
||||
| --- | --- | --- | --- | --- |
|
||||
| `perf/idle.bench.ts` | `window-open` | `cpu.work` | 8 s at rest with the window on General | waits for an unlock |
|
||||
| `perf/idle.bench.ts` | `window-closed` | `cpu.work` | 8 s at rest, tray only (`app --hidden`) | runs |
|
||||
| `perf/idle.bench.ts` | `window-closed-memory` | `memory.app.private` | The same tray's private memory | runs |
|
||||
| `perf/idle.bench.ts` | `window-closed-memory` | `memory.app.private` | The same tray's private memory and dedicated GPU memory (`gpu.vram`) | runs |
|
||||
| `perf/launch.bench.ts` | `cold-launch` | `launch.ready` | Process start to the first painted window | waits for an unlock |
|
||||
| `perf/launch.bench.ts` | `hidden-launch` | `launch.ready` | Process start to `local API started`, tray only | runs |
|
||||
| `perf/listening.bench.ts` | `listening-at-rest` | `cpu.work` | 8 s listening at rest, microphone released and open | runs |
|
||||
|
||||
+4
-3
@@ -32,12 +32,13 @@ export default bench({
|
||||
},
|
||||
},
|
||||
// The same tray, judged by what it holds: the GPU device and the
|
||||
// surfaces of the overlays that wait hidden (the capture capsule,
|
||||
// picker, and ink are made at launch).
|
||||
// surfaces of the overlays that wait hidden (the capture capsule and
|
||||
// ink are made at launch, and the picker too except on Windows).
|
||||
// `gpu.vram` is the surfaces' dedicated GPU memory.
|
||||
"window-closed-memory": {
|
||||
targets: ["tray"],
|
||||
primary: "memory.app.private",
|
||||
metrics: ["cpu.wakes", "cpu.work"],
|
||||
metrics: ["gpu.vram", "cpu.wakes", "cpu.work"],
|
||||
async run({ page }) {
|
||||
await page.wait(8_000)
|
||||
},
|
||||
|
||||
@@ -291,8 +291,8 @@ pub(crate) struct CaptureOverlays {
|
||||
}
|
||||
|
||||
impl CaptureOverlays {
|
||||
/// Adds the three overlays, prewarmed and hidden, and starts following
|
||||
/// captures.
|
||||
/// Adds the three overlays, hidden, and starts following captures. The
|
||||
/// capsule and ink are prewarmed; the picker too, except on Windows.
|
||||
pub(crate) fn install<S: 'static>(app: &mut rune::App<S>) -> Self {
|
||||
let picker = PickerOverlay::install(app, act);
|
||||
let aim = picker.clone();
|
||||
|
||||
@@ -864,8 +864,9 @@ pub(crate) struct PickerOverlay {
|
||||
}
|
||||
|
||||
impl PickerOverlay {
|
||||
/// Adds the overlay, prewarmed and hidden. `act` starts what it picks;
|
||||
/// it runs on the main thread, so it must only hand the action on.
|
||||
/// Adds the overlay, hidden (prewarmed except on Windows). `act` starts
|
||||
/// what it picks; it runs on the main thread, so it must only hand the
|
||||
/// action on.
|
||||
pub(crate) fn install<S: 'static>(
|
||||
app: &mut rune::App<S>,
|
||||
act: impl Fn(Action) + Send + Sync + 'static,
|
||||
@@ -879,7 +880,11 @@ impl PickerOverlay {
|
||||
level: OverlayLevel::AboveStatus,
|
||||
exclude_from_capture: !crate::capture_host::own_windows_recorded(),
|
||||
input: OverlayInput::All,
|
||||
prewarm: true,
|
||||
// Windows keeps no prewarmed pixels, only a hidden
|
||||
// full-screen surface; the picker is made at its first open
|
||||
// instead. It shows only before the capture it starts, so
|
||||
// that capture still knows its window.
|
||||
prewarm: !cfg!(target_os = "windows"),
|
||||
..Default::default()
|
||||
})
|
||||
.poll(poll)
|
||||
|
||||
Reference in New Issue
Block a user