Re: Cairo being considered as the basis of a standard C++ drawing API
On Tue, Feb 11, 2014 at 8:23 PM, Botond Ballo bba...@mozilla.com wrote: I think at least one of the goals of the standard drawing API is to make C++ easier to learn by allowing people learning the language to create simple graphical applications without having to set up third-party libraries or learn a complicated API. I will ask for clarification at the SG 13 meeting (which I found out will be tomorrow afternoon) regarding the drawing API's goals, including whether high-performance applications are in scope. Are the advantages of a stateless API over a stateful API specific to high-performance applications, or are they more general? I would like to learn more about the tradeoffs between stateful and stateless drawing APIs. If anyone can point me to a resource about this, I would be grateful. http://robert.ocallahan.org/2011/09/graphics-api-design.html FWIW I don't think any of this affects Mozilla. We aren't going to use the standard C++ graphics library ... unless it ends up being Moz2D or something exactly like it :-). Rob -- Jtehsauts tshaei dS,o n Wohfy Mdaon yhoaus eanuttehrotraiitny eovni le atrhtohu gthot sf oirng iyvoeu rs ihnesa.rt sS?o Whhei csha iids teoa stiheer :p atroa lsyazye,d 'mYaonu,r sGients uapr,e tfaokreg iyvoeunr, 'm aotr atnod sgaoy ,h o'mGee.t uTph eann dt hwea lmka'n? gBoutt uIp waanndt wyeonut thoo mken.o w ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform
Re: Cairo being considered as the basis of a standard C++ drawing API
Robert O'Callahan wrote: asm.js code must go through Web platform APIs So the preference would be an API that translates easily to canvas-2D? -- Warning: May contain traces of nuts. ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform
Re: Cairo being considered as the basis of a standard C++ drawing API
It seems to me that we have arrived at the conclusion that a good drawing API should be mostly stateless (like Moz2D), instead of Cairo's stateful API. As a result we are currently removing all uses of the Cairo API and we will eventually remove Cairo from our codebase altogether (in favor of D2D via Moz2D on Windows and Skia via Moz2D elsewhere). The C++ CS is free to standardize whatever they like, but if they ask for our opinion we probably want to point them at Moz2D instead of Cairo. That having said, for maximum performance there is a fair amount of detailed knowledge callers need to have about the innards of Moz2D backends. You sometimes want to explicitly wrap a draw target around a texture and then use that texture in the compositor, etc. So I am not sure you can have a nice, non-leaky abstraction for 2D graphics in the language. My best guess is that whatever they standardize will end up not being useful for high-performance applications. In that case, I wonder why bother. A library really might do just fine here. My best guess is that whatever they standardize will end up not being useful for high-performance applications. In that case, I wonder why bother. A library really might do just fine here. I think at least one of the goals of the standard drawing API is to make C++ easier to learn by allowing people learning the language to create simple graphical applications without having to set up third-party libraries or learn a complicated API. I will ask for clarification at the SG 13 meeting (which I found out will be tomorrow afternoon) regarding the drawing API's goals, including whether high-performance applications are in scope. Are the advantages of a stateless API over a stateful API specific to high-performance applications, or are they more general? I would like to learn more about the tradeoffs between stateful and stateless drawing APIs. If anyone can point me to a resource about this, I would be grateful. Thanks, Botond ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform
Re: Cairo being considered as the basis of a standard C++ drawing API
It seems to me that we have arrived at the conclusion that a good drawing API should be mostly stateless (like Moz2D), instead of Cairo's stateful API. As a result we are currently removing all uses of the Cairo API and we will eventually remove Cairo from our codebase altogether (in favor of D2D via Moz2D on Windows and Skia via Moz2D elsewhere). The C++ CS is free to standardize whatever they like, but if they ask for our opinion we probably want to point them at Moz2D instead of Cairo. That having said, for maximum performance there is a fair amount of detailed knowledge callers need to have about the innards of Moz2D backends. You sometimes want to explicitly wrap a draw target around a texture and then use that texture in the compositor, etc. So I am not sure you can have a nice, non-leaky abstraction for 2D graphics in the language. My best guess is that whatever they standardize will end up not being useful for high-performance applications. In that case, I wonder why bother. A library really might do just fine here. Just my 2c. roc or Bas might have a more detailed opinion here. Andreas On Feb 9, 2014, at 11:29 AM, Botond Ballo bba...@mozilla.com wrote: The C++ Standards Committee is aiming to standardize a 2D drawing API in the post-C++14 timeframe. A study group (SG 13 - Graphics [1]) has been created to investigate possible approaches. SG 13 is considering using Cairo as the basis for a lightweight C++ drawing API [2] [3]. The idea would be to automatically wrap Cairo's C API into a C++ API without changing the semantics of the operations (see the last two pages of [2] for details). This sounds like the sort of thing we might be interested in / have an opinion on. Any thoughts? SG 13 will be meeting in Issaquah next week as part of the larger C++ Standards Committee meeting, which I will be attending. If anyone has thoughts on this proposal, I am happy to convey them at the study group's meeting. Thanks, Botond [1] http://isocpp.org/std/the-committee [2] http://isocpp.org/files/papers/N3825.pdf [3] http://lists.cairographics.org/archives/cairo/2013-December/024858.html ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform
Re: Cairo being considered as the basis of a standard C++ drawing API
I've already given my feedback on the cairo mailing list. Summary: Moz2D is the right thing for us, and probably for other application frameworks, but for applications that just want to draw their stuff on the screen or to print, cairo might be a better fit. Anyway ti doesn't really matter to us what the C++ people do. Rob -- Jtehsauts tshaei dS,o n Wohfy Mdaon yhoaus eanuttehrotraiitny eovni le atrhtohu gthot sf oirng iyvoeu rs ihnesa.rt sS?o Whhei csha iids teoa stiheer :p atroa lsyazye,d 'mYaonu,r sGients uapr,e tfaokreg iyvoeunr, 'm aotr atnod sgaoy ,h o'mGee.t uTph eann dt hwea lmka'n? gBoutt uIp waanndt wyeonut thoo mken.o w ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform
Re: Cairo being considered as the basis of a standard C++ drawing API
On Sun, Feb 9, 2014 at 2:38 PM, Robert O'Callahan rob...@ocallahan.org wrote: I've already given my feedback on the cairo mailing list. Summary: Moz2D is the right thing for us, and probably for other application frameworks, but for applications that just want to draw their stuff on the screen or to print, cairo might be a better fit. Anyway ti doesn't really matter to us what the C++ people do. It might matter to us in the context of asm.js. It seems likely that if something like Moz2D became the standard API then we'd be able to optimize it more easily than we'd be able to optimize an API that worked much differently than Moz2D. Also, if Moz2D seems like the right thing for other application frameworks too, then that is useful feedback to pass back to the C++ committee. Cheers, Brian ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform
Re: Cairo being considered as the basis of a standard C++ drawing API
On Mon, Feb 10, 2014 at 11:49 AM, Brian Smith br...@briansmith.org wrote: On Sun, Feb 9, 2014 at 2:38 PM, Robert O'Callahan rob...@ocallahan.org wrote: I've already given my feedback on the cairo mailing list. Summary: Moz2D is the right thing for us, and probably for other application frameworks, but for applications that just want to draw their stuff on the screen or to print, cairo might be a better fit. Anyway ti doesn't really matter to us what the C++ people do. It might matter to us in the context of asm.js. Yes, that's worth thinking about. It seems likely that if something like Moz2D became the standard API then we'd be able to optimize it more easily than we'd be able to optimize an API that worked much differently than Moz2D. No, because asm.js code must go through Web platform APIs, and the Web platform API you would implement cairo bindings on top of is canvas-2D, and that's fixed in stone --- and we have it implemented on top of Moz2D, and it works well, better than when we had canvas-2D implemented on cairo. Also, if Moz2D seems like the right thing for other application frameworks too, then that is useful feedback to pass back to the C++ committee. I did. Rob -- Jtehsauts tshaei dS,o n Wohfy Mdaon yhoaus eanuttehrotraiitny eovni le atrhtohu gthot sf oirng iyvoeu rs ihnesa.rt sS?o Whhei csha iids teoa stiheer :p atroa lsyazye,d 'mYaonu,r sGients uapr,e tfaokreg iyvoeunr, 'm aotr atnod sgaoy ,h o'mGee.t uTph eann dt hwea lmka'n? gBoutt uIp waanndt wyeonut thoo mken.o w ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform
Re: Cairo being considered as the basis of a standard C++ drawing API
On Sun, Feb 9, 2014 at 2:54 PM, Robert O'Callahan rob...@ocallahan.org wrote: On Mon, Feb 10, 2014 at 11:49 AM, Brian Smith br...@briansmith.org wrote: It seems likely that if something like Moz2D became the standard API then we'd be able to optimize it more easily than we'd be able to optimize an API that worked much differently than Moz2D. No, because asm.js code must go through Web platform APIs, and the Web platform API you would implement cairo bindings on top of is canvas-2D, and that's fixed in stone I don't think it is fixed in stone that asm.js code must go through Web Platform APIs. I believe the requirement is that it must be possible to translate asm.js code into Web Platform APIs in a way where the result works reasonably. AFAICT, there's nothing technically stopping us from implementing any kind of specially-optimized passthrough logic for any particular API, and also I think that idea is compatible politically with our stance on asm.js, compared to ActiveG. --- and we have it implemented on top of Moz2D, and it works well, better than when we had canvas-2D implemented on cairo. Good to know. Cheers, Brian ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform
Re: Cairo being considered as the basis of a standard C++ drawing API
On Mon, Feb 10, 2014 at 12:00 PM, Brian Smith br...@briansmith.org wrote: On Sun, Feb 9, 2014 at 2:54 PM, Robert O'Callahan rob...@ocallahan.org wrote: On Mon, Feb 10, 2014 at 11:49 AM, Brian Smith br...@briansmith.org wrote: It seems likely that if something like Moz2D became the standard API then we'd be able to optimize it more easily than we'd be able to optimize an API that worked much differently than Moz2D. No, because asm.js code must go through Web platform APIs, and the Web platform API you would implement cairo bindings on top of is canvas-2D, and that's fixed in stone I don't think it is fixed in stone that asm.js code must go through Web Platform APIs. I believe the requirement is that it must be possible to translate asm.js code into Web Platform APIs in a way where the result works reasonably. AFAICT, there's nothing technically stopping us from implementing any kind of specially-optimized passthrough logic for any particular API, and also I think that idea is compatible politically with our stance on asm.js, compared to ActiveG. One of the by-products of the Shumway project is going to be a fairly general-purpose framework for composition and layerization that we explicitly want to make useful for game development, too. It might be possible and useful to make it directly usable from asm.js code, too, though the exact shape this would have isn't immediately clear to me. ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform