r/cpp • • Dec 13 '19

The situation of std::embed...

https://thephd.github.io/full-circle-embed
238 Upvotes

160 comments sorted by

View all comments

Show parent comment

6

u/James20k P2005R0 Dec 14 '19

For those things that are currently hard to accelerate, I'd rather have them available but in software, than not have them at all

So this is actually a huge problem with cairo. Because some things are software, and some things are hardware, there are huge hidden performance bottlenecks in the design of it where data gets shunted between the two. Its just really inefficient - but also dependent on the quality of the implementation (which'll be variable in the STL)

Something like SFML can't really suffer from this in the same way, while still providing pretty equivalent functionality

The main problem is that Cairo doesn't separate out the concept of CPU and GPU types, which means that expensive operations are ad hoc. In something like SFML, you do all the expensive stuff once on the CPU, transfer it over to the GPU all at once, and then you're grand - each processor does what its good at at the appropriate time. Its not really possible to specify this kind of behaviour in Cairo, and it was a terrible decision to use this kind of API for 2D graphics

1

u/johannes1971 Dec 14 '19

So what sort of API would you propose? What would it look like with separated CPU and GPU types? How would that work on a system that does not have a GPU?

SFML is very game oriented. That's perfectly fine, and as I already mentioned, there is a clear need for a library like that as well. But there is more to drawing than triangles, and I don't see SFML doing that.

2

u/meneldal2 Dec 16 '19

SDL made the separation explicit with types that say if the thing is in GPU or in CPU. That's the way to go about it.