[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Disable software rendering





On Sun, Jun 19, 2011 at 10:00 PM, Oliver Hunt <oliver@apple.com> wrote:

>
> Or here's a different approach: add a new method on the Canvas element (so, alongside getContext) that would take two context ids and return a recommendation of which is likely to be faster for typical tasks that could be done with either.
>
> User code would look like:
>
> var contexttype = canvas.whichIsLikelyFaster("experimental-webgl", "2d");
> var context = canvas.getContext(contexttype);
>
> In this example, since the two strings are "experimental-webgl" and "2d", the question is which one is faster for things that can typically be done with either, which in this case means basic 2d graphics with sprites a la Angry Birds. Typically here one would return webgl if it's accelerated, 2d otherwise. My assumption here is that software WebGL renderers would have a hard time matching a good software canvas2d implementation, I could be wrong.

I don't really like this idea as it is basically assuming that the 2d context must be slower than the webgl context for some 2d scenarios.  I would argue that if there is a 2d use case where webgl is faster than the 2d context by a significant magnitude then that's an implementation problem in the UA, especially given all the reasons that can lead to a user being unable to use webgl (security black lists, etc)

I agree I don't like the idea but it's pretty obvious there are 2d use cases that are orders of magnitude faster in WebGL than 2d contexts because you can move the majority of your math to shaders and batch render 40000k sprites in 1 draw call in the same time you could get at most 1000-2000 using 1 ctx.drawImage per sprite.

See Mozilla's WebGL adaptation of the FishIE demo
 

--Oliver

>
> Benoit
> -----------------------------------------------------------
> You are currently subscribed to public_webgl@khronos.org.
> To unsubscribe, send an email to majordomo@khronos.org with
> the following command in the body of your email:
> unsubscribe public_webgl
> -----------------------------------------------------------
>

-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------