On Wed, Jun 11, 2014 at 12:55 AM, Jeff Gilbert <jgilb...@mozilla.com> wrote:
>
> What's the core problem trying to be solved here? It's either:
> A) We want a 2D graphics API in C++.
> or
> B) We want to make it easy to do 2D graphic in C++.
>
> The reason it feels like B implies A is that using libraries is a terrible
> pain.
> Fix the cause of the friction for using existing graphics APIs, instead of
> just
> treating the symptoms.
>

I agree. But are there, and this is a serious question, good 2D APIs for
C++ out there? If yes, and the committee is intent on putting *some* API
into the spec, wouldn't it make sense to at least try to convince them to
use that one? If no, again: serious question, why aren't there good APIs?


>
> >
> >
> > On Mon, Jun 9, 2014 at 11:38 PM, Jeff Gilbert <jgilb...@mozilla.com>
> wrote:
> >
> > > We also use Skia's GL backend on some platforms, and D2D on windows.
> > > They're strictly slower than reimplementing the app in WebGL.
> > >
> >
> > Which kind of app are you talking about here? All The Apps? Including
> every
> > single game ever made with Canvas2D?
> The short answer is 'yes, especially the games'. It has been an uphill
> battle
> to raise awareness of this in games, but the reality is that if you want
> performant graphics, don't use Canvas2D. Canvas2D should in fact be
> 'considered
> harmful' to performance, for most games.
>

And yet there are lots and lots of pretty complex all-vector games and
animations done in Flash, with many of them having been built in the 90s or
early 00s. Performance just isn't the only concern here: usability and
accessibility (for authors) is a substantial one, too. For the huge group
of amateur authors who don't have any meaningful knowledge of graphics
programming, just using some path drawing commands is just so, so much more
obvious than dealing with WebGL. Yes, frameworks can provide APIs for this.
The same is true for text input or forms or any number of other features
the web platform has built in.


> I'll note that in OpenGL, we used to have beginner-friendly APIs which
> allowed for
> drawing things vertex-by-vertex, and manipulating a primitive shading
> pipeline.
> But it was slow, and considered-harmful. Eventually, we managed to get rid
> of it.
> OpenGL is moving towards only offering a powerful base API. If you want an
> easier
> API, use a library.
>

OpenGL is a platform for domain experts. The web is not, and cannot be. If
we want the web as a platform to succeed, is has to be as approachable for
the masses as possible.


>
> >
> >
> > > > That is not true. For instance, do you think mozilla's shumway would
> be
> > > > better and reliable if it was written in WebGL?
> > > It depends on the primitives shumway receives. If Flash uses a 2d-like
> API
> > > like skia/cairo/etc., then it is probably not worth the effort to
> > > reimplement the awful-for-GL parts of those APIs.
> > > If there's some performant subset that can be identified, then yes,
> doing
> > > a WebGL path for that would have a higher performance ceiling.
> > >
> >
> > We (the Shumway team) looked into implementing all the vector stuff in
> > WebGL. We might end up using exactly this approach, but for the general
> > case we hope we can continue relying on Canvas2D. ("hope", because Flash
> > does some things that are hard to impossible to represent in Canvas2D.
> > They're not important for this discussion, though: the ability to
> > faithfully implement a legacy system isn't a good criterium for the
> quality
> > of, well, anything.)
>
> Ok, but aware that you are almost certainly leaving some performance on
> the table. (This
> is probably fine for Shumway though. Ideally people aren't authoring
> performance-sensitive Flash applications anymore)
>

I should've been more clear about this: we have two graphics backends, one
of which does what you described above: it renders shapes with Canvas2D and
uses them as textures in a WebGL-based compositor. We might end up doing
only that, but I kinda doubt it, as we need to be able to support horrible
scenarios such as ten banners on a website, three instances of which are
open in tabs at the same time.

We've been thinking about extracting the combination of a Canvas2D-based
renderer and a WebGL-based compositor into a library. It might be worth
conferring about that with graphics domain experts.


till
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to