This is "an entire doctoral research project in performant terminal emulation". https://github.com/microsoft/terminal/issues/10362#issuecomm...
Drawing Text Isn't Simple: Benchmarking Console vs. Graphical Rendering
21–30 of 42 posts
Re: Drawing Text Isn't Simple: Benchmarking Console vs. Graphical Rendering
#22I wonder how the GPU version is implemented. One quad and one texture draw per glyph sounds very not scalable, but one quad per terminal, one texture atlas and one shader to draw glyphs from the atlas already sounds much better.
~$ echo $((2 * LINES * COLUMNS)) triangles
34272 triangles
That's nothing for a modern GPU. For example, this benchmark[1] says to expect on the order of 10-800 million tri/s. At the low end of that, you'd have a frame time of 3.427ms -- 292 fps.The original Playstation could do 180 000 textured polygons per second[2], so it could've managed ~5 fps. Of course, you wouldn't render that many chars at its available output resolutions anyway. :)
[1] https://github.com/ctsilva/triangle-rendering-benchmarks#:~:... [2] https://en.wikipedia.org/wiki/PlayStation_technical_specific...
Re: Drawing Text Isn't Simple: Benchmarking Console vs. Graphical Rendering
#23Re: Drawing Text Isn't Simple: Benchmarking Console vs. Graphical Rendering
#24That’s more like the most conventional way to draw characters ever. Nobody goes around rendering filled Béziers any more than absolutely necessary. And conventionally conventionally, fonts were bitmaps in the first place!
Re: Drawing Text Isn't Simple: Benchmarking Console vs. Graphical Rendering
#25> So I tried something unconventional: draw each character once, cache it as a texture, and then just copy those textures around. That’s more like the most conventional way to draw characters ever. Nobody goes around rendering filled Béziers any more than absolutely necessary. And conventionally conventionally, fonts were bitmaps in the first place!
Makes me curious how much of computing is losing perceived speed because we have moved to calculating everything on the fly? Easy example is website layout. Yes, some dynamic sites need to calculate a ton on the fly. Most sites, though, probably don't need to reflow everything nearly as often as they do. And fitting everything into the mechanism that is the document flow remains baffling to me.
Re: Drawing Text Isn't Simple: Benchmarking Console vs. Graphical Rendering
#26https://github.com/Chlumsky/msdfgen
and
https://steamcdn-a.akamaihd.net/apps/valve/2007/SIGGRAPH2007...
The context is GPU's, things like three.js
But yes, drawing text is hard.
Re: Drawing Text Isn't Simple: Benchmarking Console vs. Graphical Rendering
#27I wonder how the GPU version is implemented. One quad and one texture draw per glyph sounds very not scalable, but one quad per terminal, one texture atlas and one shader to draw glyphs from the atlas already sounds much better.
A terminal maximized on my screen says: ~$ echo $((2 * LINES * COLUMNS)) triangles 34272 triangles That's nothing for a modern GPU. For example, this benchmark[1] says to expect on the order of 10-800 million tri/s. At the low end of that, you'd have a frame time of 3.427ms -- 292 fps. The original Playstation could do 180 000 textured polygons per second[2], so it could've managed ~5 fps. Of course, you wouldn't ren…
Re: Drawing Text Isn't Simple: Benchmarking Console vs. Graphical Rendering
#28This is "an entire doctoral research project in performant terminal emulation". https://github.com/microsoft/terminal/issues/10362#issuecomm...
I was wondering if Casey would end up a mention on this topic.
He used a cache. A simple hashtable. That's it. He got an absurd speedup of something like hundreds of times faster.
What are developers smoking these days that they can't even envision ever doing something like this without undertaking a research program?
To this day people will debate this, as if there's a valid debate to be had!
"No, no, no, it's premature to optimise software that is... being released to a billion users in production."
"Casey is adding unnecessary complexity that will be hard to maintain... by using a fraction of the code Microsoft did to solve the same problem."
"It must be full of errors... well... other than the superior Unicode compliance."
"It's so much longer to develop high-performance code... the evidence is that it took Casey two weekends to write a nearly complete terminal emulator!"
Etc...
Look where we are today. Microsoft still steadfastly refuses to even look at Casey's solution, let alone adopt it wholesale. Years later there are still blog articles being written about the performance issues of the Windows Terminal.
PS: Notepad and Calculator got the same "treatment" and now struggle to keep up with key presses.
Re: Drawing Text Isn't Simple: Benchmarking Console vs. Graphical Rendering
#29> So I tried something unconventional: draw each character once, cache it as a texture, and then just copy those textures around. That’s more like the most conventional way to draw characters ever. Nobody goes around rendering filled Béziers any more than absolutely necessary. And conventionally conventionally, fonts were bitmaps in the first place!
Bitmaps in ROM on early machines.