3 ms·
Is is it practical to ignore / approximate / offload the complex edge cases?
by Scene_Cast2 4y ago
Is is it practical to ignore / approximate / offload the complex edge cases?
- Guzba 4y agoI want to say yes, but it depends on what you're actually doing as a final goal. Detecting when a path is antagonistic to most GPU approaches takes time, as does preparing the data however it needs to be prepared on the CPU before being uploaded to the GPU. If you can just fill the whole thing on CPU in that time, you wasted your time even thinking about the GPU. If you can identify a simple case quickly, it's probably totally a good idea to get the path done on the GPU unless you need to bring the pixels back to the CPU, maybe for writing to disk. The upload and then download can be way slower than just, again, filling on CPU. If you're filling on GPU and then using on GPU (maybe as a web renderer or something), GPU is probably a big win. Except, this may not actually matter. If there is no need to re-render the path after the first time, it would be dumb to keep re-rendering on the GPU each frame / screen paint. Instead you'd want to put it into a texture. Well.... if you're only rendering once and putting into a texture, this whole conversation is maybe pointless? Then what is simple is probably the best idea. Anyway lots to 2d graphics that goes underappreciated!
- bsder 4y agoNo, mostly it is not practical to offload the edge cases. The reason for this is that the single 2D application that people most want to speed up is font rendering. And font rendering is also the place where the edge cases are really common. Rendering everything else (geometric shapes) is trivial by comparison.
- tayistay 4y agoWhy is that? Glyphs can be cached in a texture. That's what nanovg does and it works quite well. That's what my little library does too (https://github.com/audulus/vger https://github.com/audulus/vger)
- moonchild 4y agoDoesn't work in the face of real-time dynamic transforms; 3-d, smooth zoom, etc. Atlases are also a bit heavy, so now you need a cache replacement policy, and you have annoying worst-case performance...
- bsder 4y agoOnly if you give up doing any script-based languages even remotely properly. And, it really doesn't even work in character-based languages with heavy kerning. Text rendering is really complicated. There is a reason why we have so few text shaping engines.