Blender's GPU Accelerated UI, Decoupled from it's original codebase. Supports Rust, Python, JS, React, C & C++. Twice as good as GPUI
docs: Linux frame pacing and GPU start
nusaturn1b534cc204ce
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1c8bf9a..f2dee2a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,8 +7,14 @@ All notable changes to **blenderui** (BUI). The format follows## [Unreleased]### Changed+- **Linux frame pacing:** an animation frame is due one refresh after the previous frame started, at the screen's refresh rate (XRandR). Before, the X11 loop slept 16.7 ms after each frame.+- **Linux GPU start:** the OpenGL context and device are created on a worker thread, as on Direct3D 11. The first frames draw on the CPU.- **Benchmarks on Linux:** `bindings/rust/bench/common/measure.rs` measures CPU time (`CLOCK_PROCESS_CPUTIME_ID`) and memory (`/proc/self/status`) on Linux, so `bui-bench`, `bench_frames` and `cargo test` build there; Windows is unchanged.+### Fixed+- **Rust windows:** a dirty window with a pending frame request waits for that frame instead of a 0 ms timer, so `requestAnimationFrame` callbacks run once per frame.+- **X11:** a frame callback that closes its window no longer renders into the closed window.+## [0.4.0] - 2026-11-06### Addeddiff --git a/README.md b/README.mdindex 06c2b2d..2619ece 100644--- a/README.md+++ b/README.md@@ -1049,7 +1049,8 @@ BUI has two renderers, and they draw **the same pixels**.Windows, a flip-model swap chain presents dirty rectangles. On Linux,`libGL`, `libEGL` and `libX11` are loaded at run time (GLX for windows, EGLfor offscreen), so no GL headers are needed, and BUI falls back to the CPU- where OpenGL is missing.+ where OpenGL is missing. On both platforms the device starts on a worker+ thread, and the first frames draw on the CPU.The shaders evaluate the software raster's formulas: the parity test finds 10of 172,800 pixels that differ by more than 3/255, on both backends.diff --git a/website/src/content/docs/concepts/damage-rendering.mdx b/website/src/content/docs/concepts/damage-rendering.mdxindex 80c2fba..2d498be 100644--- a/website/src/content/docs/concepts/damage-rendering.mdx+++ b/website/src/content/docs/concepts/damage-rendering.mdx@@ -62,7 +62,7 @@ On the full components demo (520×900, Ryzen 7 5800U laptop), that's the differeSome things do need frames over time: a panel collapsing, a CSS transition, a React app calling `requestAnimationFrame`. BUI renders frames **only while something animates**, and stops as soon as it's done.-- **Paced to the display.** On Windows, animation frames wait for the display's next refresh (`DwmFlush`), at its refresh rate. On Linux and macOS, the event loop paces them with a timer.+- **Paced to the display.** On Windows, animation frames wait for the display's next refresh (`DwmFlush`), at its refresh rate. On Linux, the next frame is due one refresh after the previous frame started, at the screen's refresh rate (XRandR), and the event loop waits for it. On macOS, the event loop paces them with a timer.- **Late frames don't wait.** A frame that's already late starts right away instead of waiting for another refresh.- **One rebuild per frame.** Rust and JavaScript rebuild the scene right before the render (`BK_window_request_frame` in C), so changes made in an animation callback join that same frame.- **Damage still applies.** If one cell of a grid animates, only that cell is redrawn each frame.diff --git a/website/src/content/docs/concepts/rendering.mdx b/website/src/content/docs/concepts/rendering.mdxindex 4aa064a..9a3740b 100644--- a/website/src/content/docs/concepts/rendering.mdx+++ b/website/src/content/docs/concepts/rendering.mdx@@ -90,7 +90,7 @@ The **GPU renderer** uses Direct3D 11 on Windows (`gpu_d3d11.c`) and OpenGL 3.3- **Same formulas, same pixels.** The pixel shader evaluates the software raster's coverage formulas. The `gpu_parity` test draws every primitive both ways and finds 10 of 172,800 pixels that differ by more than 3/255, on both backends.- **Atlases.** Text and other coverage masks share one 8-bit atlas, and images share one color atlas, so they're uploaded once and reused. Polygons are covered on the CPU and uploaded as masks.- **Damage still counts.** Frames render into a persistent target, so only damaged regions are redrawn. On Windows, presentation uses a flip-model swap chain with dirty rectangles, so the system compositor only recomposes what changed.-- **No waiting at startup.** On Windows, the device is created on a worker thread. The first frames are drawn on the CPU and the switch happens a few frames in. A lost device falls back to the CPU.+- **No waiting at startup.** The device is created on a worker thread, on both backends. The first frames are drawn on the CPU and the switch happens a few frames in. A lost device falls back to the CPU.- **No GL needed to build.** On Linux, `libGL`, `libEGL` and `libX11` are loaded when first used, never linked. Windows get a GLX context on the same X11 connection as the window; offscreen rendering (tests, screenshots) uses EGL, then a GLX pbuffer.- **No shader compiler needed.** The Direct3D shaders (`gpu/shaders/bui_ui.hlsl`) ship as precompiled bytecode, and the OpenGL side carries its GLSL translation in the source.diff --git a/website/src/content/docs/concepts/window-hosts.mdx b/website/src/content/docs/concepts/window-hosts.mdxindex e336327..c9185a5 100644--- a/website/src/content/docs/concepts/window-hosts.mdx+++ b/website/src/content/docs/concepts/window-hosts.mdx@@ -41,7 +41,7 @@ A plain Win32 window. Redraw requests coalesce into one render message, and the### Linux (X11)-The same API on Xlib. Button and key mapping follow Blender's `GHOST_SystemX11`. Damaged rectangles go to the window with `XPutImage`, or through GLX with the [GPU renderer](../rendering/). Timers, cross-thread wakes and frame pacing all run in one `select()` loop.+The same API on Xlib. Button and key mapping follow Blender's `GHOST_SystemX11`. Damaged rectangles go to the window with `XPutImage`, or through GLX with the [GPU renderer](../rendering/). Timers, cross-thread wakes and frame pacing all run in one `select()` loop. An animation frame is due one refresh after the previous frame started, at the screen's refresh rate (XRandR).Wayland sessions run it through XWayland, which every mainstream desktop provides.