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

Remove DeviceLost status from WGPUSurfaceGetCurrentTextureStatus #397

Merged
merged 6 commits into from
Nov 14, 2024

Conversation

kainino0x
Copy link
Collaborator

@kainino0x kainino0x commented Nov 9, 2024

We didn't discuss which status we would use for this, but "Lost" seems to makes sense.
This should behave like JS where we pretend it worked by returning a texture, but you can't use it because the device is lost.

Issue #209

We didn't discuss which status we would use for this but "Lost" makes
sense.

Issue webgpu-native#209
@kainino0x kainino0x requested a review from Kangz November 9, 2024 04:25
@Kangz
Copy link
Collaborator

Kangz commented Nov 12, 2024

Technically the connection to the X server being severed, and the device being lost are two different things. But IDK that an application can usefully handle one while not handling the other so LGTM.

@kainino0x
Copy link
Collaborator Author

I just realized... in JS if you getCurrentTexture on a lost device, you just get an invalid texture (well, a texture that you can't observe is valid, because the device is lost). That is probably needs to be done here, to match - it's not exactly possible in JS or on remoting implementations to do what I wrote here, because you don't know synchronously when the device is lost. Hopefully this isn't a problem for non-remoting native....

Revised.

@kainino0x kainino0x requested a review from Kangz November 14, 2024 03:23
@@ -242,8 +242,8 @@ The behavior of `::wgpuSurfaceGetCurrentTexture``(surface, surfaceTexture)` is:
- Validate that `surface.config` is not `None`.
- Validate that `surface.currentFrame` is `None`.

- If `surface.config.device` is not alive, set `surfaceTexture->status` to `WGPUSurfaceGetCurrentTextureStatus_DeviceLost` and return.
- If the implementation detects any other problem preventing use of the surface, set `surfaceTexture->status` to an appropriate status (something other than `SuccessOptimal`, `SuccessSuboptimal`, `Error`, or `DeviceLost`) and return.
- If `surface.config.device` is not alive, set `surfaceTexture->status` to `WGPUSurfaceGetCurrentTextureStatus_Success`, set `surfaceTexture->texture` to a new invalid `WGPUTexture`, and return.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should still have the correct reflection on that texture.

@kainino0x kainino0x enabled auto-merge (squash) November 14, 2024 18:50
@kainino0x kainino0x merged commit e16cfa6 into webgpu-native:main Nov 14, 2024
5 checks passed
@kainino0x kainino0x deleted the surface-device-lost branch November 18, 2024 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants