4 ms·
How similar/different is the OffscreenCanvas proposed spec from the CanvasProxy proposed spec? I thought there were going to be synchronization nightmares to C
by EdSharkey 11y ago
How similar/different is the OffscreenCanvas proposed spec from the CanvasProxy proposed spec? I thought there were going to be synchronization nightmares to CanvasProxy and that is why browser vendors avoided implementing it.
OffscreenCanvas appears to be a special canvas object that you can transfer to a web worker, draw to it there off of the DOM thread, and then "commit" the updates to the associated DOM Canvas.
Is the DOM canvas neutered after calling transferControlToOffscreen? Meaning, can you get a context and draw to the canvas concurrent with the Web Worker, or is the DOM Canvas inaccessible after control is transferred?
If it is the latter, then is this OffscreenCanvas just a WebGL-exclusive version of CanvasProxy? What are the characteristics of WebGL versus 2D-canvas API that make it conducive to Web Workerage? Not that I'm complaining, I just don't understand what's the difference.
I'm curious about how bad the synchronization issues are with OffscreenCanvas in this first implementation.
In any case, this may have incredible implications for mobile web game development if the experiment pans out, not to mention desktop games! Super exciting, I've been dreaming to be unshackled from the DOM thread for years. Thanks AGAIN, Mozilla!!
- ndesaulniers 11y ago> How similar/different is the OffscreenCanvas proposed spec from the CanvasProxy proposed spec? I thought there were going to be synchronization nightmares to CanvasProxy and that is why browser vendors avoided implementing it. I don't know enough about our graphics stack, or the CanvasProxy spec to answer that. I just try to show why people should be excited about the hard work done by Mozilla employees, contributors, and volunteers. Also, specs are not laws until they're candidate recommendations, and a lot will never be implemented. I should do a "how a bill becomes a law" post about web standards bodies... > Is the DOM canvas neutered after calling transferControlToOffscreen? Meaning, can you get a context and draw to the canvas concurrent with the Web Worker, or is the DOM Canvas inaccessible after control is transferred? Open your dev tools and find out. Fewer chars than your question typed out: a = document.createElement('canvas'), a.transferControlToOffscreen(), a.getContext('webgl') // null > Thanks AGAIN, Mozilla!! We've got your back, son.
- jgraham 11y ago> specs are not laws until they're candidate recommendations To be pedantic; web specs are (almost) never laws (occasionally some specs for e.g. a11y are incorporated by reference into other laws, but that typically doesn't affect implementors). This is more important than it sounds because people are occasionally confused into thinking that if they can get something written down in a spec and drive the spec through the W3C process people will somehow be forced to implement it. Even for specs that are implemented, the phases of the W3C process are actually mostly meaningless formalisms, and other bodies (e.g. WHATWG) work well without them. In practice a spec becomes "law" — i.e. immune from backwards incompatible changes — when there is enough content that depends on the existing behaviour that vendors won't unship it. For most cases this is more or less when there are two compatible implementations shipping, although of course the details very on a case-by-case basis.
- ndesaulniers 11y agoThat's not being pedantic, it's more accurate!