Earlier quoted context omitted.
Unfortunately this isn't true anymore when you get to very high resolutions like 8k. Just clearing the framebuffer of an 8k display at 60hz requires ~6GB/s; about 1/10th of the theoretical memory bandwidth of modern desktop processors. Add in compositing for multiple windows, text rendering and none of that likely being multi-threaded it's pretty clear a CPU has no chance of keeping up.
But when you do software rendering you don't need to redraw the entire frame buffer, just the parts that changed, which can be very small even at 8k - e.g. the box of a checkbox being switched
Leveraging Rust and the GPU to render user interfaces at 120 FPS
111–120 of 212 posts
Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS
#112Earlier quoted context omitted.
Unfortunately this isn't true anymore when you get to very high resolutions like 8k. Just clearing the framebuffer of an 8k display at 60hz requires ~6GB/s; about 1/10th of the theoretical memory bandwidth of modern desktop processors. Add in compositing for multiple windows, text rendering and none of that likely being multi-threaded it's pretty clear a CPU has no chance of keeping up.
You are correct, but so is the comment you replied to. The latency that matters for a text editor is how long it takes for a new keypress to show up. And that's usually a 32x32 pixel area or less.
Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS
#113I 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!
I mean, the win16 api from ages ago had support for invalidating specific screen regions etc. It probably got lost somewhere in the transition to javascript...
Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS
#114Earlier quoted context omitted.
That is what wrappers and platform plugins are for, no need to build a full blown API from scratch.
Such solutions are often in tension between using only the lowest common denominator, and the code having different implementation for each platform anyway. For example, their editor has tabs for editor buffers. Cocoa has a static tabbed widget, which has wrong look and odd UX for this. Cocoa also has a tabbed window type, which isn't a widget you can control. I imagine it'd be hard to abstract that away to work cons…
For very contrived example, the cross platform settings panel widget exposes the business API required for settings in general, while the platform specific code takes care of using the host platform concepts to display and manage application specific settings.
While it is more work than lowest common denominator approach, it is still much less than re-inventing the wheel.
As proven by mobile OS platforms, there are still hope for native toolkits.
Lets see how much long the Web will hold, now that the revenge of plugins is here thanks WASM.
Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS
#115Wow, 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…
Windows uses GPU-based rendering in most/all of their GUI frameworks. Chrome also makes heavy use of hardware acceleration. Rendering performance isn't left to the window manager. If you're making your own GUI this is exactly the kind of stuff you need to do to make it fast.
Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS
#116Earlier quoted context omitted.
Accessiblity, designer,... and it isn't even the first, that is how GUIs used to be developed in 16 bit home computers for games. It is like static linking, it was also there decades ago. There are reasons why the world has moved on from those approaches.
What's your point? Static linking makes a ton more sense than dynamic linking, except in a few special case niches (like plugin systems). And OTH, event-driven UIs have also been around as long as UIs exist, that makes them at least as 'outdated' as immediate mode UIs.
Some of them keep being rediscovered in endless loops of fashion.
Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS
#117Earlier quoted context omitted.
I agree with your final statement and the seeming lack of research, but are you sure your characterization of JUCE is accurate? You’d surprise a lot of people if you were right about it using GPU acceleration for its UI framework. It does have an OpenGL container that fits into its view object hierarchy if you want to write your own accelerated component, but the rest of the UI is pretty much standard event-loop -> p…
Just checked and even without any additional setup JUCE is using CoreGraphics which is using Metal under the hood. So yes, the platform-specific renderer is using GPU. Also, you can use OpenGL for GUI compositing, too, not only as a 3D context.
Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS
#118Earlier quoted context omitted.
Unless you use Templeos your OS is already using gpu to do gui rendering and composing.
For one that's not entirely true. standard windows gui calls are backed by a shared surface and accumulate drawing instruction on the system side of the render surface,managed by the cpu render pipeline, so that they can keep a dirty rectangle list and only update the dirty areas of the gpu side of the shared surface. From there composing runs on the gpu. Then again the issue is the focus of rendering at 120fps.the r…
Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS
#119Earlier quoted context omitted.
Thanks, I'm reading the paper* linked to on that site explaining the technique used in the library. It's encouraging me more to pursue implementing a 2D render on the GPU. I'm also inspired by a recent talk about gkurve**. * https://jcgt.org/published/0006/02/02/ ** https://m.youtube.com/watch?v=QTybQ-5MlrE
Do note that as far as I know, this technique is patent-encumbered, at least in the US.
Re: Leveraging Rust and the GPU to render user interfaces at 120 FPS
#120Earlier quoted context omitted.
Just checked and even without any additional setup JUCE is using CoreGraphics which is using Metal under the hood. So yes, the platform-specific renderer is using GPU. Also, you can use OpenGL for GUI compositing, too, not only as a 3D context.
CoreGraphics doesn't use Metal. You're confusing it with CoreAnimation.