|
I fixed it. Those font rendering artifacts aren't there anymore, and it's still just as fast, except that now it takes an extra 200 milliseconds to start. It's using the same SDF rendering algorithm, it's just at a higher sample frequency and using a better approximation of the SDF. So, now, will you agree that you initial thesis was mistaken? That is, I will remind you, "Your [codedokode's] best case scenario [of on-CPU rendering] still doesn't achieve the minimum for a 4k120hz display. Take into account text with subpixel-antialiasing, and that resolutions scale to ok now and you'll quickly find CPU rendering unusably slow." Also, I think there are a number of fundamental misconceptions behind your comment, and I think it's worthwhile to try to correct them. — ⁂ — First, you say, "if you're able to render glyphs the same as [Microsoft] Windows or Linux", but Microsoft Windows and [the font rendering machinery generally used on] Linux don't render glyphs the same as one another. MacOS doesn't render them the same as either one of them. So your proposed criterion for minimal usability would reject MacOS. — ⁂ — Second, you complain that I am completely dismissing your point that "[I am] not rendering glyphs correctly." I'm dismissing your point because it is based on a basic misunderstanding. TrueType and similar outline-font formats define infinitely precise, mathematically-abstract letterforms made out of splines and straight lines. Computer screens, by contrast, can only display sampled approximations of those shapes. Worse, computer screens are fairly low-resolution (often only ≈150dpi, an order of magnitude worse than a garden-variety 600dpi laser printer and two orders of magnitude worse than high-quality 2400dpi printing), and they don't enjoy the high-quality analog antialiasing filtering that audio sampled systems virtually always employ. Furthermore, they are invariably run at nearly their maximum dynamic range, leading to clipping when they try to display signals with sharp steps in them, such as letterforms. Consequently, rendering letterforms on computer screens is always an exercise in balancing different kinds of imperfections. You can't sinc-filter those sharp edges because the Gibbs phenomenon demands that you go outside the dynamic range of the screen, unless you reduce the contrast ratio, significantly impairing readability. If you exploit subpixel antialiasing fully, you get color fringing. You need some kind of antialiasing filter in the digital domain, even if it's just a box filter, but that unavoidably reduces sharpness. Alpha compositing (Porter–Duff over), which is commonly used for blending text with a background, isn't correct either. It's an efficiency compromise which produces visible display artifacts, such as the so-called "conflation artifacts", under common circumstances. It's a good enough compromise for many situations, and it's much faster than, for example, supersampling antialiasing, but it's just an aesthetically acceptable compromise. It's not a standard of correctness. There is no such thing as correct rendering of letterforms on a computer display. There's only a choice of compromises. That's why macOS renders text differently from Microsoft Windows. It's not a question of correctness. It's a question of aesthetics. — ⁂ — Third, you said, "I don't understand how you can seriously claim that you've proven anything while you simultaneously admit to taking shortcuts that produce rendering artifacts." I am not sure if you were serious about this, but I am going to assume good faith and assume that you were, and explain the thing you claimed not to understand. What I said I had proven was that you were mistaken in "your objections about subpixel antialiasing, subpixel positioning, blending with the background, subpixel blending, the cache footprint of font atlases, and the cache footprint of display lists." Specifically, you brought these up as reasons that on-CPU rendering "still doesn't achieve the minimum for a 4k120hz display". The reason I was confident in claiming that, when I still had visible font rendering artifacts, was that none of those things have anything to do with letterform rasterization! The artifacts weren't in display list cache footprints or in text layout with subpixel positioning. So those parts of vriffle didn't need to change to fix the artifacts. — ⁂ — On my laptop, though, it's still slower than memcpy, taking about 4 milliseconds on one core for a 1080p frame filling the screen with text at a readable size. That's only about 25% of the speed of memcpy. But it's still not close to pegging the CPU. Updated screenshots and source code at https://canonical.org/~kragen/sw/vriffle/ |