Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

canvas read as an image source alpha mode behavior update #1561

Open
shrekshao opened this issue Jun 21, 2022 · 6 comments
Open

canvas read as an image source alpha mode behavior update #1561

shrekshao opened this issue Jun 21, 2022 · 6 comments

Comments

@shrekshao
Copy link
Contributor

shrekshao commented Jun 21, 2022

gpuweb/gpuweb#2905

@shrekshao shrekshao changed the title reftest: update: alpha compositing related: toDataUrl, texImage2D, drawImage etc. reftest: update: canvas read interpretation Jun 21, 2022
@shrekshao shrekshao changed the title reftest: update: canvas read interpretation reftest: update: canvas read as an image source Jun 21, 2022
@shrekshao
Copy link
Contributor Author

https://www.w3.org/TR/webgpu/#GPUCanvasAlphaMode

(GPUCanvasAlphaMode) selects how the contents of the canvas will be interpreted when read, when rendered to the screen or used as an image source (in drawImage, toDataURL, etc.)

We have reftests for "canvas read when rendered to the screen", we still need reftests for "canvas read when used as an image source."

Operations include drawImage, toDataURL, texImage2D, toBlob etc.

@shrekshao shrekshao moved this to Started in CTS Jun 23, 2022
@shrekshao shrekshao changed the title reftest: update: canvas read as an image source canvas read as an image source alpha mode behavior update Jul 18, 2022
@shrekshao
Copy link
Contributor Author

Now it seems best to expand the readbackFromWebGPUCanvas.spec.ts with

  • x= src canvas
    • type=
      • canvas element not in dom
      • canvas element in dom
      • OffscreenCanvas from transferControlToOffscreen from canvas not in dom
      • OffscreenCanvas from transferControlToOffscreen from canvas in dom
      • OffscreenCanvas from new OffscreenCanvas
    • alphaMode= {opaque, premultiplied}
  • x= dst canvas
    • method=
      • 2d drawImage,
      • toDataURL,
      • toBlob,
      • createImageBitmap,
      • WebGL texImage2D,
      • WebGL texSubImage2D,
      • transferToImageBitmap
      • convertToBlob
      • ... and probably some others.
    • alphaMode= {opaque, premultiplied}

@kainino0x
Copy link
Collaborator

Finally tested and filed gpuweb/gpuweb#3295

@kainino0x
Copy link
Collaborator

@shrekshao this issue is still marked "started". Do you remember if it was done or was there still some work to do?

@shrekshao
Copy link
Contributor Author

Seems that the TODOs on kAllCanvasTypes are still missing

  • canvas element not in dom
  • canvas element in dom
  • offscreen canvas from transferControlToOffscreen from canvas not in dom
  • offscreen canvas from transferControlToOffscreen from canvas in dom
  • offscreen canvas from new OffscreenCanvas

@kainino0x
Copy link
Collaborator

I'll unmark it as "Started" and unassign you for now, but feel free to reassign yourself if you end up working on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Open (no TODO)
Development

No branches or pull requests

3 participants
@kainino0x @shrekshao and others