[whatwg] Hardware accelerated canvas

Rik Cabanier cabanier at gmail.com
Tue Sep 4 22:12:33 PDT 2012

Rereading the mail thread, it seems like most people want/can live with a
callback that informs the developer that the canvas needs to be recreated.

If the developer doesn't use this new feature, he will get current behavior
where the browser will do snapshotting at reasonable intervals (or fail
outright in extreme circumstances).
If the callback is set, the browser will not do any snapshotting and will
ask the user to re-render the canvas context after a context loss (or a low
memory situation). If there is a context loss during drawing, it's probably
reasonable to just ignore all drawing commands during that rendering pass
and ask for a re-render immediately afterwards.

Someone did bring up that more complex applications use off-screen canvas
elements. Those would need to set the callback as well to avoid having to
snapshot them.
A possible problem here is that the user would need to be intelligent and
not re-render everything every time the callback is executed.


On Tue, Sep 4, 2012 at 12:15 PM, Erik Möller <emoller at opera.com> wrote:

> On Tue, 04 Sep 2012 20:49:57 +0200, Kornel Lesiński <kornel at geekhood.net>
> wrote:
>  until improvements in OS/drivers/hardware make this a non-issue (e.g. if
>> the OS can notify applications before gfx context is lost, then browsers
>> could snapshot then and problem will be gone for good)
> We've just worked hard to get this behaviour into the GPUs to allow long
> running shaders to be terminated for security reasons so it's not likely to
> go away. Besides snapshotting right before a lost context doesn't help us
> at all. For all we know the GPU could be half way through rendering
> something when the event is triggered... even if we could read back the
> half rendered content in the rendertarget how do we generate the correct
> output from there? We'd have to take our DeLorian back to before the frame
> was started and replay the rendering commands.
> --
> Erik Möller
> Core Gfx Lead
> Opera Software
> twitter.com/erikjmoller

More information about the whatwg mailing list