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

web_platform: Canvas readback after device lost/destroyed #3252

Open
kainino0x opened this issue Jan 9, 2024 · 1 comment
Open

web_platform: Canvas readback after device lost/destroyed #3252

kainino0x opened this issue Jan 9, 2024 · 1 comment

Comments

@kainino0x
Copy link
Collaborator

kainino0x commented Jan 9, 2024

I believe that according to the WebGPU spec, canvas readback (via drawImage etc.) should interact with device loss (and destroy()) in the same way I described in #3251:

  • After the device is lost but before calling getCurrentTexture, it should keep returning the last displayed frame

  • After the device is lost and after calling getCurrentTexture, it should return:

    • a solid black image, if configure()d as opaque
    • a blank transparent image, if configure()d as transparent

Rough test cases:

  • Render something, destroy the device, (maybe check readback,) wait a few frames, check readback again
  • Render something, destroy the device, wait a few frames, call getCurrentTexture, check readback, wait a few frames, check readback again
@kainino0x kainino0x added this to CTS Jan 9, 2024
@kainino0x kainino0x moved this to Open (no TODO) in CTS Jan 9, 2024
@kainino0x
Copy link
Collaborator Author

kainino0x commented Jan 10, 2024

@perryuwang
This one is a lot more involved than the reftest as there are a lot of different ways to read back from a canvas, but this is the file where these tests will be added:
https://github.com/gpuweb/cts/blob/873305ab6a2eae37dc899856ccd55bebe8e94f8a/src/webgpu/web_platform/canvas/readbackFromWebGPUCanvas.spec.ts
If you are interested in picking this up, see the intro documentation on how to develop on these locally.

For the destroy-readback test, I think we'll add a "parameter" to most of these tests for whether the device should be destroyed before the readback, which shouldn't change the readback result. (For simplicity we don't really need to check readback twice like I wrote above.)

For the destroy-getCurrentTexture-readback test, I'm not sure how to add those to the existing test cases. We will want to check readback twice for these - readbacks in the same frame and readbacks in future frames are likely to have different implementations that both need to be tested.

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

1 participant