News for hackers. Stuff that matters.
Re:Ledit: Simple, GPU-rendered, no bullshit text editor by krona on Wednesday February 23, 2022 @08:00PM (#30448997)
This is using FreeType to CPU render to a text atlas, to be clear.
Re:Ledit: Simple, GPU-rendered, no bullshit text editor by deathanatos on Wednesday February 23, 2022 @09:44PM (#30449637)
But is this wrong?

I think the current implementation might have some bugs, but why not create an atlas? Especially for code, most of the characters will be in ASCII, and if they're not, you can always push what isn't dynamically as needed. Most of the rendering still occurs GPU side.

I suspect the post's code is also cheating on shaping, but even that seems like something you should be able to at least cache on the GPU?

Like the 98% of cases, the GPU, and if for the 2% oddball stuff, the CPU needs to step in, so what?

(Edit: perhaps I'm projecting the "wrong" part onto your comment; there's a lot of "why?" in these comments and the more I think about it, it honestly seems pretty sensible to push graphics to the *G*PU.)

Re:Ledit: Simple, GPU-rendered, no bullshit text editor by krona on Thursday February 24, 2022 @07:40AM (#30453968)
I'm just commenting on the extent to which it is 'GPU-rendered', which in this case is apparently no more than a standard text rendering facilities provided by the OS.

That's not to say it's not impressive considering how simple it is.

Re:Ledit: Simple, GPU-rendered, no bullshit text editor by liz3_de on Thursday February 24, 2022 @07:15PM (#30462175)
FreeType Renders a atlas which is then uploaded to the gpu within the ascii range, other characters are then lazy loaded into the buffer
Re:Ledit: Simple, GPU-rendered, no bullshit text editor by dahart on Wednesday February 23, 2022 @11:16PM (#30450195)
Isn’t that how more or less all editors render text, on the GPU and on the CPU?
Re:Ledit: Simple, GPU-rendered, no bullshit text editor by Pulcinella on Thursday February 24, 2022 @12:41AM (#30450851)
It’s possible to perform the rendering of the font itself on the GPU (e.g. Pathfinder) instead of rendering an atlas on the CPU and sending it over to the GPU, but I’m not sure of any text editors that do so.
Re:Ledit: Simple, GPU-rendered, no bullshit text editor by dahart on Thursday February 24, 2022 @12:45AM (#30450890)
Of course, it’s definitely possible. Just doesn’t seem like there are good reasons to spend time directly rendering the same font characters repeatedly, right? That’d be spending a lot of compute doing something you can pre-render and cache in a texture. ;) This is why a lot of CPU implementations render text atlases too.
Re:Ledit: Simple, GPU-rendered, no bullshit text editor by Pulcinella on Thursday February 24, 2022 @01:37PM (#30458440)
I suppose you could also pre-render to an atlas on the GPU.

I would also say, personally, there is something aesthetically pleasing about rendering vector graphics (fonts, SVG, etc.) on the GPU. “It’s a graphics processing unit, shouldn’t it be handling vector graphics as well?!” :)

Re:Ledit: Simple, GPU-rendered, no bullshit text editor by dahart on Thursday February 24, 2022 @01:44PM (#30458537)
Totally, you could. But in the case of a text editor, that would probably be purely to flex and not because it’s faster or better or easier, right?

People are definitely doing tons of vector rendering on the GPU. And the GPU is fantastic for vector graphics generally, mainly still because of the conversion to pixels. I posted links to Hughes Hoppe’s paper and the NV path rendering library, for example. Those can do font rendering as well, but I still wouldn’t use those for rendering fonts directly or for rendering text atlases because it would be difficult to implement.

Re:Ledit: Simple, GPU-rendered, no bullshit text editor by Vogtinator on Thursday February 24, 2022 @04:06AM (#30452529)
Yep, that's basically what glyph caches do.