Live data from Hacker News

Leveraging Rust and the GPU to render user interfaces at 120 FPS

zed.dev

51–60 of 212 posts

Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS

#51
post #8

"Inspired by the gaming world, we realized that the only way to achieve the performance we needed was to build our own UI framework" I'm surprised you did not look at "Dear ImGui", "Noesis", and "JUCE". All three of them are heavily used in gaming, are rather clean C++, use full GPU acceleration, and have visual editors available. Especially JUCE is used for A LOT of hard-realtime professional audio applications. "Wh…

Maybe you need to add an "(in Rust)" to all these sentences? Sure there are C++ frameworks, but they probably wanted a pure Rust UI framework? My 2 cents: it's nice to have smooth rendering in your editor, but I'm currently mostly using a Java-based IDE (IDEA family), and it's responsive enough for my taste. If I were to use the current prototype of their editor, I'm afraid the usage of fixed-width fonts all over the…

Hey rob74! Antonio here, author of the post.

Zed is not constrained to use fixed-width fonts and supports all kinds of fonts, monospaced and variable-spaced alike (ligatures and contextual alternates included). Even though we use a glyph atlas, we rely on CoreText for shaping and rasterization (rendering sub pixel variants as well). In practice, this means that text is indistinguishable from a piece of text rendered by the operating system.

Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS

#52

Earlier quoted context omitted.

Not true, even if you add Rust. egui was released earlier: https://github.com/emilk/egui And egui isn't tied to Apple proprietary frameworks.

Afaik egui isn't doing any kind of the fancy GPU based 2D graphics this blog post is about though.

It uses glow, GL on whatever, so OpenGL when it exists.

Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS

#55
post #54

I don't understand. Why would you need to render a user interface constantly at 120 fps, instead of just updating it when something changes? Laptop batteries last too long these days? Electricity too cheap?

"Because it looks good" is probably the most popular reason.

Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS

#56
post #54

I don't understand. Why would you need to render a user interface constantly at 120 fps, instead of just updating it when something changes? Laptop batteries last too long these days? Electricity too cheap?

"Because it looks good" is probably the most popular reason.

But if nothing changes it looks as good at zero fps :)

Edit: Yay, it's a text editor. What happened to only redrawing the line that's being edited and the status indicators?

Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS

#57
post #54

I don't understand. Why would you need to render a user interface constantly at 120 fps, instead of just updating it when something changes? Laptop batteries last too long these days? Electricity too cheap?

Hey nottorp. Antonio here, author of the post.

Zed and GPUI use energy very judiciously and only perform updates when needed. The idea is that we can render the whole application within ~8ms, and that shows everywhere: from typing a letter to scrolling up and down in a buffer. However, if the editor is sitting there idle, we won't waste precious CPU cycles.

Thanks for the feedback!

Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS

#58
post #51
post #8

Earlier quoted context omitted.

Maybe you need to add an "(in Rust)" to all these sentences? Sure there are C++ frameworks, but they probably wanted a pure Rust UI framework? My 2 cents: it's nice to have smooth rendering in your editor, but I'm currently mostly using a Java-based IDE (IDEA family), and it's responsive enough for my taste. If I were to use the current prototype of their editor, I'm afraid the usage of fixed-width fonts all over the…

Hey rob74! Antonio here, author of the post. Zed is not constrained to use fixed-width fonts and supports all kinds of fonts, monospaced and variable-spaced alike (ligatures and contextual alternates included). Even though we use a glyph atlas, we rely on CoreText for shaping and rasterization (rendering sub pixel variants as well). In practice, this means that text is indistinguishable from a piece of text rendered…

Does your framework have any accessibility features? I'm a screen reader user and having responsive UI is wonderful as far as it is accessible at all.

Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS

#59
Wow, that’s some low level stuff. Most would just use an established UI framework because rendering performance is left to the window manager. I’m not sure I understand the need to go about it like this? Windows is not considered the epitome of performant interfaces but it has no trouble rendering UI’s at 120 fps. When people go and buy a 120 fps display, they are wowed by the smooth scrolling in a heavy application like Google Chrome. The window manager is already hardware accelerated (as for Windows since Vista) and the apps draw widgets on their surface.

Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS

#60

What's wrong with using platform APIs? I think that by 2023 most UI toolkits provided by the OS are hardware accelerated.

It’s hard to make a cross-platform UI that way.

But this UI is not cross platform either, as it is still using proprietary APIs.
Post reply on HN