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

Re: [Public WebGL] another proposal to temporarily expose some device/driver information only when really needed



If the main use case is to allow apps that can be implemented with
canvas2d to use that version when WebGL would otherwise run through
software rendering (which would be typically slower then on most
sensible configs, eg. because of fragment shaders processing), could
we 'simply' add a WebGL context attribute such as :

allowSoftwareRendering (default: true)
If false, if the browser cannot create a fully hardware-accelerated
context, the context creation fails (hence returns null).

Such apps would be able to do :

gl = canvas.getContext("experimental-webgl", {allowSoftwareRendering: false});
if (!gl) {
  // nevermind, we better use the 2d canvas then..
  ctx = canvas.getContext("2d");
}

I guess this would be a simple solution for the most common use cases,
which are now a bit problematic indeed (unless doing benchmarks during
startup phase of the app).

This would not solve more complex scenarios (eg. VTF slow) but those
would anyways require WebGL support (any VTF-using app probably cannot
be easily implemented with canvas2d...), so benchmarking for this use
case should be much less of a problem.

Thoughts?


On Thu, May 3, 2012 at 4:07 PM, Ashley Gullen <ashley@scirra.com> wrote:
> On 2 May 2012 21:47, Gregg Tavares (勤) <gman@google.com> wrote:
>>
>>
>>
>> On Wed, May 2, 2012 at 11:53 AM, Ashley Gullen <ashley@scirra.com> wrote:
>>>
>>> I think this is a great idea and I'm desperate for something like this.
>>>  Our engine implements both a WebGL and Canvas 2D renderer, and currently
>>> the Canvas 2D renderer is never used in Chrome 18 due to Swiftshader.  I am
>>> keen to fall back to Canvas 2D instead of using Swiftshader but there is no
>>> way to do that.
>>
>>
>> That's a little bit of an exaggeration. You can certainly choose Canvas 2D
>> at anytime. You run a small benchmark and switch.
>
>
> We don't make any particular game, we just make an engine.  Are you sure
> it's possible to make a benchmark script that is 100% accurate for all kinds
> of games with their varying performance profiles, and does not delay the
> start of the game by more than a second? How do you know if your benchmark
> is working properly?  What if one renderer runs faster in some places and
> slower in others, and the other renderer runs the opposite (faster where the
> other was slow, slower where the other was faster)?  Which renderer should
> be picked then?  I'd rather just say: use the GPU.
>
> Ashley

-----------------------------------------------------------
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
-----------------------------------------------------------