Tell the user when PdfCraft draws without a GPU (#519) (#627)

* Refs #519: tell the user when PdfCraft draws without a GPU

When wgpu's adapter is a software one (WARP on Windows, llvmpipe on
Linux), show a notice at launch that PdfCraft may be slow. egui-wgpu
only logged it, so the #519 reporter had to find it in pdfcraft.log.

The OpenGL fallback isn't covered: glow reports its renderer only
through unsafe calls. The string is translated in the ten catalogs that
carry the portable-mode notice, with their ATTRIBUTION.toml hashes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* zh-hant: the drawing-without-a-GPU notice

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
This commit is contained in:
jcl-bit 2026-10-09 15:45:27 -07:00 committed by GitHub
parent cc31d11227
commit 22cbf65628
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 50 additions and 11 deletions

View File

@ -19,7 +19,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Simplified Chinese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "ed6e797e2ae7e4632aabc585af973c15f34d0366671a6c57acf222a3a98b087b"
sha256 = "4c4a3955e2f687d8b0483bd01986bf652a6a84cd5c8fadac01bc30dc74466aa8"
[[asset]]
path = "crates/ui-egui/src/i18n/zh-hant.tsv"
@ -30,7 +30,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Traditional Chinese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "0575e82da2596ca407ad8153cde04750fa6c1ab98ab7b850032ed361d51f9a4e"
sha256 = "64cb89b98806cceee1900c840a167a181fb8d6fe43ad8f361c4d56e25b504b30"
[[asset]]
path = "crates/ui-egui/src/i18n/cs.tsv"
@ -41,7 +41,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Czech UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "8bab483a3f5ba3a724365c2a5a892291a10f41fdc443eaceb66f49c8a20cae20"
sha256 = "8aaf1667040f5fb982a31c680674cf1c51e98092e5ccc38dc5a7e916238c2d1c"
[[asset]]
path = "crates/ui-egui/src/i18n/pt-br.tsv"
@ -52,7 +52,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Brazilian Portuguese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "2cd5dcc6cf7e94914b955ee0f2f5c3e8951b16e26ab49fcb7111246a6e31ee2a"
sha256 = "81a1320a5769dce52c90d35953d82c0eccbb18deb05421883d6ef0680ce4c6b3"
[[asset]]
path = "crates/ui-egui/src/i18n/es.tsv"
@ -63,7 +63,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Spanish UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "460a8a8740f1a8a97f3c3e4bc8d27913d417539a5667a2686a4ec1047c309d39"
sha256 = "d9eb5199e627ada01c404232ae500bff145654a61ae4379b037dbdc2afd13efa"
[[asset]]
path = "crates/ui-egui/src/i18n/fr.tsv"
@ -74,7 +74,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "French UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "3413a391aeb98cc442f9e384df0e676492debe49132629b0c903c45c3d7d56d1"
sha256 = "e6f51aa5d11225920e971f43420dfde96e5ab209b3fa7cffd572a2959bf09d82"
[[asset]]
path = "crates/ui-egui/src/i18n/de.tsv"
@ -85,7 +85,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "German UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "357f864eb011b8fdcbe0db609a85ce6f8c7fb421769361e5def005cc515d311d"
sha256 = "d1250a2d29e447b86b4b9f9515f9d9b7c74ff8fe7a1ac0d6207355a02d895f8b"
[[asset]]
path = "crates/ui-egui/src/i18n/te.tsv"
@ -118,7 +118,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Hungarian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "31b4e703f7b60727e09cc7e68b287e748f4dbd0ae9e1298b96714bcf8da6e74e"
sha256 = "292fb26efe13ae85f4343b4dffd541ba36d4963cb309f7cbad5074b940aaf5e5"
[[asset]]
path = "crates/ui-egui/src/i18n/bg.tsv"
@ -129,7 +129,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Bulgarian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "d25162d477b3370238b23b0a61e827c4df73aac2cb5ccfc694f79e2adc9798c7"
sha256 = "df90a3c504c18f606a94fb6aa1fb4f8cd2aa26112aa09c29add5e37db02495af"
[[asset]]
path = "crates/ui-egui/src/i18n/ja.tsv"
@ -140,7 +140,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Japanese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "e9801730750c13ce4cfe71fb5034a1a4e2984bd20b59ecaf94477c2dbc590e54"
sha256 = "1333d121349c531e3297d9ac304de76434bb7248dbbe0732ec7d842bac5c9eb2"
[[asset]]
path = "crates/ui-egui/src/i18n/uk.tsv"
@ -151,7 +151,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Ukrainian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "306d998039e76769eeb6fa43871807193b8f2ebafc4924f15d17db710ddab184"
sha256 = "a09703008f9ef9e3c96bf6fc6853288ae733ab3b069ed5d02fd9e78fa9acda62"
[[asset]]
path = "assets/icons/accessibility.svg"

View File

@ -297,6 +297,9 @@ fn app_creator<'a>(
if let Some(dir) = pdfcraft_ui_egui::RecoveryStore::default_dir() {
app.enable_recovery(pdfcraft_ui_egui::RecoveryStore::new(dir));
}
if let Some(state) = &cc.wgpu_render_state {
notify_software_renderer(&mut app, state.adapter.get_info().device_type);
}
// A portable marker whose data folder can't be written (#157): say where settings went.
if let Some(w) = &pdfcraft_ui_egui::portable::current().unwritable {
app.notify_fmt(
@ -325,6 +328,16 @@ fn app_creator<'a>(
})
}
/// Tell the user when wgpu draws on the processor (WARP on Windows, llvmpipe on Linux) rather than
/// a GPU, which makes everything slower. egui-wgpu only logs it, so the reporter of #519 had to find
/// it in pdfcraft.log. The OpenGL fallback isn't covered: glow only reports its renderer through
/// `unsafe` calls.
fn notify_software_renderer(app: &mut PdfCraftApp, device_type: eframe::wgpu::DeviceType) {
if device_type == eframe::wgpu::DeviceType::Cpu {
app.notify_tr("PdfCraft is drawing without a graphics processor, so it may be slow. Updating the graphics driver may help.");
}
}
/// Write the control endpoint so that only the current user can read the token.
///
/// The JSON goes to a new file next to `path`, created fresh (owner-only on Unix), which then
@ -555,6 +568,21 @@ mod tests {
assert_eq!(native_options(false, eframe::Renderer::Glow).renderer, eframe::Renderer::Glow);
}
#[test]
fn a_software_renderer_is_shown_to_the_user() {
use eframe::wgpu::DeviceType;
// Issue #519: WARP or llvmpipe is announced in the app, not just in pdfcraft.log.
let mut app = super::PdfCraftApp::new();
super::notify_software_renderer(&mut app, DeviceType::Cpu);
let notice = app.toast.as_ref().map(|(m, _)| m.as_str()).unwrap_or_default();
assert!(notice.contains("without a graphics processor"), "{notice:?}");
for gpu in [DeviceType::IntegratedGpu, DeviceType::DiscreteGpu, DeviceType::VirtualGpu, DeviceType::Other] {
let mut app = super::PdfCraftApp::new();
super::notify_software_renderer(&mut app, gpu);
assert!(app.toast.is_none(), "{gpu:?}: {:?}", app.toast);
}
}
#[test]
fn gpu_backends_avoid_vulkan_on_windows_and_prefer_low_power() {
let mut native = eframe::NativeOptions::default();

View File

@ -1605,6 +1605,7 @@
Couldn't open {name}: {e} {name} не можа да бъде отворен: {e}
Couldn't read {name}: {e} {name} не можа да бъде прочетен: {e}
Portable mode is off: {folder} can't be written ({error}). Settings are kept in your user folder instead. Преносимият режим е изключен: в {folder} не може да се записва ({error}). Вместо това настройките се пазят в потребителската ви папка.
PdfCraft is drawing without a graphics processor, so it may be slow. Updating the graphics driver may help. PdfCraft рисува без графичен процесор, затова може да е бавен. Обновяването на графичния драйвер може да помогне.
Couldn't save: {e} Записването не бе успешно: {e}
Downloading attachments on the web arrives with M3.10 ({n} bytes ready) Изтеглянето на прикачени файлове в уеб версията ще стане достъпно с M3.10 ({n} байта готови)
`{command}` {when} `{command}` {when}

Can't render this file because it contains an unexpected character in line 8 and column 16.

View File

@ -117,4 +117,5 @@
Choose a PNG or JPEG image (up to 4 MiB). Transparency is preserved. Vyberte obrázek PNG nebo JPEG (nejvýše 4 MiB). Průhlednost bude zachována.
Couldn't import the signature image: {e} Obrázek podpisu nelze importovat: {e}
Portable mode is off: {folder} can't be written ({error}). Settings are kept in your user folder instead. Přenosný režim je vypnutý: do složky {folder} nelze zapisovat ({error}). Nastavení se místo toho ukládá do vaší uživatelské složky.
PdfCraft is drawing without a graphics processor, so it may be slow. Updating the graphics driver may help. PdfCraft vykresluje bez grafického procesoru, takže může být pomalý. Pomoci může aktualizace grafického ovladače.
Go to page… Přejít na stránku…

Can't render this file because it contains an unexpected character in line 7 and column 81.

View File

@ -1576,6 +1576,7 @@
Couldn't open {name}: {e} {name} konnte nicht geöffnet werden: {e}
Couldn't read {name}: {e} {name} konnte nicht gelesen werden: {e}
Portable mode is off: {folder} can't be written ({error}). Settings are kept in your user folder instead. Der portable Modus ist aus: In {folder} kann nicht geschrieben werden ({error}). Die Einstellungen werden stattdessen in deinem Benutzerordner gespeichert.
PdfCraft is drawing without a graphics processor, so it may be slow. Updating the graphics driver may help. PdfCraft zeichnet ohne Grafikprozessor und kann daher langsam sein. Ein aktualisierter Grafiktreiber kann helfen.
Couldn't save: {e} Speichern fehlgeschlagen: {e}
Downloading attachments on the web arrives with M3.10 ({n} bytes ready) Anhänge herunterladen kommt im Web mit M3.10 ({n} Bytes bereit)
`{command}` {when} `{command}` {when}

Can't render this file because it contains an unexpected character in line 6 and column 51.

View File

@ -1652,6 +1652,7 @@
Couldn't open {name}: {e} No se pudo abrir {name}: {e}
Couldn't read {name}: {e} No se pudo leer {name}: {e}
Portable mode is off: {folder} can't be written ({error}). Settings are kept in your user folder instead. El modo portátil está desactivado: no se puede escribir en {folder} ({error}). La configuración se guarda en tu carpeta de usuario.
PdfCraft is drawing without a graphics processor, so it may be slow. Updating the graphics driver may help. PdfCraft está dibujando sin procesador gráfico, así que puede ir lento. Actualizar el controlador gráfico puede ayudar.
Couldn't save: {e} No se pudo guardar: {e}
Downloading attachments on the web arrives with M3.10 ({n} bytes ready) La descarga de archivos adjuntos en la versión web llegará con M3.10 ({n} bytes listos)
`{command}` {when} `{command}` {when}

Can't render this file because it contains an unexpected character in line 6 and column 60.

View File

@ -1575,6 +1575,7 @@
Couldn't open {name}: {e} Impossible d'ouvrir {name} : {e}
Couldn't read {name}: {e} Impossible de lire {name} : {e}
Portable mode is off: {folder} can't be written ({error}). Settings are kept in your user folder instead. Le mode portable est désactivé : impossible d'écrire dans {folder} ({error}). Les réglages sont conservés dans votre dossier utilisateur.
PdfCraft is drawing without a graphics processor, so it may be slow. Updating the graphics driver may help. PdfCraft dessine sans processeur graphique et peut donc être lent. Mettre à jour le pilote graphique peut aider.
Couldn't save: {e} Impossible d'enregistrer : {e}
Downloading attachments on the web arrives with M3.10 ({n} bytes ready) Le téléchargement des pièces jointes sur le web arrivera avec M3.10 ({n} octets prêts)
`{command}` {when} `{command}` {when}

Can't render this file because it contains an unexpected character in line 6 and column 39.

View File

@ -1571,6 +1571,7 @@
Couldn't open {name}: {e} {name} megnyitása nem sikerült: {e}
Couldn't read {name}: {e} {name} olvasása nem sikerült: {e}
Portable mode is off: {folder} can't be written ({error}). Settings are kept in your user folder instead. A hordozható mód ki van kapcsolva: {folder} nem írható ({error}). A beállítások helyette a felhasználói mappádban maradnak.
PdfCraft is drawing without a graphics processor, so it may be slow. Updating the graphics driver may help. A PdfCraft grafikus processzor nélkül rajzol, ezért lassú lehet. A grafikus illesztőprogram frissítése segíthet.
Couldn't save: {e} A mentés nem sikerült: {e}
Downloading attachments on the web arrives with M3.10 ({n} bytes ready) A mellékletek letöltése a weben az M3.10-zel érkezik ({n} bájt kész)
`{command}` {when} `{command}` {when}

Can't render this file because it contains an unexpected character in line 7 and column 44.

View File

@ -1658,6 +1658,7 @@
Couldn't open {name}: {e} {name} を開けませんでした: {e}
Couldn't read {name}: {e} {name} を読み取れませんでした: {e}
Portable mode is off: {folder} can't be written ({error}). Settings are kept in your user folder instead. ポータブルモードは無効です: {folder} に書き込めません ({error})。設定は代わりにユーザーフォルダーに保存されます。
PdfCraft is drawing without a graphics processor, so it may be slow. Updating the graphics driver may help. PdfCraft はグラフィックプロセッサーを使わずに描画しているため、動作が遅くなることがあります。グラフィックドライバーを更新すると改善する場合があります。
Couldn't save: {e} 保存できませんでした: {e}
Downloading attachments on the web arrives with M3.10 ({n} bytes ready) Web 版の添付ファイルのダウンロードは M3.10 で対応予定です({n} バイト準備済み)
`{command}` {when} `{command}`: {when}

Can't render this file because it contains an unexpected character in line 6 and column 47.

View File

@ -70,5 +70,6 @@
Choose a PNG or JPEG image (up to 4 MiB). Transparency is preserved. Escolha uma imagem PNG ou JPEG (até 4 MiB). A transparência é preservada.
Couldn't import the signature image: {e} Não foi possível importar a imagem da assinatura: {e}
Portable mode is off: {folder} can't be written ({error}). Settings are kept in your user folder instead. O modo portátil está desativado: não é possível gravar em {folder} ({error}). As configurações ficam na sua pasta de usuário.
PdfCraft is drawing without a graphics processor, so it may be slow. Updating the graphics driver may help. O PdfCraft está desenhando sem processador gráfico, por isso pode ficar lento. Atualizar o driver de vídeo pode ajudar.
Go to page… Ir para a página…
Reopen the files that were open when PdfCraft last closed Reabrir os arquivos que estavam abertos quando o PdfCraft foi fechado pela última vez

Can't render this file because it contains an unexpected character in line 9 and column 16.

View File

@ -2007,6 +2007,7 @@
Couldn't optimize the file Не вдалося оптимізувати файл
Files are combined in this order. Leave Pages empty to take every page. Файли об’єднуються в цьому порядку. Залиште «Сторінки» порожнім, щоб узяти всі сторінки.
Portable mode is off: {folder} can't be written ({error}). Settings are kept in your user folder instead. Портативний режим вимкнено: неможливо записати в {folder} ({error}). Налаштування зберігаються у вашій користувацькій теці.
PdfCraft is drawing without a graphics processor, so it may be slow. Updating the graphics driver may help. PdfCraft малює без графічного процесора, тому може працювати повільно. Оновлення графічного драйвера може допомогти.
Show Показувати
Sort Сортувати
Reverse the order Зворотний порядок

Can't render this file because it contains an unexpected character in line 6 and column 47.

View File

@ -1612,6 +1612,7 @@
Couldn't open {name}: {e} 无法打开{name}:{e}
Couldn't read {name}: {e} 无法读取{name}:{e}
Portable mode is off: {folder} can't be written ({error}). Settings are kept in your user folder instead. 便携模式已关闭:无法写入{folder}({error})。设置改为保存在你的用户文件夹中。
PdfCraft is drawing without a graphics processor, so it may be slow. Updating the graphics driver may help. PdfCraft 正在不使用图形处理器的情况下绘制,因此可能较慢。更新显卡驱动程序可能会有帮助。
Couldn't save: {e} 无法保存:{e}
Downloading attachments on the web arrives with M3.10 ({n} bytes ready) Web 端附件下载将于 M3.10 到来({n} 字节已就绪)
`{command}` {when} `{command}` {when}

Can't render this file because it contains an unexpected character in line 9 and column 16.

View File

@ -1990,3 +1990,4 @@
Printer properties 印表機內容
Reset to printer defaults 還原印表機預設值
This printer offers no settings of its own. 此印表機沒有專屬設定。
PdfCraft is drawing without a graphics processor, so it may be slow. Updating the graphics driver may help. PdfCraft 正在不使用圖形處理器的情況下繪製,因此可能較慢。更新顯示卡驅動程式可能會有幫助。

Can't render this file because it contains an unexpected character in line 9 and column 16.