Skip to content

Fix #306: render on the power-saving GPU by default, with a preference for the discrete one - #329

Merged
bflatastic merged 1 commit into
mainfrom
fix/issue-306
Oct 7, 2026
Merged

bflatastic merged 1 commit into
mainfrom
fix/issue-306

Conversation

@bflatastic

Copy link
Copy Markdown
Member

Fixes #306 and #305.

On hybrid-graphics laptops, egui-wgpu's default power preference is HighPerformance, so VectorCraft rendered on the discrete GPU and its frames were copied to the display driven by the integrated one. On an Asus ZenBook with Intel Iris and a discrete Arc GPU, the window flickered whenever the mouse moved over it, and disabling the Arc GPU stopped it. VectorCraft rasterizes the canvas on the CPU (vello_cpu); the GPU only composites the canvas texture and draws the UI, which the integrated GPU does easily. The desktop app now asks wgpu for the power-saving adapter by default. A machine with one GPU gets that GPU either way.

What users see

  • On hybrid-graphics laptops, VectorCraft renders on the integrated GPU by default, which is the setup that doesn't flicker, while the discrete GPU stays enabled for other apps.
  • Edit › Preferences › Performance › GPU Performance has a Graphics Processor setting: Power Saving (integrated) or High Performance (discrete), with the note "Applies the next time VectorCraft starts."
  • Help › About shows the adapter in use, e.g. "Graphics: AMD Radeon(TM) Graphics (Vulkan, IntegratedGpu)", which helps with future GPU reports.
  • README and docs/development.md (new "Desktop graphics processor" section) explain the default, the preference and WGPU_POWER_PREF.

Preferences / commands

  • New engine preference gpuPreference: powerSaving (default) or highPerformance, a choice in PREF_SPECS, so prefs.get / set (by value or label) / reset / list handle it, and invalid values are rejected without changing anything. Older preference files get the default.
  • apps/vectorcraft/src/main.rs reads it from the saved state before the window opens and sets wgpu_options (WgpuSetup::CreateNew) .power_preference, through eframe's re-exports (no new dependencies). WGPU_POWER_PREF (low, high, none) overrides it when set.
  • ui.inspect returns graphicsAdapter. The web app is unchanged.

Tests

  • Engine: default, set by value and by label, five invalid values rejected with prefs unchanged, serde round trip, old files get the default, the prefs.list row, reset by category.
  • App: the pure power_preference(pref, env) mapping (default, both values, unknown values, the environment variable winning either way), and the key the engine saves is the one the app reads.
  • UI: a headless frame of Preferences › Performance shows the setting and the restart note; OK applies it and it is saved under engine_prefs.gpuPreference.
  • Traditional Chinese catalog rows for the new strings.

Checks

  • Rebased on dfe7f1a (Fix #296: variable fonts list and draw every named style #326): cargo xtask ci, all 7 steps passed (fmt, clippy, test, assets, brands, layers, wasm), 3,473 tests.
  • Live on a hybrid laptop (AMD Radeon integrated + NVIDIA RTX 3070 Laptop GPU), release build with --control:
    • default: graphicsAdapter is the integrated Radeon (Vulkan) and the canvas renders correctly;
    • saved preference highPerformance: the RTX 3070, rendering correctly;
    • the same with WGPU_POWER_PREF=low: back on the integrated GPU;
    • Preferences › Performance and About checked in screenshots.
  • Not reproduced: this machine has no Iris + Arc pair and showed no flicker on either GPU. The fix rests on the reporter's finding that rendering without the Arc GPU stops it; this gets the same effect with Arc enabled.

🤖 Generated with Claude Code

…e for the discrete one

On hybrid-graphics laptops (an integrated GPU driving the display plus a
discrete one), egui-wgpu's default power preference is HighPerformance, so
VectorCraft rendered on the discrete GPU and its frames were copied to the
display through the integrated one. On an Asus ZenBook with Intel Iris + Arc
the window flickered whenever the mouse moved over it (#306, #305).

The canvas is rasterized on the CPU (vello_cpu) and the GPU only composites
the canvas texture and draws the UI, so the integrated GPU is plenty. The
desktop app now asks wgpu for the power-saving adapter by default.
Single-GPU machines are unaffected.

- Preferences > Performance > Graphics Processor (`gpuPreference`:
  powerSaving, the default, or highPerformance), with a note that it
  applies after a restart. The app reads it from the saved preferences
  before the window opens. WGPU_POWER_PREF still overrides it.
- Help > About and `ui.inspect` (`graphicsAdapter`) name the adapter in
  use, and it is logged at startup, for future GPU bug reports.
- Docs (README, docs/development.md) and ROADMAP updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem: Application window flickers

1 participant