News for hackers. Stuff that matters.
Re:Why modern software is slow by duped on Thursday September 29, 2022 @09:57PM (#33029952)
GPU accelerated vector graphics rendering is an open problem.
Re:Why modern software is slow by raphlinus on Thursday September 29, 2022 @10:10PM (#33030052)
For now.

Unfortunately, even if you have very fast drawing, there are plenty of other ways to make software slow. But high performance GUI software is the main thing I'm working on at the moment and I expect to have interesting results in the coming months. If nothing else, it should be a data point of how fast GUI software can be.

Re:Why modern software is slow by danielvaughn on Thursday September 29, 2022 @10:18PM (#33030103)
I’m super excited to hear about this. I’ve been working on a programming language for UI designers, and I ran into some massive issues when I tried to build my own renderer. Gave up and now I’m just transpiling to other languages instead.
Re:Why modern software is slow by jahewson on Friday September 30, 2022 @12:28AM (#33030942)
Eagerly awaiting this!
Re:Why modern software is slow by jcelerier on Thursday September 29, 2022 @11:44PM (#33030658)
Maybe basic productivity applications shouldn't try to tackle open research problems and instead just do the thing which has worked fine for the last 30 years which is CPU rendering? Like, do you think notepad is going to burn your battery because it redraws 20x20 pixels on every mouse event ?
Re:Why modern software is slow by jiggawatts on Thursday September 29, 2022 @10:38PM (#33030218)
It isn’t an open problem for text editors or terminals, which is the point Casey made in his videos.
Re:Why modern software is slow by naikrovek on Thursday September 29, 2022 @10:45PM (#33030276)
text editors and terminals don’t render vector graphics though, do they? they rely on libraries to rasterize glyphs of a font into a bitmap once and use the bitmaps over and over.
Re:Why modern software is slow by _gabe_ on Thursday September 29, 2022 @10:56PM (#33030346)
> they rely on libraries to rasterize glyphs of a font into a bitmap once

Unfortunately it's not this simple. Unicode and multilingual support means you can't possibly generate a single bitmap to contain all possible characters. Modern UIs (including text editors and terminals) generally support various zoom levels, which requires re-rasterizing glyphs at different zoom levels. This means you typically have to rasterize vector graphics (your font) on the fly as needed and then update your bitmap.

Edit: Also, emojis and certain scripts require composting multiple glyphs together. This means you have to figure out which glyphs are required for your codepoint and use your font metrics to composite the glyphs appropriately. Then throw in mathematical notation and all bets are off.

My point is, rendering text is not a simple done deal, but it's also not an impossible feat and it can be done efficiently.

Re:Why modern software is slow by naikrovek on Thursday September 29, 2022 @11:11PM (#33030438)
that is a very pedantic argument. you completely overlooked the point i was trying to make.

vector graphics are not rendered directly to the screen. fonts are rasterized first, then the rasterization is what the GPU receives.

Re:Why modern software is slow by rileyphone on Friday September 30, 2022 @12:52AM (#33031126)
> that is a very pedantic argument. you completely overlooked the point i was trying to make.

lmao welcome to HN, if you don't enjoy that experience I don't recommend you try to argue here.

Re:Why modern software is slow by _gabe_ on Thursday September 29, 2022 @11:45PM (#33030661)
> vector graphics are not rendered directly to the screen.

What difference does it make if you're caching the rasterization or not? You're still rendering vector graphics. And you're not just rasterizing once.

Modern font renderers can't get away with rasterizing glyphs once and reusing them anymore than arbitrary vector graphics renderers can. I sure hope my vector graphics editors cache the rasterizations instead of re-rasterizing needlessly.

Re:Why modern software is slow by naikrovek on Friday September 30, 2022 @12:23AM (#33030908)
once, twice, two hundred times, whatever.

it's not every frame. that's my point. that you missed twice because you can't see past details to the point of the statement.

Re:Why modern software is slow by audidude on Thursday September 29, 2022 @11:18PM (#33030489)
a huge amount of emoji are embedded png in font files. newer ones, however, do require more work.

> figure out which glyphs are required for your codepoint and use your font metrics to composite the glyphs appropriately.

this is all done in shaping though, the renderers just see "put this thing there" and (at least in GTK) we just maintain texture atlases that are updated on the fly.

you're correct that it doesn't solve the same glyph at lots of scales though. but glyphy does (and at high FPS too).

Re:Why modern software is slow by kilburn on Friday September 30, 2022 @01:27AM (#33031324)
GTK's implementation of text rendering is is admittedly broken in several subtle ways that nobody seems to know how to properly fix. [1] Also, this is while _not_ supporting fractional scaling, which is something that users definitely want.

To be clear, I'm not bashing on GTK. I'm saying that it definitely isn't as simple as the above comment implies ;)

[1] https://gitlab.gnome.org/GNOME/gtk/-/issues/3787

Re:Why modern software is slow by audidude on Monday October 03, 2022 @11:30AM (#33068905)
That issue is literally why I have a branch integrating GLyphy. But yes, your casual drive by comment is definitely more knowledgeable than the people who work on the stuff.
Re:Why modern software is slow by audidude on Thursday September 29, 2022 @11:14PM (#33030461)
harfbuzz creator made https://github.com/behdad/glyphy/ which i integrated into GTK a while back (but we don't ship currently, because we still do the bitmap stuff).

the bitmap stuff still has major drawbacks though, like maintaining grid alignments and pixel boundaries where as this stuff (mostly) goes away using glyphy.

still work to be done around hinting though (hence not merged).

Re:Why modern software is slow by userbinator on Thursday September 29, 2022 @11:25PM (#33030525)
You shouldn't even need a GPU for basic UI like this, especially with "modern" ultra-minimalist flat UIs.
Re:Why modern software is slow by vladvasiliu on Friday September 30, 2022 @12:39AM (#33031024)
Yeah, but they're not actually completely flat since they're translucent.

Also, on Windows, the "acrylic" thing is a circus show. Every app behaves differently. It also manages to sometimes lag on an RX5600. I know it's an "old" gpu, but still...

Re:Why modern software is slow by rayiner on Thursday September 29, 2022 @11:01PM (#33030377)
But you don’t have to do it every frame. Most apps could just render to bitmaps once and cache the results.
Re:Why modern software is slow by moonchild on Friday September 30, 2022 @12:44AM (#33031051)
It is being worked on (ahem...)

But in most contexts, it is not necessary to render vector graphics 'live'; caching is acceptable, so this should not be a bottleneck for most desktop software.

Re:Why modern software is slow by naikrovek on Thursday September 29, 2022 @10:08PM (#33030026)
is it? MacOS has rendered the entire UI via PDF since OSX was first released.
Re:Why modern software is slow by astrange on Thursday September 29, 2022 @10:47PM (#33030293)
It's not really PDF, it just supports similar operations to PDF. There's more SVG UI elements now.
Re:Why modern software is slow by naikrovek on Thursday September 29, 2022 @11:21PM (#33030498)
but it’s vector graphics, right?
Re:Why modern software is slow by astrange on Friday September 30, 2022 @12:37PM (#33037089)
Only very recently. Like, all that old Aqua stuff wasn't vectors, it was done in Photoshop.

Bitmaps are much faster to draw and can be made pixel-precise up front. With vectors it's easy to have pixel cracks or blurry lines because it's offset .5px.

Re:Why modern software is slow by naikrovek on Friday September 30, 2022 @05:20PM (#33040946)
> Bitmaps are much faster to draw and can be made pixel-precise up front.

yes, but that alone doesn't require that bitmap graphics be used.

> With vectors it's easy to have pixel cracks or blurry lines because it's offset .5px.

only if your renderer or your artwork isn't done correctly; inkscape used to be notorious for floating point rounding errors showing up with very few manipulations of a shape.

it's also been very easy to very quickly rasterize vector graphics for some time. maybe not fast enough in the past I guess, but computers are certainly fast enough now.

I look forward to a time when UIs are just all vector all the time, and it's the monitor itself which rasterizes, thanks to a program that the attached device uploads as it boots up or as the monitor is connected.

it's going to get more and more difficult to continue increasing display resolutions and refresh rates over long inexpensive cables if we continue to rasterize on a computer and push raw pixels to the display device.

Re:Why modern software is slow by danielvaughn on Thursday September 29, 2022 @10:14PM (#33030077)
afaik there just hasn’t been a lot of work done towards leveraging the GPU for vector graphics. The one example I can think of is the Slug library.
Re:Why modern software is slow by ehvatum on Friday September 30, 2022 @12:25AM (#33030921)
> afaik there just hasn’t been a lot of work done towards leveraging the GPU for vector graphic

Sure there has been, in the form of the nvidia path rendering extension. https://developer.nvidia.com/nv-path-rendering

It works great, on nvidia cards. Adobe Illustrator on Windows makes good use of it. Calling the extension from C/C++ and Python is no big deal.

Re:Why modern software is slow by djbusby on Thursday September 29, 2022 @10:22PM (#33030128)
Like? SVG UIs everywhere? Could you make a UI that's like SVG and onclick handlers do the "magic". We could have a VB6 like SVG UI designer and program "actions" in $LANG?
Re:Why modern software is slow by ygra on Friday September 30, 2022 @01:06AM (#33031212)
WPF would probably be that. In any case, modern UI toolkits often are vector-based anyway because of UI scaling. Heck, even ancient ones are, if you look at the Marlett font. That contained scalable UI elements for Windows 95.