News for hackers. Stuff that matters.
Re:Fast 2D Rendering on GPU by chrisseaton on Sunday June 14, 2020 @04:40AM (#23516043)
> the other is lines, curves, thickness, gradients, and fonts

You can reduce all these to drawing triangles.

Re:Fast 2D Rendering on GPU by raphlinus on Sunday June 14, 2020 @10:10AM (#23517749)
> You can reduce all these to drawing triangles.

You can, people have tried this, and it sucks. The main problem is that the conversion of Bézier paths to triangles is a hard problem with lots of conditional branching. Even when you do it, there is the other problem of rendering triangles with really good antialiasing, MSAA forces a compromise between performance and quality. By contrast, piet-gpu does an exact-area calculation for antialiasing.

So it's not a question of whether you can do it, but whether it works well, and approaches like piet-gpu absolutely stomp triangles.

Re:Fast 2D Rendering on GPU by Const-me on Monday June 15, 2020 @01:46AM (#23524166)
> there is the other problem of rendering triangles with really good antialiasing

Easier than you think. Here's couple lines of pixel shader that does that, with really good antialiasing and without MSAA:

https://github.com/Const-me/Vrmac/blob/master/Vrmac/Draw/Sha...

Re:Fast 2D Rendering on GPU by Jasper_ on Sunday June 14, 2020 @09:32AM (#23517527)
Doing that reduction is surprisingly difficult, and usually a serial algorithm that runs on the CPU, and a naive approach is a resulting triangle set is not efficient to a GPU, but that's what toolkits like cairo, Direct2D, nanovg do.

Raph is describing an architecture where path evaluation happens on the GPU, without being baked to triangles.

Re:Fast 2D Rendering on GPU by dungdang on Tuesday June 16, 2020 @02:47AM (#23536554)
yes, you can draw 2d in 3d space. this thread however is about 3d being built on top of 2d. not 2d being built on top of 3d.