News for hackers. Stuff that matters.
Re:Leveraging Rust and the GPU to render user interfaces at ... by fxtentacle on Thursday March 09, 2023 @03:06AM (#35079218)
"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.

"When we started building Zed, arbitrary 2D graphics rendering on the GPU was still very much a research project."

What are you talking about? JUCE has had GPU-accelerated spline shapes and SVG animations since 2012?

BTW, I like the explanations for how they use SDFs for rendering basic primitives. But that technique looks an awful lot like the 2018 GPU renderer from KiCad ;) And lastly, that glyph atlas for font rendering is only 1 channel? KiCad uses a technique using RGB for gradients so that the rendered glyphs can be anti-aliased without accidentally rounding sharp corners. Overall, this reads to me like they did not do much research before starting, which is totally OK, but then they shouldn't say stuff like "did not exist" or "was still a research project".

Re:Leveraging Rust and the GPU to render user interfaces at ... by wnkrshm on Thursday March 09, 2023 @03:10AM (#35079239)
It's not the first text editor either, Sublime has GPU-accelerated rendering.
Re:Leveraging Rust and the GPU to render user interfaces at ... by fxtentacle on Thursday March 09, 2023 @03:20AM (#35079298)
Also, looking at their own performance numbers, it appears that all of this only managed to reduce the character insertion latency by 21% when compared to CLion. That's still useful, but maybe not even noticeable to the user.
Re:Leveraging Rust and the GPU to render user interfaces at ... by gizmo on Thursday March 09, 2023 @04:13AM (#35079550)
That latency can’t be render latency, because it’s trivial. It has got to be related to unifying the text buffer with the syntax tree. Otherwise you’ll get wrong syntax highlighting for a couple of frames and that’s jarring.
Re:Leveraging Rust and the GPU to render user interfaces at ... by swatcoder on Thursday March 09, 2023 @03:55AM (#35079456)
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 -> platform-API dispatch. It’s accelerated where the underlying platform-API is accelerated but not in any kind of explicit or fine-tuned way. The focus has always been more on portability than performance, even on the audio side.

(And of course the high-priority audio processing runs in an entirely segregated context from the UI, so the performance characteristics of the two pieces are decoupled anyway.)

Re:Leveraging Rust and the GPU to render user interfaces at ... by coldtea on Thursday March 09, 2023 @06:37AM (#35080292)
>I agree with your final statement and the seeming lack of research, but are you sure your characterization of JUCE is accurate?

That JUCE is "heavily used in gaming" for starters is widly innacurate

Re:Leveraging Rust and the GPU to render user interfaces at ... by fxtentacle on Thursday March 09, 2023 @08:10AM (#35080810)
I personally know multiple people using it in their games and game-related tooling and Roli (the company selling JUCE) even has an official Unreal Engine 4 plugin. So to me, it appears to be widely used.
Re:Leveraging Rust and the GPU to render user interfaces at ... by irh on Thursday March 09, 2023 @10:09AM (#35081962)
> Roli (the company selling JUCE)

I know it's tangential to the point that you're making, but JUCE was acquired by PACE in 2020.

Re:Leveraging Rust and the GPU to render user interfaces at ... by swatcoder on Thursday March 09, 2023 @10:22AM (#35082115)
JUCE is sold by Raw Material Software, which was purchased by PACE Anti-piracy, which is part of Avid.

There may be some people you know using JUCE for games, but it’s an odd choice.

Trying to figure out what you might mean, JUCE was involved with the BLOCKS SDK for Roli’s hardware peripherals, but again, that’s not really about gaming and definitely not about any familiar kind of gaming.

That said, I’m sure you’re relating the best information you have and very likely just transposed some detail by accident and are now caught in a relentless, exhausting online nitpick. We’ve all been there. If you figure out what it was, I’d love to hear it!

Re:Leveraging Rust and the GPU to render user interfaces at ... by coldtea on Thursday March 09, 2023 @11:35AM (#35083158)
Some people will also any available lib for games, doesn't mean it's "widly used". As for such a plugin, it's more like wishful thinking for getting gaming customers than actually something that sells in any amount to write home about.

The kind of games some tint amount of people make with JUCE is like this: https://ankuznetsov.wixsite.com/jucegames and even those are few and far between.

In any case, nowhere even close to "widly used" in gaming. Nor moderately used, or even low use.

"Few and far between users of JUCE for games, and even at that almost all of them using it for hobby casual game projects" is an accurate description.

JUCE does dominate in audio VST/AU fx/instruments GUIs though...

Re:Leveraging Rust and the GPU to render user interfaces at ... by fxtentacle on Thursday March 09, 2023 @08:16AM (#35080846)
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 ... by meindnoch on Thursday March 09, 2023 @09:37AM (#35081593)
CoreGraphics doesn't use Metal. You're confusing it with CoreAnimation.
Re:Leveraging Rust and the GPU to render user interfaces at ... by kridsdale1 on Thursday March 09, 2023 @09:45AM (#35081685)
I concur.
Re:Leveraging Rust and the GPU to render user interfaces at ... by fxtentacle on Thursday March 09, 2023 @12:54PM (#35084277)
JUCE has a CoreGraphicsMetalLayerRenderer which I understood as using Metal to render CoreGraphics paths.

https://github.com/juce-framework/JUCE/blob/4e68af7fde8a0a64...

Re:Leveraging Rust and the GPU to render user interfaces at ... by meindnoch on Thursday March 09, 2023 @02:15PM (#35085329)
Incorrect. Please read the code more carefully.

It uses CoreGraphics to render into a bitmap on the CPU, which is then uploaded into a Metal texture.

Re:Leveraging Rust and the GPU to render user interfaces at ... by Jasper_ on Thursday March 09, 2023 @09:56AM (#35081804)
CoreGraphics is a CPU rasterizer. It doesn't use the GPU.
Re:Leveraging Rust and the GPU to render user interfaces at ... by rob74 on Thursday March 09, 2023 @03:59AM (#35079479)
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 place (which I assume can be fixed, but may also be due to constraints of the UI framework?) would probably bother me more than the 120 FPS UI would impress me (assuming that I had a monitor that was fast enough, which I don't). On the plus side, it sounds like they support sub-pixel rendering - if that's the case, kudos to them!

Re:Leveraging Rust and the GPU to render user interfaces at ... by DeathArrow on Thursday March 09, 2023 @05:17AM (#35079878)
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.

Re:Leveraging Rust and the GPU to render user interfaces at ... by littlestymaar on Thursday March 09, 2023 @05:25AM (#35079918)
Afaik egui isn't doing any kind of the fancy GPU based 2D graphics this blog post is about though.
Re:Leveraging Rust and the GPU to render user interfaces at ... by pama on Thursday March 09, 2023 @07:01AM (#35080403)
It uses glow, GL on whatever, so OpenGL when it exists.
Re:Leveraging Rust and the GPU to render user interfaces at ... by littlestymaar on Thursday March 09, 2023 @08:43AM (#35081057)
That doesn't mean it's doing any kind of GPU acceleration of 2D graphics.

Given that they don't talk about it in the README, I'm pretty sure they don't.

Re:Leveraging Rust and the GPU to render user interfaces at ... by decremental on Thursday March 09, 2023 @08:57AM (#35081185)
I use egui. The library itself is agnostic but relies on backend libraries for rendering, all of which (or at least the official ones) render on the GPU.
Re:Leveraging Rust and the GPU to render user interfaces at ... by pzo on Thursday March 09, 2023 @09:54AM (#35081768)
have a look at what egui creator (and his team) been doing with rerun [0] Egui seems well suited to render even tens of thousands pointcloud with wgpu backend.

[0] https://www.rerun.io/

Re:Leveraging Rust and the GPU to render user interfaces at ... by wumpf on Tuesday March 14, 2023 @05:44AM (#35149176)
Rerun dev here :). Yes, we're using egui with its wgpu backend! As someone else pointed out it is backend agnostic - it essentially generates triangles & textures in GPU friendly way and passes those down to a backend implementation.

All the visualizations like the 3D scenes with point clouds etc. are rendered with our open-source in-house renderer ("re_renderer") which itself is then passing wgpu surfaces/commands to the egui wgpu backend that composites everything together then.

Re:Leveraging Rust and the GPU to render user interfaces at ... by as-cii on Thursday March 09, 2023 @06:53AM (#35080364)
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 ... by gostsamo on Thursday March 09, 2023 @07:06AM (#35080428)
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 ... by littlestymaar on Thursday March 09, 2023 @04:03AM (#35079496)
> What are you talking about? JUCE has had GPU-accelerated spline shapes and SVG animations since 2012?

I'm not familiar at all with JUCE, but the state of the art in GPU-accelerated 2D graphics has dramatically improved over the past 10 years so I doubt what JUCE did in 2012 is really comparable.

Re:Leveraging Rust and the GPU to render user interfaces at ... by fxtentacle on Thursday March 09, 2023 @08:26AM (#35080920)
I shipped a JUCE-based app in 2012 and back then it was "good enough" to have GPU-accelerated rendering of SVG icons moving around in realtime with antialiasing. Since we used their OpenGL context, we could even render the GUI inside customers' games for debug visualization.
Re:Leveraging Rust and the GPU to render user interfaces at ... by dorkwood on Thursday March 09, 2023 @04:09AM (#35079526)
> KiCad uses a technique using RGB for gradients so that the rendered glyphs can be anti-aliased without accidentally rounding sharp corners.

This is known as a “multi-channel signed distance field”, or “msdf”.

https://github.com/Chlumsky/msdfgen

Re:Leveraging Rust and the GPU to render user interfaces at ... by scotty79 on Thursday March 09, 2023 @09:02AM (#35081228)
Do you know any text editor that uses it for font rendering?
Re:Leveraging Rust and the GPU to render user interfaces at ... by fxtentacle on Thursday March 09, 2023 @01:10PM (#35084529)
You would have to use that if you want smooth antialiased zooming in and out of text.

BTW, the KiCad schematics are pretty text-heavy. You typically write down all the parameters and IDs of all the electrical components.

Re:Leveraging Rust and the GPU to render user interfaces at ... by rikarendsmp on Saturday March 11, 2023 @04:56AM (#35106955)
I used to use it, but its extremely font and glyph-sensitive wether or not it works. And if it doesn't work there is no easy fix (or ability to recognise it nonvisually)
Re:Leveraging Rust and the GPU to render user interfaces at ... by incrudible on Thursday March 09, 2023 @04:27AM (#35079632)
> KiCad uses a technique using RGB for gradients so that the rendered glyphs can be anti-aliased without accidentally rounding sharp corners

They are not using SDFs for the text, they render the glyphs at the specified font size directly.

Re:Leveraging Rust and the GPU to render user interfaces at ... by shultays on Thursday March 09, 2023 @05:20AM (#35079898)
ImGui is at least only used for debug rendering, not something that makes it to end user. At least in the small subset of companies I worked at.
Re:Leveraging Rust and the GPU to render user interfaces at ... by j-krieger on Thursday March 09, 2023 @05:31AM (#35079948)
You are correct. I've also encountered it sometimes in internal business gui wrappers.
Re:Leveraging Rust and the GPU to render user interfaces at ... by andersa on Thursday March 09, 2023 @06:09AM (#35080160)
I wonder if this is because the default theme for it is somewhat ugly, and most developers aren't designers to make it look better. It is perfectly capable of rendering standalone applications, if you want it to...
Re:Leveraging Rust and the GPU to render user interfaces at ... by marginalia_nu on Thursday March 09, 2023 @06:27AM (#35080252)
ImGui is amazing to work with though. Like holy fuck is it pleasant compared to basically every other UI-development paradigm ever in the history of user interfaces.
Re:Leveraging Rust and the GPU to render user interfaces at ... by jspdown on Thursday March 09, 2023 @07:19AM (#35080484)
Yes but that's because it's an immediate mode renderer.

It feels intuitive and that's why it's the de facto standard for building debug tooling. But this intuitiveness comes at a price! No matter how hard you try, this will always be slower and computationally heavy compared to retained mode.

Great for some stuff, terrible choice for some other.

Re:Leveraging Rust and the GPU to render user interfaces at ... by legosexmagic on Thursday March 09, 2023 @08:22AM (#35080877)
Your mixing up terms.

immediate mode rendering and immediate mode gui are unrelated. immediate mode gui libraries generally dont use immediate mode rendering because its realy slow.

immediate mode gui tends to be faster in practice because you just naturally end up with less code. also its very easy to write a retained mode ui ontop of an immediate mode gui library.

Re:Leveraging Rust and the GPU to render user interfaces at ... by flohofwoe on Thursday March 09, 2023 @09:09AM (#35081294)
The term "immediate mode UI" is about the API philosophy, not about how it works under the hood, and especially not how rendering is implemented (e.g. Dear ImGui records a command list for the whole frame which is then passed to the API user for rendering, this is pretty much the opposite of an 'immediate mode renderer').
Re:Leveraging Rust and the GPU to render user interfaces at ... by pjmlp on Thursday March 09, 2023 @07:48AM (#35080648)
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.

Re:Leveraging Rust and the GPU to render user interfaces at ... by flohofwoe on Thursday March 09, 2023 @09:03AM (#35081241)
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.

Re:Leveraging Rust and the GPU to render user interfaces at ... by pjmlp on Thursday March 09, 2023 @09:36AM (#35081584)
The industry has moved beyond past decisions for a reason, that is the point.

Some of them keep being rediscovered in endless loops of fashion.

Re:Leveraging Rust and the GPU to render user interfaces at ... by flohofwoe on Thursday March 09, 2023 @09:52AM (#35081751)
> Some of them keep being rediscovered in endless loops of fashion.

The reason for this is often that the environment (mainly the hardware) has changed so much that it may make sense to look into discarded old ideas again. For instance, dynamic linking was extremely important in the age of slow floppy discs and when RAM was counted in kilobytes, but those environmental factors are no longer an issue, and the advantages of static linking outweigh the disadvantages of dynamic linking again.

Re:Leveraging Rust and the GPU to render user interfaces at ... by CRConrad on Sunday March 19, 2023 @03:03PM (#35222302)
> The industry has moved beyond past decisions for a reason, that is the point.

And those “reasons” often SUCK; that is the point.

Re:Leveraging Rust and the GPU to render user interfaces at ... by flohofwoe on Thursday March 09, 2023 @09:02AM (#35081229)
ImGui is mainly used for debug rendering, but if you browse the screenshot threads, there quite a few 'end user applications' among them:

https://github.com/ocornut/imgui/issues/5886

Re:Leveraging Rust and the GPU to render user interfaces at ... by andrewmcwatters on Thursday March 09, 2023 @03:30PM (#35086253)
No, it's supposed to be used for this purpose.

> Dear ImGui is designed to enable fast iterations and to empower programmers to create content creation tools and visualization / debug tools (as opposed to UI for the average end-user). It favors simplicity and productivity toward this goal and lacks certain features commonly found in more high-level libraries.

It's literally not designed for end user consumption.

Re:Leveraging Rust and the GPU to render user interfaces at ... by ohgodplsno on Thursday March 09, 2023 @08:07AM (#35080787)
As for text rendering, Slug [0] has existed for much more than ten years, and is pretty much the gold standard for GPU text rendering.

[0] https://sluglibrary.com/

Re:Leveraging Rust and the GPU to render user interfaces at ... by bobajeff on Thursday March 09, 2023 @09:11AM (#35081312)
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

Re:Leveraging Rust and the GPU to render user interfaces at ... by ohgodplsno on Thursday March 09, 2023 @09:19AM (#35081402)
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 ... by bobajeff on Thursday March 09, 2023 @09:43AM (#35081666)
Thanks. I wonder what the patents cover. With all the work going into 2D rendering on the GPU I'd imagine others discovering similar methods.
Re:Leveraging Rust and the GPU to render user interfaces at ... by gabereiser on Thursday March 09, 2023 @08:48AM (#35081087)
The absolutism of some of their statements when we have 30 years of GPU research at our disposal is pretty eye-opening. I get that maybe this stuff didn't exist as a crate for rust but c'mon! Splines and shapes, glyph rendering, I wrote a game engine in C# back in 2007 that did all these things, and more. I like the explanation and the breakdown of SDFs for primitives but they are standing on the shoulders of giants and act like they're on an island.
Re:Leveraging Rust and the GPU to render user interfaces at ... by fallat on Thursday March 09, 2023 @08:58AM (#35081189)
I'm not even sure it was wise to use SDFs to draw some shaded rounded rectangles.
Re:Leveraging Rust and the GPU to render user interfaces at ... by kevingadd on Thursday March 09, 2023 @12:38PM (#35084038)
I use sdfs for my unified rasterization in my UI library and they definitely are not the optimal method from a performance standpoint. I've had to do a lot of tricky optimizations to get acceptable performance on low spec hardware.

I mostly stick with them because the flexibility and image quality feel worth it.

Re:Leveraging Rust and the GPU to render user interfaces at ... by Jasper_ on Thursday March 09, 2023 @09:53AM (#35081765)
When we talk about 2D graphics as a research problem, we're talking about native rendering of splines and strokes. JUCE does not have GPU-accelerated splines, it flattens the path to lines and rasterizes the coverage area into a texture that then gets uploaded to the GPU:

https://github.com/juce-framework/JUCE/blob/2b16c1b94c90d0db...

https://github.com/juce-framework/JUCE/blob/2b16c1b94c90d0db...

It also does stroke handling on the CPU:

https://github.com/juce-framework/JUCE/blob/2b16c1b94c90d0db...

Basically, this isn't really "GPU accelerated splines". It's a CPU coverage rasterizer with composting handled by the GPU.

Re:Leveraging Rust and the GPU to render user interfaces at ... by fxtentacle on Thursday March 09, 2023 @12:41PM (#35084080)
You linked to the compatibility-renderer. But JUCE also has platform-specific rendering modules.

CoreGraphicsContext::createPath will convert the CPU spline segments to CG spline segments which are then rasterized by CoreGraphics using Metal on the GPU.

https://github.com/juce-framework/JUCE/blob/2b16c1b94c90d0db...

Re:Leveraging Rust and the GPU to render user interfaces at ... by Jasper_ on Thursday March 09, 2023 @12:50PM (#35084210)
You mentioned using the OpenGL context, and this code is used by the OpenGL context.

CoreGraphics does not use the GPU.

Direct2D uses a approach which tesselates paths into triangles on the CPU. It is similar to the JUCE code in that the GPU is used for coverage, but it still does not natively render splines on the GPU.

Re:Leveraging Rust and the GPU to render user interfaces at ... by fxtentacle on Thursday March 09, 2023 @01:00PM (#35084374)
Juce has a CoreGraphicsMetalLayerRenderer which I believe uses Metal to render CoreGrapghics primitives.

And yes, I agree that JUCE will tesselate the splines into straight lines on the CPU. So technically, they are not fully rendered on GPU. But in practice, the slow rasterization is done on GPU while tesselation only has a negligible performance overhead. For example, I heard that UE4->UE5 removed the GPU tesselation support because it's usually easier to just DMA a new mesh from the CPU on-demand. I would treat that as a strong argument that CPU tesselation is practically never the bottleneck.

Re:Leveraging Rust and the GPU to render user interfaces at ... by Jasper_ on Thursday March 09, 2023 @01:15PM (#35084617)
> Juce has a CoreGraphicsMetalLayerRenderer which I believe uses Metal to render CoreGrapghics primitives.

This class is part of a JUCE demo app, and you can read the source code to it if you want. [0] It uses CoreGraphics to render the graphics on the CPU, and then uploads it as a texture to the GPU so it can be used as a CAMetal layer. So, no, the graphics are still rendered on the CPU, with compositing being handled on the GPU.

I don't know why you're confidently saying something incorrect, it took me all of 2 minutes to find the source code and read it.

> For example, I heard that UE4->UE5 removed the GPU tesselation support

I know it's confusing, but GPU tessellation is a completely different thing. The word "tessellation" in graphics means "turn into triangles". In a 2D graphics context, we're turning splines and curves and 2D shapes into triangles. In a 3D graphics context, GPU tessellation refers to a control cage mesh which is adaptively subdivided. These two have nothing in common except that triangles come out the other side. I am not aware of anyone who has tried to use GPU tessellation to render 2D graphics.

GPU tessellation failed for a large number of reasons, but poor performance was one of them. So, you know, doing this sort of work efficiently on the GPU is still an open research problem. Just because it's not efficient to do it on the GPU does not mean the performance overhead is negligible. For rendering big complex vector graphics, tess overhead can easily outweigh rasterization overhead.

[0] https://github.com/juce-framework/JUCE/blob/4e68af7fde8a0a64...

Re:Leveraging Rust and the GPU to render user interfaces at ... by fxtentacle on Friday March 10, 2023 @03:03AM (#35091760)
> I don't know why you're confidently saying something incorrect, it took me all of 2 minutes to find the source code and read it.

I'd say we just have different definitions of GPU-accelerated. Your position appears to be "purist" in the sense that almost all processing needs to happen on the GPU. But for me, if mostly static data is generated on the CPU once and then cached on the GPU and then processed on the GPU in all performance-critical contexts, then I would call that "GPU-accelerated" even if parts of the data preparation happened on CPU. That's also why I brought up the UE. They prepare the data on the CPU, then send it over to the GPU so that rendering in the real-time loop can happen only on the GPU. But the fact that the CPU prepared the data does not make it not-"GPU-accelerated" for me.

That said, can we agree that the ID2D1GeometrySink that JUCE uses on Windows is GPU-accelerated? Surely the Direct2D/DirectX drivers will do stuff on the CPU, but Microsoft says "Direct2D is a hardware-accelerated, immediate-mode 2-D graphics API" and they show very smoothly antialiased splines here while mentioning "Multisample Antialiasing", a GPU feature:

https://learn.microsoft.com/en-us/windows/win32/direct2d/dir...

Re:Leveraging Rust and the GPU to render user interfaces at ... by qbasic_forever on Thursday March 09, 2023 @10:51AM (#35082523)
Google has done a ton of work on GPU accelerated vector graphics too for Android and other platforms. Their skia library is pretty nice: https://skia.org/
Re:Leveraging Rust and the GPU to render user interfaces at ... by fxtentacle on Thursday March 09, 2023 @01:11PM (#35084547)
Oops I forgot to mention that one. They also have a pretty interesting cross-platform GUI framework using it: https://flutter.dev/
Re:Leveraging Rust and the GPU to render user interfaces at ... by EddieRingle on Thursday March 09, 2023 @06:33PM (#35088411)
And what was learned from Flutter has produced something I consider even more interesting: Compose UI (https://developer.android.com/jetpack/compose) and JetBrains' Compose Multiplatform (https://www.jetbrains.com/lp/compose-mpp/)
Re:Leveraging Rust and the GPU to render user interfaces at ... by EngManagerIsMe on Thursday March 09, 2023 @11:39AM (#35083212)
Meanwhile, the gaming world is moving to HTML/CSS/JS for game UI in many cases.
Re:Leveraging Rust and the GPU to render user interfaces at ... by TylerE on Thursday March 09, 2023 @03:28PM (#35086223)
I know of at least one shippping commercial game - in 2023 - that renders the UI using Adobe Flash.
Re:Leveraging Rust and the GPU to render user interfaces at ... by EngManagerIsMe on Thursday March 09, 2023 @03:50PM (#35086505)
That's super common. It was more common historically, these days it's largely gone away. (Scaleform was the technology that used flash for UI dev)
Re:Leveraging Rust and the GPU to render user interfaces at ... by kevingadd on Thursday March 09, 2023 @12:34PM (#35083965)
At least as far as dear imgui is concerned, it's an amazing library for dev tools but the accessibility story is dire and it has poor support for high quality typography, so it's a non starter if you're serious about good UI.

This is not to diminish the quality work that went into the library, but I passed over it for those and other reasons. I used nuklear for a bit since its typography was extensible but in the end it was too hard to overcome its other issues, so I use a custom mixed immediate/retained library now with rich text and accessibility support.

Re:Leveraging Rust and the GPU to render user interfaces at ... by mwcampbell on Thursday March 09, 2023 @03:53PM (#35086556)
> a custom mixed immediate/retained library now with rich text and accessibility support.

I'm always interested in learning about GUI toolkits that have accessibility support. What level of accessibility support does yours have? e.g. does it implement platform accessibility APIs, and if so, on which platforms? Is your library open source? If not, can I see it in action in any commercially available product? Thanks.

Re:Leveraging Rust and the GPU to render user interfaces at ... by kevingadd on Thursday March 09, 2023 @08:45PM (#35089436)
I haven't found good platform accessibility API bindings for C#, so right now it just has narration support, adjustable text size/contrast, and full keyboard navigation. I'm hoping that later on in my project's development process I'll have the budget to hire someone to try and fully integrate with the platform APIs - it's designed so it will be possible by pushing updates to the retained model.

The way it works is that it has an immediate mode API (see https://github.com/sq/Libraries/blob/0ca01d949e3df5fabb1440d... for a simple example of the API) and then under the hood it uses a lightweight retained-mode graph, which means that when it's more convenient you can just write more traditional classes and components. In practice most of the UI I've written for my main project is a mix of both models, like for example an editor popup window uses IMGUI-style API while the items in a virtual listbox are represented by a small custom component.

It does have a full imgui-style layout engine under the hood instead of doing retained-mode layout, so it's able to fully re-generate layout from scratch every frame, and to minimize page tearing there is a system where components can request a second relayout pass (typically used for things like text autosize).

Here's a more complex mixed-mode example from one of my development tools: https://gist.github.com/kg/6a6ba42d5019b546858a2b18751de019

Almost all of the on-screen elements in this footage are either immediate-mode or retained-mode UI using the library: https://www.youtube.com/watch?v=ey3FtFWxbhA

Re:Leveraging Rust and the GPU to render user interfaces at ... by mwcampbell on Friday March 10, 2023 @09:34AM (#35094723)
I think you might like AccessKit [1], once we figure out the best way to provide reasonably efficient .NET bindings. Basically it's an abstraction over the platform accessibility APIs, written in Rust. And it's specifically designed to be usable in immediate-mode GUIs (the first completed toolkit integration was in egui, a Rust immediate-mode GUI). You push tree updates, which can be full or incremental, and AccessKit retains the accessibility tree.

[1]: https://github.com/AccessKit/accesskit

Re:Leveraging Rust and the GPU to render user interfaces at ... by bsder on Thursday March 09, 2023 @06:08PM (#35088151)
> But that technique looks an awful lot like the 2018 GPU renderer from KiCad ;) And lastly, that glyph atlas for font rendering is only 1 channel? KiCad uses a technique using RGB for gradients so that the rendered glyphs can be anti-aliased without accidentally rounding sharp corners.

Is this stuff written down somewhere other than the code?

I use KiCad all the time and certainly never noticed this.