You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following up on the discussion that happened on W3C Tag review on OffscreenCanvas. There were some concerns that commit() was a bit of a duplicate solution for the frame rendering problem.
The 3 main issues that emerged from this conversation were:
We don't want a separate mechanism to solve the same case that RequestAnimationFrame solves. Current commit() doesn't add new capabilities and solve the same problem as RAF.
We want a solution that addresses future needs by WebXR and friends.
We want to address WebAssembly's existing code bases need for a way to commit frames on a busy-loop.
Details can be found in the link, but in summary, we are proposing:
A new RequestAnimationProvider mixin that is implemented by Window, WorkerGlobalScope and eventually XRSession.
an OffscreenCanvasContext.commit() function that blocks until the UA is ready to start receiving commands for the new frame. This enables busy-loop on worker type of applications.
The writing is not spec ready, but we would really like to have input from @whatwg/canvas as soon as possible while we begin to implement those changes.
Another use case for an OffscreenCanvas would be to decode both specific time slice of one or more video files represented as ArrayBuffer (in addition to an HTMLVideoElement), possibly faster than real-time, returning only those portions of one or more files as ImageBitmaps.
Good point about the visible document thing. We don't really need that constraint. It just creates an explicit path to a display device that can provide a vsync heartbeat. But we don't need the connection to be that explicit.
Regarding AudioContext, we want to avoid using APIs for thing that were not their original purpose because it can lead to all sort unintended weird bugs. In this particular case, AudioContext is unable to apply GPU backpressure. This can cause the browser to hang if the app is pumping out rendering instructions faster than the GPU can process them. A purposely designed API on the other hand, can throttle down the frame rate when the GPU can't keep up, ensuring that the rendering backlog is never more than X frames behind.
an OffscreenCanvasContext.commit() function that blocks until the UA is ready to start receiving commands for the new frame. This enables busy-loop on worker type of applications.
This is very much unclear. Why do we want to block anything and possibly miss some frames if calculating a new frame after commit() returns takes too much time?
@smaug----, not sure if I get your question. We want to block because an application can generate frames much faster than the UA can consume, right? (either because of display sync, or because the UA is busy). This doesn't mean that the UA needs to block at all (it can triple or quad buffer), but that it CAN block if it's being overwhelmed by frames.
The way this was phrased was an attempt to capture a similar behavior to SwapBuffers on desktop graphics APIs.
aha, " it CAN block if it's being overwhelmed by frames." is the missing piece.
Not clear from 'an OffscreenCanvasContext.commit() function that blocks until the UA is ready to start receiving commands for the new frame. '
Activity
guest271314 commentedon Mar 22, 2018
At https://github.com/junov/OffscreenCanvasAnimation/blob/master/OffscreenCanvasAnimation.md
Why is a
<canvas>element within a visible document necessary?guest271314 commentedon Mar 22, 2018
Has
AudioContext(see https://stackoverflow.com/a/40691112) been considered for usage instead ofrequestAnimationFrame?guest271314 commentedon Mar 22, 2018
Another use case for an
OffscreenCanvaswould be to decode both specific time slice of one or more video files represented asArrayBuffer(in addition to anHTMLVideoElement), possibly faster than real-time, returning only those portions of one or more files asImageBitmaps.junov commentedon Mar 22, 2018
Good point about the visible document thing. We don't really need that constraint. It just creates an explicit path to a display device that can provide a vsync heartbeat. But we don't need the connection to be that explicit.
Regarding AudioContext, we want to avoid using APIs for thing that were not their original purpose because it can lead to all sort unintended weird bugs. In this particular case, AudioContext is unable to apply GPU backpressure. This can cause the browser to hang if the app is pumping out rendering instructions faster than the GPU can process them. A purposely designed API on the other hand, can throttle down the frame rate when the GPU can't keep up, ensuring that the rendering backlog is never more than X frames behind.
smaug---- commentedon Apr 24, 2018
This is very much unclear. Why do we want to block anything and possibly miss some frames if calculating a new frame after commit() returns takes too much time?
fserb commentedon Apr 24, 2018
@smaug----, not sure if I get your question. We want to block because an application can generate frames much faster than the UA can consume, right? (either because of display sync, or because the UA is busy). This doesn't mean that the UA needs to block at all (it can triple or quad buffer), but that it CAN block if it's being overwhelmed by frames.
The way this was phrased was an attempt to capture a similar behavior to SwapBuffers on desktop graphics APIs.
smaug---- commentedon Apr 24, 2018
aha, " it CAN block if it's being overwhelmed by frames." is the missing piece.
Not clear from 'an OffscreenCanvasContext.commit() function that blocks until the UA is ready to start receiving commands for the new frame. '
fserb commentedon Apr 24, 2018
Ahn, I see. I thought it was implied from the "is ready", but I'll clarify it on the draft change.
fserb commentedon May 9, 2018
Proposed change: #3677
Add requestAnimationFrame() in workers
Add requestAnimationFrame() in workers
Add requestAnimationFrame() in workers