From ef3b59950e91a49ea346543b72f5929fa03129f6 Mon Sep 17 00:00:00 2001 From: tannevaled Date: Tue, 10 Nov 2026 16:12:50 +0100 Subject: [PATCH] docs(window): Config.GPU on X11 and Wayland, window v0.91.0, in seven languages On the GPU: the Linux path (Vulkan, presented through the existing shm path), its fallback (GPUError, CPU from then on), the lavapipe proof, and the software-only numbers, labelled as such; hardware not measured. modules.md: window v0.91.0. Co-Authored-By: Claude Sonnet 5.5 --- content/de/modules.md | 2 +- content/de/surfaces/native-window.md | 22 +++++++++++++++++++++- content/en/modules.md | 2 +- content/en/surfaces/native-window.md | 20 +++++++++++++++++++- content/es/modules.md | 2 +- content/es/surfaces/native-window.md | 22 +++++++++++++++++++++- content/fr/modules.md | 2 +- content/fr/surfaces/native-window.md | 22 +++++++++++++++++++++- content/ja/modules.md | 2 +- content/ja/surfaces/native-window.md | 19 ++++++++++++++++++- content/ko/modules.md | 2 +- content/ko/surfaces/native-window.md | 20 +++++++++++++++++++- content/zh-cn/modules.md | 2 +- content/zh-cn/surfaces/native-window.md | 15 ++++++++++++++- 14 files changed, 140 insertions(+), 14 deletions(-) diff --git a/content/de/modules.md b/content/de/modules.md index 205d3387..3c8ff50d 100644 --- a/content/de/modules.md +++ b/content/de/modules.md @@ -23,7 +23,7 @@ Schreibens – maßgeblich ist die Tag-Liste des jeweiligen Repositorys. | [`lineedit`](https://github.com/go-widgets/lineedit) | v0.1.1 | ein Zeileneditor als reines Modell: Verlauf, Rückwärtssuche, Tab-Vervollständigung; nur die Standardbibliothek | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/lineedit) | | [`vcs`](https://github.com/go-widgets/vcs) | v0.1.0 | welchen Zustand jede Datei eines Arbeitsverzeichnisses hat, und eine Registry für Treiber; nur die Standardbibliothek. Der Git-Treiber ist das verschachtelte Modul `vcs/git` (`git/v0.1.0`) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/vcs) | | [`data`](https://github.com/go-widgets/data) | v0.4.0 | [typisierte Datensätze, Abfragen, ein lokaler oder entfernter Speicher]({{< relref "/state/data.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/data) | -| [`window`](https://github.com/go-widgets/window) | v0.90.0 | [ein natives Fenster]({{< relref "/surfaces/native-window.md" >}}) auf acht Back-Ends | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/window) | +| [`window`](https://github.com/go-widgets/window) | v0.91.0 | [ein natives Fenster]({{< relref "/surfaces/native-window.md" >}}) auf acht Back-Ends | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/window) | | [`application`](https://github.com/go-widgets/application) | v0.8.1 | [der Anwendungslebenszyklus]({{< relref "/surfaces/application.md" >}}) oberhalb eines Fensters | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/application) | | [`tray`](https://github.com/go-widgets/tray) | v0.15.0 | [ein Tray-Symbol und sein Menü]({{< relref "/surfaces/application.md#the-tray" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/tray) | | [`webcanvas`](https://github.com/go-widgets/webcanvas) | v0.9.0 | [eine Szene in einem Browser-``]({{< relref "/surfaces/browser.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/webcanvas) | diff --git a/content/de/surfaces/native-window.md b/content/de/surfaces/native-window.md index 63d26f3e..91e03c9e 100644 --- a/content/de/surfaces/native-window.md +++ b/content/de/surfaces/native-window.md @@ -72,7 +72,27 @@ Unter macOS zeichnet `Config{GPU: true}` die Frames auf der GPU. 960 × 640 und 0,99 ms statt 5,96 ms bei 1920 × 1200 (Apple M4 Max). - **Rückfall:** Ein Fenster mit transluzentem Material bleibt auf dem CPU-Pfad, ebenso ein Rechner, auf dem Metal nicht startet. Beides ist kein Fehler. - Andere Back-ends ignorieren die Option. + Unter Linux siehe unten; die anderen Back-ends ignorieren die Option. + +Unter Linux (X11 und Wayland) zeichnet `Config{GPU: true}` Frames mit Vulkan. +- **Wie:** dieselbe Aufzeichnung, gezeichnet vom Vulkan-Renderer von + go-gfx/gpu2d. Seine Pixel werden in den Framebuffer des Fensters kopiert, der + wie immer dargestellt wird: MIT-SHM (oder `PutImage`) unter X11, `wl_shm` + unter Wayland. Der Frame durchläuft die CPU einmal; per dma-buf wird noch + nichts mit dem Display-Server geteilt. +- **Genauigkeit:** auf Software-Vulkan (lavapipe) sind die Pixel Byte für Byte + die des CPU-Pfads, live auf beiden Protokollen belegt: das vom X-Server + zurückgelesene Fenster und der vom Fenster übergebene `wl_shm`-Puffer sind + gleich denen des CPU-Pfads. Eine Hardware-GPU wurde noch nicht gemessen. +- **Rückfall:** ist Vulkan nicht verfügbar oder wird ein Frame abgelehnt (für + das Gerät zu groß, Gerät verloren), zeichnet das Fenster auf der CPU und läuft + weiter. `GPUError()` am Back-end nennt den Grund, und jeder spätere Frame ist + ein CPU-Frame. +- **Kosten (nur Software):** lavapipe ist ein CPU-Rasterizer, daher kostet der + GPU-Pfad etwa das Zehnfache der CPU-Zeit des CPU-Pfads: 25,8 ms statt 2,48 ms + pro Frame bei 960 × 640 und 89,7 ms statt 8,46 ms bei 1920 × 1200 (X11, + lavapipe auf 16 Threads in einem arm64-Container auf einem Apple M4 Max). Ob es + sich auf einer echten GPU lohnt, ist noch nicht gemessen. ## HiDPI {#hidpi} diff --git a/content/en/modules.md b/content/en/modules.md index 290dc78c..0374b9e2 100644 --- a/content/en/modules.md +++ b/content/en/modules.md @@ -23,7 +23,7 @@ writing — the repository's own tag list is the authority. | [`lineedit`](https://github.com/go-widgets/lineedit) | v0.1.1 | a line editor as a pure model: history, reverse search, Tab completion; standard library only | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/lineedit) | | [`vcs`](https://github.com/go-widgets/vcs) | v0.1.0 | what state each file of a working tree is in, and a registry of drivers; standard library only. The git driver is the nested module `vcs/git` (`git/v0.1.0`) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/vcs) | | [`data`](https://github.com/go-widgets/data) | v0.4.0 | [typed records, queries, a local or remote store]({{< relref "/state/data.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/data) | -| [`window`](https://github.com/go-widgets/window) | v0.90.0 | [a native window]({{< relref "/surfaces/native-window.md" >}}) on eight back-ends | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/window) | +| [`window`](https://github.com/go-widgets/window) | v0.91.0 | [a native window]({{< relref "/surfaces/native-window.md" >}}) on eight back-ends | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/window) | | [`application`](https://github.com/go-widgets/application) | v0.8.1 | [the application lifecycle]({{< relref "/surfaces/application.md" >}}) above a window | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/application) | | [`tray`](https://github.com/go-widgets/tray) | v0.15.0 | [a tray icon and its menu]({{< relref "/surfaces/application.md#the-tray" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/tray) | | [`webcanvas`](https://github.com/go-widgets/webcanvas) | v0.9.0 | [a scene in a browser ``]({{< relref "/surfaces/browser.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/webcanvas) | diff --git a/content/en/surfaces/native-window.md b/content/en/surfaces/native-window.md index bf6faf8e..24149a3e 100644 --- a/content/en/surfaces/native-window.md +++ b/content/en/surfaces/native-window.md @@ -72,7 +72,25 @@ On macOS, `Config{GPU: true}` draws frames on the GPU. 960 × 640, and 0.99 ms instead of 5.96 ms at 1920 × 1200 (Apple M4 Max). - **Fallbacks:** a window with a translucent material stays on the CPU path, and so does a machine where Metal will not start. Neither is an error. - Other back-ends ignore the option. + On Linux, see below; the other back-ends ignore the option. + +On Linux (X11 and Wayland), `Config{GPU: true}` draws frames with Vulkan. +- **How:** the same recording, drawn by go-gfx/gpu2d's Vulkan renderer. Its + pixels are copied into the window's framebuffer, which is presented as ever: + MIT-SHM (or `PutImage`) on X11, `wl_shm` on Wayland. The frame crosses the CPU + once; nothing is shared with the display server by dma-buf yet. +- **Exactness:** on software Vulkan (lavapipe) the pixels are the CPU path's, + byte for byte, proven live on both protocols: the window read back from the X + server, and the `wl_shm` buffer the window committed, equal the CPU path's. + No hardware GPU has been measured yet. +- **Fallback:** where Vulkan is unavailable, or a frame is refused (too large + for the device, device lost), the window draws on the CPU and keeps running. + `GPUError()` on the back-end says why, and every later frame is a CPU frame. +- **Cost (software only):** lavapipe is a CPU rasterizer, so the GPU path costs + about ten times the CPU time of the CPU path: 25.8 ms instead of 2.48 ms per + frame at 960 × 640, and 89.7 ms instead of 8.46 ms at 1920 × 1200 (X11, + lavapipe on 16 threads in an arm64 container on an Apple M4 Max). Whether it + pays on a real GPU is not measured yet. ## HiDPI diff --git a/content/es/modules.md b/content/es/modules.md index 71bf2d37..9953a32c 100644 --- a/content/es/modules.md +++ b/content/es/modules.md @@ -23,7 +23,7 @@ de escribir; la autoridad es la lista de etiquetas del propio repositorio. | [`lineedit`](https://github.com/go-widgets/lineedit) | v0.1.1 | un editor de línea como modelo puro: historial, búsqueda inversa, completado con Tab; solo la biblioteca estándar | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/lineedit) | | [`vcs`](https://github.com/go-widgets/vcs) | v0.1.0 | en qué estado está cada archivo de un árbol de trabajo, y un registro de controladores; solo la biblioteca estándar. El controlador de git es el módulo anidado `vcs/git` (`git/v0.1.0`) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/vcs) | | [`data`](https://github.com/go-widgets/data) | v0.4.0 | [registros tipados, consultas, un almacén local o remoto]({{< relref "/state/data.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/data) | -| [`window`](https://github.com/go-widgets/window) | v0.90.0 | [una ventana nativa]({{< relref "/surfaces/native-window.md" >}}) sobre ocho backends | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/window) | +| [`window`](https://github.com/go-widgets/window) | v0.91.0 | [una ventana nativa]({{< relref "/surfaces/native-window.md" >}}) sobre ocho backends | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/window) | | [`application`](https://github.com/go-widgets/application) | v0.8.1 | [el ciclo de vida de la aplicación]({{< relref "/surfaces/application.md" >}}) por encima de una ventana | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/application) | | [`tray`](https://github.com/go-widgets/tray) | v0.15.0 | [un icono de bandeja y su menú]({{< relref "/surfaces/application.md#the-tray" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/tray) | | [`webcanvas`](https://github.com/go-widgets/webcanvas) | v0.9.0 | [una escena en un `` de navegador]({{< relref "/surfaces/browser.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/webcanvas) | diff --git a/content/es/surfaces/native-window.md b/content/es/surfaces/native-window.md index 2084593a..72b60211 100644 --- a/content/es/surfaces/native-window.md +++ b/content/es/surfaces/native-window.md @@ -77,7 +77,27 @@ En macOS, `Config{GPU: true}` dibuja los fotogramas en la GPU. (Apple M4 Max). - **Alternativa:** una ventana con un material translúcido se queda en el camino de CPU, igual que una máquina donde Metal no arranca. Ninguno de los - dos casos es un error. Los demás back-ends ignoran la opción. + dos casos es un error. En Linux, véase más abajo; los demás back-ends ignoran la opción. + +En Linux (X11 y Wayland), `Config{GPU: true}` dibuja los fotogramas con Vulkan. +- **Cómo:** el mismo registro, dibujado por el renderizador Vulkan de + go-gfx/gpu2d. Sus píxeles se copian en el framebuffer de la ventana, que se + presenta como siempre: MIT-SHM (o `PutImage`) en X11, `wl_shm` en Wayland. El + fotograma pasa una vez por la CPU; todavía no se comparte nada con el servidor + de pantalla mediante dma-buf. +- **Exactitud:** en Vulkan por software (lavapipe) los píxeles son los del camino + de CPU, byte a byte, demostrado en vivo en ambos protocolos: la ventana leída + de vuelta del servidor X y el búfer `wl_shm` que la ventana confirmó son + iguales a los del camino de CPU. Aún no se ha medido ninguna GPU de hardware. +- **Alternativa:** cuando Vulkan no está disponible, o se rechaza un fotograma + (demasiado grande para el dispositivo, dispositivo perdido), la ventana dibuja + en la CPU y sigue funcionando. `GPUError()` en el back-end dice el motivo, y + todo fotograma posterior es un fotograma de CPU. +- **Coste (solo software):** lavapipe es un rasterizador de CPU, así que el camino + de GPU cuesta unas diez veces el tiempo de CPU del camino de CPU: 25,8 ms en + lugar de 2,48 ms por fotograma a 960 × 640, y 89,7 ms en lugar de 8,46 ms a + 1920 × 1200 (X11, lavapipe con 16 hilos en un contenedor arm64 sobre un Apple + M4 Max). Si compensa en una GPU real aún no está medido. ## HiDPI {#hidpi} diff --git a/content/fr/modules.md b/content/fr/modules.md index 420c2aa7..3b7974ae 100644 --- a/content/fr/modules.md +++ b/content/fr/modules.md @@ -23,7 +23,7 @@ rédaction — la liste des étiquettes du dépôt lui-même fait foi. | [`lineedit`](https://github.com/go-widgets/lineedit) | v0.1.1 | un éditeur de ligne en pur modèle : historique, recherche inversée, complétion par Tab ; bibliothèque standard seule | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/lineedit) | | [`vcs`](https://github.com/go-widgets/vcs) | v0.1.0 | l'état de chaque fichier d'une arborescence de travail, et un registre de pilotes ; bibliothèque standard seule. Le pilote git est le module imbriqué `vcs/git` (`git/v0.1.0`) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/vcs) | | [`data`](https://github.com/go-widgets/data) | v0.4.0 | [enregistrements typés, requêtes, stockage local ou distant]({{< relref "/state/data.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/data) | -| [`window`](https://github.com/go-widgets/window) | v0.90.0 | [une fenêtre native]({{< relref "/surfaces/native-window.md" >}}) sur huit back-ends | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/window) | +| [`window`](https://github.com/go-widgets/window) | v0.91.0 | [une fenêtre native]({{< relref "/surfaces/native-window.md" >}}) sur huit back-ends | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/window) | | [`application`](https://github.com/go-widgets/application) | v0.8.1 | [le cycle de vie de l'application]({{< relref "/surfaces/application.md" >}}) au-dessus d'une fenêtre | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/application) | | [`tray`](https://github.com/go-widgets/tray) | v0.15.0 | [une icône de zone de notification et son menu]({{< relref "/surfaces/application.md#the-tray" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/tray) | | [`webcanvas`](https://github.com/go-widgets/webcanvas) | v0.9.0 | [une scène dans un `` de navigateur]({{< relref "/surfaces/browser.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/webcanvas) | diff --git a/content/fr/surfaces/native-window.md b/content/fr/surfaces/native-window.md index eb045990..caad6449 100644 --- a/content/fr/surfaces/native-window.md +++ b/content/fr/surfaces/native-window.md @@ -72,7 +72,27 @@ Sous macOS, `Config{GPU: true}` dessine les images sur le GPU. en 960 × 640, et 0,99 ms au lieu de 5,96 ms en 1920 × 1200 (Apple M4 Max). - **Repli :** une fenêtre avec un matériau translucide reste sur le chemin CPU, de même qu'une machine où Metal ne démarre pas. Ni l'un ni l'autre n'est une - erreur. Les autres back-ends ignorent l'option. + erreur. Sous Linux, voir ci-dessous ; les autres back-ends ignorent l'option. + +Sous Linux (X11 et Wayland), `Config{GPU: true}` dessine les images avec Vulkan. +- **Comment :** le même enregistrement, dessiné par le moteur Vulkan de + go-gfx/gpu2d. Ses pixels sont copiés dans le framebuffer de la fenêtre, qui est + présenté comme toujours : MIT-SHM (ou `PutImage`) sous X11, `wl_shm` sous + Wayland. L'image traverse le CPU une fois ; rien n'est encore partagé avec le + serveur d'affichage par dma-buf. +- **Exactitude :** sur Vulkan logiciel (lavapipe), les pixels sont ceux du chemin + CPU, octet pour octet, prouvé en direct sur les deux protocoles : la fenêtre + relue depuis le serveur X, et le tampon `wl_shm` validé par la fenêtre, sont + égaux à ceux du chemin CPU. Aucun GPU matériel n'a encore été mesuré. +- **Repli :** quand Vulkan est indisponible, ou qu'une image est refusée (trop + grande pour le périphérique, périphérique perdu), la fenêtre dessine sur le CPU + et continue. `GPUError()` sur le back-end en donne la raison, et toute image + suivante est une image CPU. +- **Coût (logiciel seulement) :** lavapipe est un rastériseur CPU, donc le chemin + GPU coûte environ dix fois le temps CPU du chemin CPU : 25,8 ms au lieu de + 2,48 ms par image en 960 × 640, et 89,7 ms au lieu de 8,46 ms en 1920 × 1200 + (X11, lavapipe sur 16 threads dans un conteneur arm64 sur un Apple M4 Max). Ce + que cela donne sur un vrai GPU n'est pas encore mesuré. ## HiDPI {#hidpi} diff --git a/content/ja/modules.md b/content/ja/modules.md index f69f8fa5..57bf1a44 100644 --- a/content/ja/modules.md +++ b/content/ja/modules.md @@ -20,7 +20,7 @@ API リファレンスは [pkg.go.dev](https://pkg.go.dev/) がソースから | [`lineedit`](https://github.com/go-widgets/lineedit) | v0.1.1 | 純粋なモデルとしての行エディタ。履歴、逆方向検索、Tab 補完。標準ライブラリのみ | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/lineedit) | | [`vcs`](https://github.com/go-widgets/vcs) | v0.1.0 | 作業ツリーの各ファイルがどの状態にあるかと、ドライバのレジストリ。標準ライブラリのみ。git ドライバはネストされたモジュール `vcs/git`(`git/v0.1.0`) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/vcs) | | [`data`](https://github.com/go-widgets/data) | v0.4.0 | [型付きレコード、クエリ、ローカルまたはリモートのストア]({{< relref "/state/data.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/data) | -| [`window`](https://github.com/go-widgets/window) | v0.90.0 | 8 つのバックエンドに対応した[ネイティブウィンドウ]({{< relref "/surfaces/native-window.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/window) | +| [`window`](https://github.com/go-widgets/window) | v0.91.0 | 8 つのバックエンドに対応した[ネイティブウィンドウ]({{< relref "/surfaces/native-window.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/window) | | [`application`](https://github.com/go-widgets/application) | v0.8.1 | ウィンドウの上に載る[アプリケーションのライフサイクル]({{< relref "/surfaces/application.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/application) | | [`tray`](https://github.com/go-widgets/tray) | v0.15.0 | [トレイアイコンとそのメニュー]({{< relref "/surfaces/application.md#the-tray" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/tray) | | [`webcanvas`](https://github.com/go-widgets/webcanvas) | v0.9.0 | [ブラウザの `` 内のシーン]({{< relref "/surfaces/browser.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/webcanvas) | diff --git a/content/ja/surfaces/native-window.md b/content/ja/surfaces/native-window.md index 4c1df57d..73a4abc5 100644 --- a/content/ja/surfaces/native-window.md +++ b/content/ja/surfaces/native-window.md @@ -65,7 +65,24 @@ macOS では `Config{GPU: true}` でフレームを GPU で描画します。 0.59 ms に、1920 × 1200 で 5.96 ms から 0.99 ms になります(Apple M4 Max)。 - **フォールバック:** 半透明マテリアルを持つウィンドウは CPU パスのままです。 Metal が起動しないマシンでも同様で、どちらもエラーではありません。 - ほかのバックエンドはこのオプションを無視します。 + Linux については下を参照してください。ほかのバックエンドはこのオプションを無視します。 + +Linux(X11 と Wayland)では、`Config{GPU: true}` でフレームを Vulkan で描画します。 +- **仕組み:** 同じ記録を go-gfx/gpu2d の Vulkan レンダラーが描画します。そのピクセルは + ウィンドウのフレームバッファにコピーされ、これまでどおり表示されます(X11 では + MIT-SHM または `PutImage`、Wayland では `wl_shm`)。フレームは CPU を一度通ります。 + dma-buf によるディスプレイサーバーとの共有はまだありません。 +- **正確さ:** ソフトウェア Vulkan(lavapipe)では、ピクセルは CPU パスとバイト単位で + 同一です。両方のプロトコルで実機上で確認済みで、X サーバーから読み戻したウィンドウと、 + ウィンドウがコミットした `wl_shm` バッファは、CPU パスのものと一致します。 + ハードウェア GPU ではまだ測定していません。 +- **フォールバック:** Vulkan が使えない場合、またはフレームが拒否された場合(デバイスに + 対して大きすぎる、デバイスの喪失)、ウィンドウは CPU で描画して動作を続けます。 + 理由はバックエンドの `GPUError()` で分かり、以後のフレームはすべて CPU フレームです。 +- **コスト(ソフトウェアのみ):** lavapipe は CPU ラスタライザーなので、GPU パスの CPU 時間は + CPU パスの約 10 倍です。1 フレームあたり、960 × 640 で 2.48 ms に対して 25.8 ms、 + 1920 × 1200 で 8.46 ms に対して 89.7 ms です(X11、Apple M4 Max 上の arm64 コンテナで + 16 スレッドの lavapipe)。実際の GPU で得になるかはまだ測定していません。 ## HiDPI {#hidpi} diff --git a/content/ko/modules.md b/content/ko/modules.md index 3436cc3a..314f464b 100644 --- a/content/ko/modules.md +++ b/content/ko/modules.md @@ -22,7 +22,7 @@ API 참조 문서는 릴리스된 태그를 따라가는 [pkg.go.dev](https://pk | [`lineedit`](https://github.com/go-widgets/lineedit) | v0.1.1 | 순수 모델로서의 줄 편집기: 기록, 역방향 검색, Tab 자동 완성; 표준 라이브러리만 사용 | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/lineedit) | | [`vcs`](https://github.com/go-widgets/vcs) | v0.1.0 | 작업 트리의 각 파일이 어떤 상태인지와 드라이버 레지스트리; 표준 라이브러리만 사용. git 드라이버는 중첩 모듈 `vcs/git`(`git/v0.1.0`) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/vcs) | | [`data`](https://github.com/go-widgets/data) | v0.4.0 | [타입이 있는 레코드, 쿼리, 로컬 또는 원격 저장소]({{< relref "/state/data.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/data) | -| [`window`](https://github.com/go-widgets/window) | v0.90.0 | 여덟 가지 백엔드를 지원하는 [네이티브 창]({{< relref "/surfaces/native-window.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/window) | +| [`window`](https://github.com/go-widgets/window) | v0.91.0 | 여덟 가지 백엔드를 지원하는 [네이티브 창]({{< relref "/surfaces/native-window.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/window) | | [`application`](https://github.com/go-widgets/application) | v0.8.1 | 창 위에 놓이는 [애플리케이션 수명 주기]({{< relref "/surfaces/application.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/application) | | [`tray`](https://github.com/go-widgets/tray) | v0.15.0 | [트레이 아이콘과 그 메뉴]({{< relref "/surfaces/application.md#the-tray" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/tray) | | [`webcanvas`](https://github.com/go-widgets/webcanvas) | v0.9.0 | [브라우저 ``에 그리는 장면]({{< relref "/surfaces/browser.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/webcanvas) | diff --git a/content/ko/surfaces/native-window.md b/content/ko/surfaces/native-window.md index 84ad6f16..9c3fc5aa 100644 --- a/content/ko/surfaces/native-window.md +++ b/content/ko/surfaces/native-window.md @@ -68,7 +68,25 @@ macOS에서는 `Config{GPU: true}`로 프레임을 GPU에서 그립니다. 0.59 ms, 1920 × 1200에서 5.96 ms 대신 0.99 ms입니다(Apple M4 Max). - **대체:** 반투명 머티리얼이 있는 창은 CPU 경로에 남고, Metal이 시작되지 않는 기기도 마찬가지입니다. 둘 다 오류가 아닙니다. 다른 백엔드는 이 옵션을 - 무시합니다. + 무시합니다(Linux는 아래 참조). + +Linux(X11과 Wayland)에서는 `Config{GPU: true}`로 프레임을 Vulkan으로 그립니다. +- **방식:** 같은 기록을 go-gfx/gpu2d의 Vulkan 렌더러가 그립니다. 그 픽셀은 창의 + 프레임버퍼로 복사되어 예전처럼 표시됩니다(X11은 MIT-SHM 또는 `PutImage`, + Wayland는 `wl_shm`). 프레임은 CPU를 한 번 거치며, dma-buf로 디스플레이 서버와 + 공유하는 것은 아직 없습니다. +- **정확성:** 소프트웨어 Vulkan(lavapipe)에서 픽셀은 CPU 경로와 바이트 단위로 + 같으며, 두 프로토콜 모두에서 실제로 증명했습니다. X 서버에서 다시 읽은 창과 + 창이 커밋한 `wl_shm` 버퍼가 CPU 경로의 것과 같습니다. 하드웨어 GPU는 아직 + 측정하지 않았습니다. +- **대체:** Vulkan을 쓸 수 없거나 프레임이 거부되면(장치에 비해 너무 큼, 장치 + 손실) 창은 CPU로 그리며 계속 동작합니다. 이유는 백엔드의 `GPUError()`가 + 알려 주고, 이후의 모든 프레임은 CPU 프레임입니다. +- **비용(소프트웨어만):** lavapipe는 CPU 래스터라이저이므로 GPU 경로의 CPU + 시간은 CPU 경로의 약 열 배입니다. 프레임당 960 × 640에서 2.48 ms 대신 + 25.8 ms, 1920 × 1200에서 8.46 ms 대신 89.7 ms입니다(X11, Apple M4 Max의 arm64 + 컨테이너에서 16 스레드 lavapipe). 실제 GPU에서 이득인지는 아직 측정하지 + 않았습니다. ## HiDPI {#hidpi} diff --git a/content/zh-cn/modules.md b/content/zh-cn/modules.md index ed7a0060..28cc865c 100644 --- a/content/zh-cn/modules.md +++ b/content/zh-cn/modules.md @@ -20,7 +20,7 @@ API 参考文档由 [pkg.go.dev](https://pkg.go.dev/) 根据源码生成,并 | [`lineedit`](https://github.com/go-widgets/lineedit) | v0.1.1 | 纯模型的行编辑器:历史记录、反向搜索、Tab 补全;只用标准库 | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/lineedit) | | [`vcs`](https://github.com/go-widgets/vcs) | v0.1.0 | 工作树中每个文件处于什么状态,以及驱动注册表;只用标准库。git 驱动是嵌套模块 `vcs/git`(`git/v0.1.0`) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/vcs) | | [`data`](https://github.com/go-widgets/data) | v0.4.0 | [带类型的记录、查询、本地或远程存储]({{< relref "/state/data.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/data) | -| [`window`](https://github.com/go-widgets/window) | v0.90.0 | 基于八种后端的[原生窗口]({{< relref "/surfaces/native-window.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/window) | +| [`window`](https://github.com/go-widgets/window) | v0.91.0 | 基于八种后端的[原生窗口]({{< relref "/surfaces/native-window.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/window) | | [`application`](https://github.com/go-widgets/application) | v0.8.1 | 位于窗口之上的[应用生命周期]({{< relref "/surfaces/application.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/application) | | [`tray`](https://github.com/go-widgets/tray) | v0.15.0 | [托盘图标及其菜单]({{< relref "/surfaces/application.md#the-tray" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/tray) | | [`webcanvas`](https://github.com/go-widgets/webcanvas) | v0.9.0 | [浏览器 `` 中的场景]({{< relref "/surfaces/browser.md" >}}) | [pkg.go.dev](https://pkg.go.dev/github.com/go-widgets/webcanvas) | diff --git a/content/zh-cn/surfaces/native-window.md b/content/zh-cn/surfaces/native-window.md index 97b5a1dc..21700592 100644 --- a/content/zh-cn/surfaces/native-window.md +++ b/content/zh-cn/surfaces/native-window.md @@ -60,7 +60,20 @@ return w.Run(root) // root is any toolkit.Widget - **开销:** 每帧占用的处理器时间在 960 × 640 下从 1.58 ms 降到 0.59 ms,在 1920 × 1200 下从 5.96 ms 降到 0.99 ms(Apple M4 Max)。 - **回退:** 带半透明材质的窗口仍走 CPU 路径,Metal 无法启动的机器也一样,二者都不算 - 错误。其他后端忽略此选项。 + 错误。Linux 见下文;其他后端忽略此选项。 + +在 Linux(X11 和 Wayland)上,`Config{GPU: true}` 使用 Vulkan 绘制帧。 +- **方式:** 同样的记录,由 go-gfx/gpu2d 的 Vulkan 渲染器绘制。它的像素被复制到窗口的帧缓冲区, + 并照旧呈现:X11 上用 MIT-SHM(或 `PutImage`),Wayland 上用 `wl_shm`。帧会经过 CPU 一次, + 目前还没有通过 dma-buf 与显示服务器共享。 +- **精确性:** 在软件 Vulkan(lavapipe)上,像素与 CPU 路径逐字节相同,并已在两种协议上实机证明: + 从 X 服务器读回的窗口,以及窗口提交的 `wl_shm` 缓冲区,都与 CPU 路径的一致。 + 尚未在硬件 GPU 上测量。 +- **回退:** 当 Vulkan 不可用,或某一帧被拒绝(对设备来说太大、设备丢失)时,窗口改用 CPU 绘制并继续运行。 + 原因由后端的 `GPUError()` 给出,此后的每一帧都是 CPU 帧。 +- **开销(仅软件):** lavapipe 是 CPU 光栅器,所以 GPU 路径占用的 CPU 时间约为 CPU 路径的十倍: + 每帧在 960 × 640 下为 25.8 ms 而不是 2.48 ms,在 1920 × 1200 下为 89.7 ms 而不是 8.46 ms + (X11,Apple M4 Max 上 arm64 容器中 16 线程的 lavapipe)。在真实 GPU 上是否划算尚未测量。 ## HiDPI {#hidpi}