[Webkit-unassigned] [Bug 234920] New: ImageBitmap has poor performance on iOS

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 6 06:33:54 PST 2022


https://bugs.webkit.org/show_bug.cgi?id=234920

            Bug ID: 234920
           Summary: ImageBitmap has poor performance on iOS
           Product: WebKit
           Version: Safari 15
          Hardware: iPhone / iPad
                OS: iOS 15
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Canvas
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: simontaylor1 at ntlworld.com
                CC: dino at apple.com

My goal is to "snapshot" the current frame of a video element into an object that can then be efficiently used in other canvas contexts (multiple WebGL contexts for example).

ImageBitmap feels like the right API to be leveraging for this - it seems the intention is that ImageBitmap is the way to pass around the content of canvases and consume them cross-context (at least the use of it for OffscreenCanvas suggests that to me).

Consider a frame loop something like this:

function drawFrame() {
  if(latestFrame) {
    gl1.texUpload2d(..., latestFrame);
    gl2.texUpload2d(..., latestFrame);
    latestFrame.close();
    latestFrame = null;
  }

  createImageBitmap(video).then(ib => {
    if(latestFrame) latestFrame.close();
    latestFrame = ib;
  });
}

Unfortunately the iOS ImageBitmap implementation makes things much slower going this route vs just a direct texImage2d of the video element.

I've also tried using drawImage in a 2d canvas to obtain the "snapshot" and then texImage2d(..., canvas2d) to consume in WebGL, but that's also slow. Probably best to limit this bug to ImageBitmap as it does feel like the correct API for this use-case, and getting it performant will also be key to having OffscreenCanvas work well.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220106/bb9ae8a0/attachment-0001.htm>


More information about the webkit-unassigned mailing list