-
Notifications
You must be signed in to change notification settings - Fork 82
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
reftests: Canvas display after device lost/destroyed #3251
Comments
@perryuwang The reftests live in this directory: A good example to look at is the simplest one. Here is the test: Also note it points to it's For this test, I think a solid color canvas (one opaque and one transparent), similar to the canvas_clear test, is sufficient, except you will probably want to set the background color of the element or the page in order to test the transparency rendering. Usually I recommend just visually comparing the rendering of the test and the reference. In order to run the pages locally, follow the setup instructions here: |
@kainino0x |
According to the spec as written, getCurrentTexture() is always supposed to create a new drawing buffer (unless there is already one for the current frame). That drawing buffer is then supposed to get displayed on the next frame. All of this is independent of anything that's going on with the GPUDevice - there's no special casing for lost devices in the canvas-related algorithms. There's a good reason for this, actually - device loss occurs in the device timeline (GPU process), while all canvas state stuff is done in the content timeline (renderer process). Of course, all display is going through the GPU process anyway, so technically the spec could try to define some parts of the canvas algorithms as occurring in the device timeline, but this would be difficult to match up with the HTML spec on canvas, which defines no concept of a device timeline.
Giving this a bit more thought - we can't really guarantee this for all device loss. For device destroy, we can. But if something catastrophic happens like the GPU process crashes ( The spec makes no carveout for this. It technically should, but this is such an exceptional case that I don't think it's worth the significant effort to figure out what that carveout should look like. |
Got it. Thanks very much. |
With gpuweb/gpuweb#4859 it seems we'll end up allowing multiple behaviors. Fortunately WPT supports this! https://web-platform-tests.org/writing-tests/reftests.html#multiple-references |
Possibly useful reference for test cases: https://codepen.io/kainino0x/pen/dyxoNRd |
I believe that according to the WebGPU spec, canvas display should interact with device loss (and destroy()) as follows:
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:
Update tests for Canvas contents after device destroy or device loss gpuweb#4859; see https://web-platform-tests.org/writing-tests/reftests.html#multiple-references
See also op: canvas read as an image source on device destroyed #3956
Rough test cases:
GPUDevice.destroy
is called? gpuweb#4294 (comment)The text was updated successfully, but these errors were encountered: