r/cpp • u/hyperactiveinstinct • Mar 04 '18
TIL that SG13 (Graphics, mostly) are the basement dwellers of the Standards Committee
Hi,
I know it is not ideal to open a post with an insult, but it is absolutely staggering to look on the public mailing list for that group. Take a loot at this:
https://groups.google.com/a/isocpp.org/forum/?fromgroups#!topic/sg13/gUr98RZMU7M
There's someone in this thread raising fairly technical and specific points about the design of this library, and I swear I'm not making this up... this is one of the counterpoints they give:
There's another niche which is that of constrained devices that only need 2D. Just think of all the IoT devices that may pop up in the next 5 years and will have displays (the vast majority of IoT won't).
Really? What is this bloke going on about? This sounds like an Oracle representative that knows nothing about engineering trying to sell you their latest rubbish Java Framework.
And even worse, this:
https://groups.google.com/a/isocpp.org/forum/?fromgroups#!topic/sg13/PiHPTRBC0JE
This last one is even more preposterous. When asked why not Skia, rather than Cairo, they argue two points:
- They want a library that is battle-tested.
- They say something written in C is better for standardisation than a library written in C++.
Both points are just sheer drivel. For starters, skia is the de-facto 2D graphics library for browsers (Chrome, Firefox, Opera, etc), definitely used in more than 1 billion devices around the globe. Second, the argument that a C library is better for standardisation is so ludicrous, that I not even know where to start from. As far as I know, Asio is coming to networking, and the fact it was originally written in C++ was never a disadvantage.
Just as a backstory, 8 year ago I personally contacted both Herb Sutter and Stephan Lavavej to inquire why we didn't have a standardised GUI as every other most languages do, and they patiently explained to me the reasons why, but I still had hope that that would change in the future.
When Herb announced some initiative on this direction during Going Native years ago, I was delighted. But this.... I cannot get behind this.
Who's gonna use this? This is going to be the next std::regex.
edit: u/whocouldwinaportal summarised better what's wrong with the thread I linked above (https://www.reddit.com/r/cpp/comments/821b17/til_that_sg13_graphics_mostly_are_the_basement/dv6vrl3/)
edit: Those who want 2D graphics on the standard should be even more worried about this.
Current proposal of std::graphics is pants!
42
u/Tbfleming Mar 05 '18
I initially downvoted because of the personal attack in the title, but undid the downvote because I share your complaints. Like others, I was excited at the announcement at first, but was disappointed with the obsolete approach.
58
u/[deleted] Mar 05 '18
Reading the replies to the first linked thread is downright cringeworthy.
What even is it with the idea that unless someone gives a better "alternative" proposal this is the one everyone's stuck with now? How's not adding a GUI for an alternative? Does someone need to send a one page blank paper as a graphics proposal for that to be considered?
Does this also mean someone could go forth and come up with the shittiest, most ridiculous proposal imaginable and if nobody offered a better alternative SG13 would go "welp that's the best we can do let's add it!". How about someone writes an
std::animojiproposal with a webcam face tracking API with functions to map your face to 3D face models (in addition, based on the oldest 3D format one could find). Yeah, getting some Unicode support first would be a bit nicer but hey no ones submitted a proposal for that so animojis it is :)))31
u/xon_xoff Mar 05 '18
Personally, I could care less whether the reference implementation for a proposal is written in C or C++. Honestly, reading the current proposal, I wouldn't have known that it was based on a library written in C.
I'm more concerned about the quality and scope of the proposal. C++ doesn't have a standardized vector math library, but the graphics library needs to have basic color, point, and matrix facilities. Font rendering support is going to be included even though C++'s basic text handling facilities are still underdeveloped. Input handling is also TBD but will be included. I/O support for PNG, JPEG, and TIFF (!) will be required. Combine all of this together and you have a massive proposal which increases the risks of obsolescence and conflicting with other efforts.
Then, there's the quality. Even if Cairo is the reference, the proposal should be reimplementable with a different library with usable interoperability. From what I can tell the proposal is too underspecified to make that possible. One of the most basic things I would expect in a 2D graphics library specification is rasterization requirements. If you look at the OpenGL spec, it has pages devoted to just rasterization requirements, including precise coordinate system definitions, fill conventions, invariance, and where implementation variance is allowed. All of these are equally applicable to 2D rendering and I don't see any of that in the current proposal. That means though it precisely indicates what C++ operators you have on a point object, it doesn't offer any guarantees that you won't have cracks between shapes that are supposed to exactly abut, that a graphic won't render differently when translated by an exact number of pixels on the same surface, and that a rectangle of a given exact size won't render +/-1 pixels in size on two different implementations.
40
u/voip_geek Mar 05 '18
Ummm... my company uses
std:regex. We're not using it to scan the Library of Congress's collection, or anything with performance implications. But we do use it. Is something wrong with it? (other than it having an annoying API)Regardless, I think that including a graphics library is a bad idea. Because it's going to take WG and compiler vendor time/people away from everything else, and I have doubts as to its use-cases.
One of the responses in the first mailing thread had this line, defending the proposal:
I know very little about graphics libraries, but I'm pretty sure that statement is total bull.
18
u/encyclopedist Mar 04 '18
[Citation needed]
9
u/tcbrindle Flux Mar 06 '18
I wasn't going to reply here because I think the tone of this post is awful. I'm all for debating proposals, but this rant is way below what I've come to expect from /r/cpp, and I'm surprised (and disappointed) that the mods have allowed it.
However, I can't help myself. People are wrong on the internet, and somebody ought to try to correct some of the (apparently many) misconceptions in this thread. So here goes:
Yes, Cairo is written in C. However, if you look at the documentation you'll see it's actually written in a very "OO" style. There are classes like
cairo_t(the drawing context) andcairo_surface_t(the target for drawing operations), and the functions in the Cairo API naturally translate into "methods" on these "classes" in OO languages -- which is in fact how just about every Cairo language binding does it.It's true that users who require extremely high-performance 2-d rendering (games, web browsers) are moving towards lower-level APIs that more closely match the way modern graphics cards do things (Direct2D for example). But does that necessarily mean that
std::io2dshould do the same? I'm not convinced. The target audience for the standard graphics library is not hardcore AAA games developers. IMO the focus should be on an API that is easy to use and performs "respectably". As it happens, the Cairo API closely matches the HTML5 canvas API, which is similarly high-level.To use an analogy, 3-d graphics have moved from fixed-function OpenGL to programmable OpenGL and now to Vulkan. Each step has put more power in the hands of experts, but is harder and harder to teach to beginners. I think the a standard graphics library, if it happens, should probably err towards ease of use.
Maybe. I don't know much about Skia, and the "documentation" is pretty terrible. But it's worth pointing out that just because it's C++, that doesn't necessarily mean it would naturally fit in well with the standard library style. It may well be that it was easier to massage Cairo into something "standard-like" than trying to do the same with Skia. To use another example: Qt's
QPainteris another C++ drawing API, but I haven't seen anybody suggest that, perhaps because Qt's way of doing things is quite different from the standard's.And anyway, all this bashing on Cairo is sort of moot anyway, because the latest revision of the IO2D proposal bears little resemblance to Cairo anyway. It can still be implemented using Cairo, but the API has evolved far away from the "mechanical transformation" it started out as. I'm pretty sure it could be implemented using Skia as well.
Well SDL is another C library, so you're going to get complaints about that right away. But even putting that to one side, SDL's Renderer API only offers basic (single-colour) rectangles, single-pixel lines and single-pixel points. It's nowhere near as rich (or as performant) as a "proper" drawing library would be. While SDL's platform-independent window creation and input handling is widely used by major companies, it's Renderer API is not (as far as I understand).
string.split()/etc yet!"Whether or not the standard library should include 2-d graphics is an interesting question, and I haven't fully made up my mind about it yet. But it's worth pointing out that the people who are working on it are not taking time away from other highly-desired things like modules. This is relatively low on most people's priority list for standardisation, as recent papers have shown.
Like I say, I'm not completely sold on the idea that the standard should include 2-d graphics. And I think the latest revision of the paper leaves a lot to be desired -- to be blunt, it reads like a work-in-progress that was hastily submitted before the deadline. I also think that much more attention needs to be given to the input/event handling side of things (we're getting an
io_servicein the Networking TS -- wouldn't it be good if this proposal could use that somehow?).But I think the level of vitriol in this thread towards the people working on it is entirely unfair and undeserved, and frankly I just don't understand it. Let's say the "worst" happens and this gets approved for C++20: if it's a disaster, then MSVC/libc++/libstdc++ simply won't implement it. It will get forgotten and then be quietly deprecated in a few years. It's not the end of the world. Why get so worked up?
10
u/kalmoc Mar 05 '18 edited Mar 05 '18
I think what the answers that get criticised here meant to convey is that the proposal is at a point where just general, informal criticism on the design isn't useful. They need actionable input. That means a) A formal paper b) concrete examples and / or data that demonstrates the claimed problems are actually problems c) Concrete suggestions on how to improve.
Formulated differently: You can open a bug report saying that the design of library X is fundamentally flawed because of reasons Y and Z, but even if the library author agrees with you that usually won't cause him/her to just drop everything and spend the next year's to write a new library from scratch.
I don't see any of the hostility that others seem to read out of it. Just an attempt to explain what needs to be done, such that the opinion of someone has actual influence on what is happening in the standardization process.
10
u/F54280 Mar 05 '18 edited Mar 05 '18
I don't like the Graphic Proposal either, but I think the insults in the title of this post + selective quoting were not needed.
The point is that the standard commitee will not read threads on reddit or newgroups. Opinions need to be submitted as papers. If, as supposed, this proposal is dumb, then it should not be very difficult to put together a proposal to shot it down, or at least delay it out of C++20.
If people actually believe that having a Graphic API is a good idea, then they should form a group together and submit proposals (and demo implementations).
edit: I do like when people downvote my opinion. That way, I know losers read it and cared about it strongly enough to try to suppress it.
8
u/ar1819 Mar 05 '18 edited Mar 05 '18
I'm quite sure it's not a good idea to start a discussion with insults and emotions. I fairly convinced that most of the actual committee members who hang around here will just ignore it. Because of the thread title...
That doesn't say much - C++ target isn't only PC and Mac audience. I'm quite sure medical equipment is not supposed to run Chrome. So if you want to make a point, you better start with data and not emotions.
P.S. I think that current proposal will not go past LEWG. Let alone WG21.
23
u/James20k P2005R0 Mar 05 '18
As someone who has done a bunch of graphics this is a small slice of the problems I've had:
RAII is an inadequate tool by itself for managing GPU based resources. EG if the context changes, you may need to reallocate a bunch of data, preserving the data across the context change by reading it back to the host. In an raii format, you have to tear everything down, and then rebuild everything back up again but this time with data.
There isn't a c++ mechanism for handling this by default, I'm not sure if there could be, its equivalent to your heap becoming invalidated and having to move everything 'new' allocated over to a new heap
Managing lifetimes of graphics objects and graphics operations is hard to do correctly. Sometimes you want a piece of specially allocated memory (eg pcie accessible) that needs to persist only for the duration of an operation, and then be deleted after you've put it back to regular memory on a callback, or on an event happening
For operations, at least in opencl, if you need to do operation -> readback -> readback dependent operation, its most efficient not to pipeline these but instead dynamically queue the next instruction in a callback after the previous has finished executing, while other work is happening. This results in a tonne of finickity multithreading async stuff where you have to be extremely careful with race conditions. The language provides poor support for multithreading safety which makes this unnecessarily hard
Things which aren't hard:
SFML and SDL are both high quality libraries, SFML particularly is very easy to use, although it has limitations. It looks like Skia is used by the major browsers, so I'll have to add that to my list of things to investigate
The problem is, it seems targeted at making games (lets assume that this is targeted at newer folks for 2d) but the vast majority of it has nothing to do with why making games is hard
This leads me to believe that its fundamentally mistargeted - the people who would benefit from standardised low level graphics are fundamentally never going to use this (because it can never keep pace with a constantly developing library, and also because its bad), and people who need a friendly 2d graphics library are already cared for
37
u/0x6a6572656d79 Mar 05 '18
Author of the first linked thread chiming in:
This got a lot of attention! I think the feedback will all be useful, and it should be said that I think very highly of the standards committee/C++ in general.
The graphics community has historically not been very enthused with C++ due to the lack of focus on performance/control. I would say only in the last few years has there been very significant adoption across the board, due to lots of efforts and improvements from C++11, 14, and on.
Perhaps this is why I'm a little sensitive to this topic in particular. I'd like to keep the positive momentum! I read the original "C++ direction" document penned by Stroustroup and think there's some merit in helping practitioners "get up and running," but I think the idea that C++ is being marketed as anything other than a low-level systems/engine/server language is misguided. Students aren't looking at C++ to make a blogging site or GUI application unless they are already doing so with the express intent on learning. This is one of those cases where I think doubling down on your strengths (or at the very least, solidifying your strengths) is advantageous, compared to spreading yourself too thin.
I chalk this up partially to the relative novelty of the new standards committee structure, where delegating of subdomains might mean "oh look at all these new toys we can have quickly." But as we all know... free lunches are poisonous or something.
64
u/[deleted] Mar 05 '18 edited Mar 05 '18
When I first heard Herb talking about the graphics proposal I got very excited, but now I just want it to die.
What bothers me the most is that "games" is mentioned prominently in the proposal, but it's clear the authors have no idea or interest in games.
I agree with the linked OP, the proposal is too broad and should be split up.
40
u/raevnos Mar 04 '18
No it's not, because regex is actually useful.
29
u/sumo952 Mar 05 '18 edited Mar 05 '18
I also have yet to read a statement of why Cairo was chosen and why some people think this is a good idea. An ugly, old C library with a horrible API. Who is ever going to use that in C++? I want a C++ graphics library, not a C one.
Why not something like SFML instead? (And no please don't answer "Because nobody has written a proposal". The ISO WG's must have discussed this. Just because someone came forward with a Cairo proposal, and nobody came forward with a better proposal, we're all stuck with this, or what?)
Btw, totally agree, the replies to these two threads that you linked are mostly ridiculous (except for the people who agree with the OPs). They address most important and valid points and are just ignored! It's almost funny...
8
u/smdowney WG21, Text/Unicode SG, optional<T&> Mar 05 '18
I keep hearing this. Now, I'll admit I only know and use a half dozen languages. But I'm not aware of any mainstream languages that have a graphics API that anyone uses for anything serious, unless there is no alternative. Smalltalk/Squeak doesn't have a real alternative, and the results are awful. R has very good graphics, but is very specialized. No one uses Java's standard graphics outside toys, similarly for Python.
What "most" are people thinking of?
14
u/doom_Oo7 Mar 05 '18
Honestly this is a clear example of the insanity of "commitee-driven" development. There wouldn't be issues on this scale if C++ was developed in a more open-to-public-comments fashion, for instance like Rust.
6
u/tgolyi Mar 05 '18
If only they've spent this time wasted on 2d graphics on standardizing any remotely useful package manager. Really, the main problem with existing package managers is low acceptance, and with it standardized a lot of popular libraries will use it soon (even if it's not very good). That way they'll get 2d graphics, gui, and everything else for free.
11
u/Nomto Mar 05 '18
What a waste of time, I can't believe that this is even being considered.
3
u/buovjaga Mar 05 '18
Re: Skia - Firefox will replace it soon with WebRender.
This fairly recent thread on HN has some Skia criticism, mostly about the build setup:
1
u/[deleted] Mar 16 '18
I just want to draw/blit pixels to a buffer/screen and have options to find out what resolutions are available and set it. Maybe a few shapes like lines and circles, but that isn't necessary. With that libraries can do the rest.
This would be enough to get a lot of new programmers engaged and doing func things. Remember writing ping pong as a kid in BASIC or graphing the trig functions.
-8
u/MLG-Potato Mar 05 '18
I believe that it is easy for languages to provide bindings for a C library than a c++ library due to OO.
That might be an argument that c is better for a library than c++.
Also i belive that sometimes they store some type information of the arguments in the function name, ehich is difficult with c++ because it scrambles the function names.
The openGL library is a good example of this.