首页›Raph Levien›文章

Advice for the next dozen Rust GUIs

2022年7月15日

AI 摘要 AI 生成,可能有误

本文综述了 Rust GUI 开发碎片化的现状:egui、Iced、Druid 和 Slint 等工具包之间尚未形成共识,这主要是因为 GUI 设计涉及一个庞大且敏感的权衡空间,几乎没有显而易见的正确选择。作者认为,“原生”是一个令人困惑、因平台而异的术语,他建议转而依据具体标准来评估工具包,例如文本渲染、输入法、无障碍性和平台集成。文章还讨论了围绕 winit 和 druid-shell 等窗口库的基础设施层面的碎片化问题,以及依赖系统合成器的利弊权衡,呼吁开发者仔细考虑各种替代方案,并投入精力改进这一共享基础设施。

A few times a week, someone asks on the #gui-and-ui channel on the Rust Discord, “what is the best UI toolkit for my application?” Unfortunately there is still no clear answer to this question. Generally the top contenders are egui, Iced, and Druid, with Slint looking promising as well, but web-based approaches such as Tauri are also gaining some momentum, and of course there’s always the temptation to just build a new one. And every couple or months or so, a post appears with a new GUI toolkit.

This post is something of a sequel to Rust 2020: GUI and community. I hope to offer a clear-eyed survey of the current state of affairs, and suggestions for how to improve it. It also includes some lessons so far from Druid.

The motivations for building GUI in Rust remain strong. While Electron continues to gain momentum, especially for desktop use cases, there is considerable desire for a less resource-hungry alternative. That said, a consensus has not emerged what that alternative should look like. In addition, unfortunately there is fragmentation at the level of infrastructure as well.

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 Raph Levien

I want a good parallel computer

AI 摘要The article argues that GPUs, despite being 10-100x more powerful than CPUs, are prevented from becoming general-purpose parallel computers by an impoverished execution model and inadequate languages and tools, illustrated by the author's struggles with bounded memory in the Vello 2D renderer. Reviewing historical designs like the Connection Machine, Cell, and Larrabee, the author shows that promising parallel architectures existed but failed to catch on, leaving today's overly complex GPUs and limited AI accelerators. With workloads increasingly shifting toward compute, the author believes a simpler, more powerful parallel computer is possible and points to paths forward such as chips with large grids of CPU cores.

A note on Metal shader converter

AI 摘要The author critiques Apple's new Metal shader converter, which eases porting DirectX 12 games by translating DXIL/HLSL shaders to Metal, arguing it adds underspecified complexity rather than advancing robust GPU infrastructure. A key complaint is that Metal remains the only major GPU API lacking device-scope atomic barriers (present in HLSL since Direct3D 11 in 2009), which prevents single-pass prefix sum implementations and reliable cross-threadgroup coordination, and in turn holds back WebGPU's performance. The author recommends Apple document which HLSL features are unsupported, and points to WebGPU and Asahi Linux's work as more promising paths toward well-specified, portable GPU compute.

Simplifying Bézier paths

AI 摘要The article describes refinements to curve-fitting techniques for approximating arbitrary curves with near-optimal Bézier paths, implemented in the Rust library kurbo, built around a new ParamCurveFit trait and efficient error evaluation using Green's theorem area/moment prefix sums. It covers error metrics, favoring Fréchet distance approximated via Tiller-Hanson ray casting, with a slower but more robust arc-length approach used for 'spicy' high-curvature regions, and goes beyond simple adaptive subdivision by optimizing subdivision point placement to minimize segment count. Finally, it addresses an unexpected problem where aggressively Fréchet-optimized curves develop bumps, solved by penalizing extreme control-point configurations to keep the output smooth at a cost of only one additional segment.

Moving from Rust to C++

AI 摘要This is a satirical April Fools' post in which the author, a longtime Rust developer, mock-announces that the Linebender GUI projects will migrate from Rust to C++. In a deliberately persuasive style, the piece humorously dismisses memory safety concerns, praises C++'s abundance of build systems and rapid language evolution, and claims the C++ community is friendlier. The post is intended to satirize bad arguments commonly made against Rust, with the author noting afterward that its serious points and tone confused some readers.

Requiem for piet-gpu-hal

AI 摘要The article explains why the Vello 2D GPU renderer (formerly piet-gpu) abandoned piet-gpu-hal, its hand-rolled GPU abstraction layer, in favor of wgpu and the WebGPU/WGSL ecosystem. Although the custom layer achieved goals like precompiled shaders (saving binary size and startup time) and access to advanced GPU features such as subgroups and descriptor indexing, wgpu offers a better developer experience, community tooling, and web deployment. The author reflects on lessons learned, notes WebGPU pain points, and says the roadmap may eventually revisit precompiled shaders and native back-ends to regain those lost capabilities.