Re:Leveraging Rust and the GPU to render user interfaces at ...
by ben-schaaf on Thursday March 09, 2023 @06:43AM
(#35080316)
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.
[ Parent
| on HN ]
Re:Leveraging Rust and the GPU to render user interfaces at ...
by fxtentacle on Thursday March 09, 2023 @08:29AM
(#35080942)
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 ...
by gizmo on Thursday March 09, 2023 @09:01AM
(#35081222)
That's not sufficient, though. You want the 0.1% case where you press undo a couple of times and big edit operations get reversed to be smooth. You have to hit your frame target when a lot is happening, the individual key press case is easy.
It's just like a video game. A consistent 60fps is much better than an average frame rate of 120fps that drops to 15fps when the shooting starts and things get blown up. You spend all the time optimizing for the worst case where all your caches get invalidated at the same time.
Re:Leveraging Rust and the GPU to render user interfaces at ...
by fxtentacle on Thursday March 09, 2023 @01:04PM
(#35084434)
In a video game, you'd just blur the shit out of everything else while you grant yourself a 2nd frame to re-render the rest of the content [1]. Or you do temporal remapping like the Oculus does if you rotate your head too quickly.
[1] https://developer.nvidia.com/blog/nvidia-vrss-2-dynamic-fove...
Re:Leveraging Rust and the GPU to render user interfaces at ...
by ben-schaaf on Thursday March 09, 2023 @09:23AM
(#35081443)
The other latency that matters is how long it takes to draw each frame when scrolling through the code, which is usually most if not all of the framebuffer.
Re:Leveraging Rust and the GPU to render user interfaces at ...
by fxtentacle on Thursday March 09, 2023 @01:06PM
(#35084457)
Agree. In that case, you need to cache the result of your CPU rendering in a GPU texture so that you can smoothly scroll it. But you can probably still get away with drawing all UI components on the CPU if you add a little bit of caching.
Re:Leveraging Rust and the GPU to render user interfaces at ...
by jcelerier on Thursday March 09, 2023 @09:04AM
(#35081250)
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
Re:Leveraging Rust and the GPU to render user interfaces at ...
by ben-schaaf on Thursday March 09, 2023 @09:20AM
(#35081411)
Scrolling requires redrawing most if not the whole framebuffer.
Re:Leveraging Rust and the GPU to render user interfaces at ...
by HideousKojima on Thursday March 09, 2023 @10:56AM
(#35082585)
With scrolling couldn't you just shift the existing framebuffer up/down and only draw the newly scrolled-to parts?
Re:Leveraging Rust and the GPU to render user interfaces at ...
by kevingadd on Thursday March 09, 2023 @12:40PM
(#35084072)
The GPU buffering model doesn't usually let you read the previous frame like that these days, so you would need a scratch surface. That increases your bandwidth and memory requirements, so shifting doesn't end up being much faster if it's faster at all.
Re:Leveraging Rust and the GPU to render user interfaces at ...
by TylerE on Thursday March 09, 2023 @03:31PM
(#35086263)
I suspect there are enough edge cases (semi-transparent things jumps to mind) that it's unlikely to be lossless, anyway.
Re:Leveraging Rust and the GPU to render user interfaces at ...
by kllrnohj on Thursday March 09, 2023 @11:29AM
(#35083075)
You don't need to redraw the entire framebuffer with GPU rendering, either. It's perfectly possible to do small, partial updates.
See for example https://registry.khronos.org/EGL/extensions/EXT/EGL_EXT_buff...
And https://registry.khronos.org/EGL/extensions/KHR/EGL_KHR_part...
Re:Leveraging Rust and the GPU to render user interfaces at ...
by CyberDildonics on Thursday March 09, 2023 @10:57AM
(#35082614)
You aren't talking about the same thing they are and you aren't talking about a scenario that exists. 8k is still exotic and no one is driving any desktop off of a video buffer going from main memory through a CPU.
Re:Leveraging Rust and the GPU to render user interfaces at ...
by ben-schaaf on Friday March 10, 2023 @04:51PM
(#35101625)
We've literally got an 8k screen in the office and 4k is becoming increasingly common. Not only is this a scenario that exists it's one I've personally experienced and fixed.
Re:Leveraging Rust and the GPU to render user interfaces at ...
by CyberDildonics on Friday March 10, 2023 @07:23PM
(#35103390)
Your 8k screen is run purely off of the CPU drawing to a frame buffer?