Re: exposing CANVAS or something like it to Web Workers

2013-02-20 Thread Kenneth Russell
[mailto:g...@google.com] Sent: Friday, February 8, 2013 3:14 AM To: Travis Leithead Cc: Ian Hickson; Charles Pritchard; Web Applications Working Group WG Subject: Re: exposing CANVAS or something like it to Web Workers On Thu, Feb 7, 2013 at 10:46 PM, Travis Leithead travis.leith

Re: exposing CANVAS or something like it to Web Workers

2013-02-08 Thread Gregg Tavares
Pritchard; Web Applications Working Group WG *Subject:* Re: exposing CANVAS or something like it to Web Workers ** ** I put up a new proposal for canvas in workers ** ** http://wiki.whatwg.org/wiki/CanvasInWorkers ** ** Please take a look. ** ** This proposal comes

RE: exposing CANVAS or something like it to Web Workers

2013-02-08 Thread Travis Leithead
: exposing CANVAS or something like it to Web Workers On Thu, Feb 7, 2013 at 10:46 PM, Travis Leithead travis.leith...@microsoft.commailto:travis.leith...@microsoft.com wrote: Having thought about this before, I wonder why we don’t use a producer/consumer model rather than a transfer of canvas

Re: exposing CANVAS or something like it to Web Workers

2013-02-07 Thread Gregg Tavares
I put up a new proposal for canvas in workers http://wiki.whatwg.org/wiki/CanvasInWorkers Please take a look. This proposal comes from offline discussions with representatives from the various browsers as well as input from the Google Maps team. I can post a summary here if you'd like but it

RE: exposing CANVAS or something like it to Web Workers

2013-02-07 Thread Travis Leithead
: exposing CANVAS or something like it to Web Workers I put up a new proposal for canvas in workers http://wiki.whatwg.org/wiki/CanvasInWorkers Please take a look. This proposal comes from offline discussions with representatives from the various browsers as well as input from the Google Maps team. I

Re: exposing CANVAS or something like it to Web Workers

2013-01-08 Thread Ian Hickson
On Wed, 2 Jan 2013, Gregg Tavares (社�~T�) wrote: Another issue as come up and that is one of being able to synchronize updates of a canvas in worker with changes in the main page. For 2D, the intended solution is to just ship the ImageBitamp from the worker canvas to the main thread via a

Re: exposing CANVAS or something like it to Web Workers

2013-01-03 Thread Gregg Tavares
On Wed, Jan 2, 2013 at 2:52 PM, Gregg Tavares (社用) g...@google.com wrote: Another issue as come up and that is one of being able to synchronize updates of a canvas in worker with changes in the main page. For a real world example see Google's MapsGL

Re: exposing CANVAS or something like it to Web Workers

2013-01-02 Thread 社用
Another issue as come up and that is one of being able to synchronize updates of a canvas in worker with changes in the main page. For a real world example see Google's MapsGL (http://support.google.com/maps/bin/answer.py?hl=enanswer=1630790) Apparently MapsGL uses 2 canvases and/or some DOM

Re: exposing CANVAS or something like it to Web Workers

2012-11-16 Thread Ian Hickson
On Mon, 14 May 2012, Gregg Tavares (�~K�) wrote: I'd like to work on exposing something like CANVAS to web workers. Ideally how over it works I'd like to be able to *) get a 2d context in a web worker *) get a WebGL context in a web worker *) download images in a web worker

Re: exposing CANVAS or something like it to Web Workers

2012-11-16 Thread Charles Pritchard
On Nov 16, 2012, at 1:50 PM, Ian Hickson i...@hixie.ch wrote: On Mon, 14 May 2012, Gregg Tavares (�~K�) wrote: I'd like to work on exposing something like CANVAS to web workers. Ideally how over it works I'd like to be able to *) get a 2d context in a web worker *) get a WebGL context

Re: exposing CANVAS or something like it to Web Workers

2012-11-16 Thread Ian Hickson
On Fri, 16 Nov 2012, Charles Pritchard wrote: http://lists.w3.org/Archives/Public/public-whatwg-archive/2012Nov/0199.html Seems like we might use requestAnimationFrame in the main thread to postMessage to the worker as an alternative to using setInterval in workers for repaints.

Re: exposing CANVAS or something like it to Web Workers

2012-05-23 Thread Robert O'Callahan
That sounds like a reasonable approach to me. One thing missing is that Workers would need something like requestAnimationFrame. Any proposal that requires passing messages to the main thread to get something on the screen fails to satisfy the huge need for games to be able to get steady frame

Re: exposing CANVAS or something like it to Web Workers

2012-05-16 Thread
So how to take this forward? My #1 priority is to get WebGL in workers. Lots of developers have expressed a need for this from decoding compressed textures in a worker to offloading thousands of draw calls per frame to a worker. WebGL already defines sharing mechanisms so at least for the WebGL

Re: exposing CANVAS or something like it to Web Workers

2012-05-16 Thread Kenneth Russell
On Wed, May 16, 2012 at 12:30 PM, Gregg Tavares (勤) g...@google.com wrote: So how to take this forward? My #1 priority is to get WebGL in workers. Lots of developers have expressed a need for this from decoding compressed textures in a worker to offloading thousands of draw calls per frame to

Re: exposing CANVAS or something like it to Web Workers

2012-05-16 Thread
On Wed, May 16, 2012 at 12:42 PM, Kenneth Russell k...@google.com wrote: On Wed, May 16, 2012 at 12:30 PM, Gregg Tavares (勤) g...@google.com wrote: So how to take this forward? My #1 priority is to get WebGL in workers. Lots of developers have expressed a need for this from decoding

Re: exposing CANVAS or something like it to Web Workers

2012-05-16 Thread Kenneth Russell
On Wed, May 16, 2012 at 1:11 PM, Gregg Tavares (勤) g...@google.com wrote: On Wed, May 16, 2012 at 12:42 PM, Kenneth Russell k...@google.com wrote: On Wed, May 16, 2012 at 12:30 PM, Gregg Tavares (勤) g...@google.com wrote: So how to take this forward? My #1 priority is to get WebGL in

Re: exposing CANVAS or something like it to Web Workers

2012-05-16 Thread Glenn Maynard
On Wed, May 16, 2012 at 2:30 PM, Gregg Tavares (勤) g...@google.com wrote: Some Ideas **) Create context in main page, pass to worker* Transferring an active context from one thread to another (at the implementation level) can be hard. It's much simpler to only create new the contexts in the

exposing CANVAS or something like it to Web Workers

2012-05-14 Thread
I'd like to work on exposing something like CANVAS to web workers. Ideally how over it works I'd like to be able to *) get a 2d context in a web worker *) get a WebGL context in a web worker *) download images in a web worker and the images with both 2d contexts and WebGL contexts Any thoughts?

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Anne van Kesteren
On Mon, May 14, 2012 at 10:01 PM, Gregg Tavares (勤) g...@google.com wrote: I'd like to work on exposing something like CANVAS to web workers. Ideally how over it works I'd like to be able to *) get a 2d context in a web worker *) get a WebGL context in a web worker *) download images

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Charles Pritchard
On 5/14/2012 1:01 PM, Gregg Tavares (勤) wrote: I'd like to work on exposing something like CANVAS to web workers. Ideally how over it works I'd like to be able to *) get a 2d context in a web worker *) get a WebGL context in a web worker *) download images in a web worker and the images

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Jonas Sicking
On Mon, May 14, 2012 at 1:16 PM, Anne van Kesteren ann...@annevk.nl wrote: On Mon, May 14, 2012 at 10:01 PM, Gregg Tavares (勤) g...@google.com wrote: I'd like to work on exposing something like CANVAS to web workers. Ideally how over it works I'd like to be able to *) get a 2d context

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Charles Pritchard
On 5/14/2012 1:16 PM, Anne van Kesteren wrote: On Mon, May 14, 2012 at 10:01 PM, Gregg Tavares (勤)g...@google.com wrote: I'd like to work on exposing something like CANVAS to web workers. Ideally how over it works I'd like to be able to *) get a 2d context in a web worker *) get a WebGL

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Glenn Maynard
On Mon, May 14, 2012 at 3:01 PM, Gregg Tavares (勤) g...@google.com wrote: I'd like to work on exposing something like CANVAS to web workers. Ideally how over it works I'd like to be able to *) get a 2d context in a web worker I'd recommend not trying to tackle 2d and 3d contexts at once

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Jonas Sicking
On Mon, May 14, 2012 at 3:28 PM, Glenn Maynard gl...@zewt.org wrote: On Mon, May 14, 2012 at 3:01 PM, Gregg Tavares (勤) g...@google.com wrote: I'd like to work on exposing something like CANVAS to web workers. Ideally how over it works I'd like to be able to *) get a 2d context in a web

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Glenn Maynard
On Mon, May 14, 2012 at 6:42 PM, Jonas Sicking jo...@sicking.cc wrote: If/when we do this, I think it should be done in such a way that the main window can't access the canvas object at all. Similar to what happens when an ArrayBuffer is transferred to a Worker using structured cloning. Once

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread
On Mon, May 14, 2012 at 4:42 PM, Jonas Sicking jo...@sicking.cc wrote: On Mon, May 14, 2012 at 3:28 PM, Glenn Maynard gl...@zewt.org wrote: On Mon, May 14, 2012 at 3:01 PM, Gregg Tavares (勤) g...@google.com wrote: I'd like to work on exposing something like CANVAS to web workers

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Boris Zbarsky
On 5/14/12 7:56 PM, Glenn Maynard wrote: A tricky bit: you need to know which element to sync to, so the browser knows which monitor's vsync to use. According to [1] only WebKit's requestAnimationFrame actually takes an element. (That's surprising; this seems obvious. Does WebKit actually

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Charles Pritchard
On May 14, 2012, at 4:42 PM, Jonas Sicking jo...@sicking.cc wrote: On Mon, May 14, 2012 at 3:28 PM, Glenn Maynard gl...@zewt.org wrote: On Mon, May 14, 2012 at 3:01 PM, Gregg Tavares (勤) g...@google.com wrote: I'd like to work on exposing something like CANVAS to web workers. Ideally how

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Boris Zbarsky
On 5/14/12 8:03 PM, Gregg Tavares (勤) wrote: var canvasSurface = new CanvasSurface(); var ctx = canvasSurface.getContext(2d); var pic = new Picture; pic.src = http://someplace.com/someimage.jpg;; pic.onload = function() { ctx.drawImage(pic, 0, ); } Let's assume you can instantiate these

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread James Robinson
On Mon, May 14, 2012 at 5:03 PM, Boris Zbarsky bzbar...@mit.edu wrote: On 5/14/12 7:56 PM, Glenn Maynard wrote: A tricky bit: you need to know which element to sync to, so the browser knows which monitor's vsync to use. According to [1] only WebKit's requestAnimationFrame actually takes an

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Boris Zbarsky
On 5/14/12 8:21 PM, Charles Pritchard wrote: SVG and animated gif would render the same as it would in an Image that has not been added to the dom or is otherwise display: none. I'm not sure that would be workable in a worker for SVG, for the same reasons that responseXML is not available in

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread
On Mon, May 14, 2012 at 5:12 PM, Boris Zbarsky bzbar...@mit.edu wrote: On 5/14/12 8:03 PM, Gregg Tavares (勤) wrote: var canvasSurface = new CanvasSurface(); var ctx = canvasSurface.getContext(2d)**; var pic = new Picture; pic.src =

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Charles Pritchard
On May 14, 2012, at 5:50 PM, Boris Zbarsky bzbar...@mit.edu wrote: On 5/14/12 8:21 PM, Charles Pritchard wrote: SVG and animated gif would render the same as it would in an Image that has not been added to the dom or is otherwise display: none. I'm not sure that would be workable in a

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Boris Zbarsky
On 5/14/12 8:55 PM, Gregg Tavares (勤) wrote: 1) Various canvas 2d context methods depend on the styles of the canvas to define how they actually behave. Clearly this would need some sort of changes for Workers anyway; the question is what those changes would need to be. Which

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Boris Zbarsky
On 5/14/12 8:58 PM, Charles Pritchard wrote: I agree... Can we get this off the main thread? Maybe. It would be pretty nontrivial in Gecko; last I looked it would be pretty painful in WebKit too. Can't speak for other UAs. Svg via image is not quite the same as svg via HTMLDocument (I

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread
On Mon, May 14, 2012 at 6:07 PM, Boris Zbarsky bzbar...@mit.edu wrote: On 5/14/12 8:55 PM, Gregg Tavares (勤) wrote: 1) Various canvas 2d context methods depend on the styles of the canvas to define how they actually behave. Clearly this would need some sort of changes for Workers

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Charles Pritchard
On 5/14/2012 6:08 PM, Boris Zbarsky wrote: On 5/14/12 8:58 PM, Charles Pritchard wrote: I agree... Can we get this off the main thread? Maybe. It would be pretty nontrivial in Gecko; last I looked it would be pretty painful in WebKit too. Can't speak for other UAs. Can it be pumped

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Boris Zbarsky
On 5/14/12 9:15 PM, Charles Pritchard wrote: On 5/14/2012 6:08 PM, Boris Zbarsky wrote: On 5/14/12 8:58 PM, Charles Pritchard wrote: I agree... Can we get this off the main thread? Maybe. It would be pretty nontrivial in Gecko; last I looked it would be pretty painful in WebKit too. Can't

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Charles Pritchard
On 5/14/2012 6:14 PM, Gregg Tavares (勤) wrote: On Mon, May 14, 2012 at 6:07 PM, Boris Zbarsky bzbar...@mit.edu mailto:bzbar...@mit.edu wrote: On 5/14/12 8:55 PM, Gregg Tavares (勤) wrote: 1) Various canvas 2d context methods depend on the styles of the

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Jonas Sicking
to work on exposing something like CANVAS to web workers. Ideally how over it works I'd like to be able to *) get a 2d context in a web worker I'd recommend not trying to tackle 2d and 3d contexts at once, and only worrying about WebGL to start. Another issue: rendering in a worker thread

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Charles Pritchard
On 5/14/2012 6:23 PM, Jonas Sicking wrote: This would also require some equivalent to requestAnimationFrame in the worker thread. Agreed! / Jonas I'm a bit lost-- wouldn't we just postMessage from the document over to the web worker when we want a refresh? I agree that we

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread
, May 14, 2012 at 3:01 PM, Gregg Tavares (勤) g...@google.com wrote: I'd like to work on exposing something like CANVAS to web workers. Ideally how over it works I'd like to be able to *) get a 2d context in a web worker I'd recommend not trying to tackle 2d and 3d contexts at once

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Charles Pritchard
On 5/14/2012 6:07 PM, Boris Zbarsky wrote: On 5/14/12 8:55 PM, Gregg Tavares (勤) wrote: 1) Various canvas 2d context methods depend on the styles of the canvas to define how they actually behave. Clearly this would need some sort of changes for Workers anyway; the question is what

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Boris Zbarsky
On 5/14/12 10:00 PM, Charles Pritchard wrote: What would web fonts do in this situation, in Mozilla? Probably cry. ;) If I've confirmed that a font is loaded in the main thread, would it be available to a worker for use in rendering? Not without some pretty serious reworking. Which

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Charles Pritchard
On 5/14/2012 7:09 PM, Boris Zbarsky wrote: On 5/14/12 10:00 PM, Charles Pritchard wrote: What would web fonts do in this situation, in Mozilla? Probably cry. ;) If I've confirmed that a font is loaded in the main thread, would it be available to a worker for use in rendering? Not

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Boris Zbarsky
On 5/14/12 10:18 PM, Charles Pritchard wrote: On 5/14/2012 7:09 PM, Boris Zbarsky wrote: On 5/14/12 10:00 PM, Charles Pritchard wrote: What would web fonts do in this situation, in Mozilla? Probably cry. ;) If I've confirmed that a font is loaded in the main thread, would it be available

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Charles Pritchard
On 5/14/2012 7:24 PM, Boris Zbarsky wrote: On 5/14/12 10:18 PM, Charles Pritchard wrote: On 5/14/2012 7:09 PM, Boris Zbarsky wrote: On 5/14/12 10:00 PM, Charles Pritchard wrote: What would web fonts do in this situation, in Mozilla? Probably cry. ;) If I've confirmed that a font is loaded

Re: exposing CANVAS or something like it to Web Workers

2012-05-14 Thread Boris Zbarsky
On 5/14/12 10:32 PM, Charles Pritchard wrote: Yes, I understand that. Canvas 2d text still needs to be able to do things like font fallback, shaping, bidi, etc, etc, etc. last I checked. Oh, the rendering isn't thread safe either? Right. The rendering involves access to style data