News for hackers. Stuff that matters.
Re:WebGL in Web Workers by leeoniya on Tuesday July 22, 2014 @04:58PM (#8071519)
what would also be nice is shared read-only Canvas, etc. available in Web Workers so image processing (specifically analysis steps) can be paralellized without copying the entire canvas (or parts of it) through message passing.
Re:WebGL in Web Workers by satori99 on Tuesday July 22, 2014 @11:20PM (#8072753)
If you use Web Workers, you are going to have to use message passing. There is no other way to communicate with a Worker. There are no truly shared objects between js threads.

However, it is still possible to post binary data to a worker and back again without making a copy of it, by using Transferable Objects [1].

You simply have to provide an array of the arraybuffers to move as the second paramter to postMessage(). The caveat is that the data is no longer available to the posting thread after the postMessage call (TypedArray length will be zero).

[1] http://updates.html5rocks.com/2011/12/Transferable-Objects-L...

Re:WebGL in Web Workers by leeoniya on Tuesday July 22, 2014 @11:55PM (#8072841)
i'm aware of transferable objects, but it really defeats the purpose of parallelizing analysis of the same thing if that thing becomes unavailable to read after transfer. it would be great to just tell a worker to read a specific bounding box from an existing canvas without having to give up the canvas entirely or copying the bounding box contents into it.
Re:WebGL in Web Workers by satori99 on Wednesday July 23, 2014 @12:23AM (#8072904)
Yeah, that would be awesome. Probably not going to happen with actual DOM objects anytime soon.
Re:WebGL in Web Workers by sitkack on Tuesday July 22, 2014 @11:10PM (#8072729)
I feel like there needs to be a gamejam / instant runoff election of features for webworkers, so much opportunity is being squandered by what could be an elegant solution to many peoples' problems.