Restore retained wgpu textures after device loss - #8292
Open
luo007 wants to merge 1 commit into
Open
Conversation
|
Preview is being built... Preview will be available at https://egui-pr-preview.github.io/pr/8292-luoc/rdp-staging-buffer-fallback View snapshot changes at kitdiff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #8265.
What this fixes
This PR fixes a wgpu recovery issue that can happen after a remote desktop/session disconnect.
When the remote session is disconnected, the underlying wgpu device can be lost. eframe then recreates the wgpu renderer/device, but textures that were already retained by egui before the device loss could become blank afterwards.
The affected case is when egui still references an existing managed
TextureId, while the newly recreated wgpu renderer no longer has the corresponding GPU texture resource.Root cause
egui keeps texture state at a higher level than the wgpu renderer. During normal rendering, texture uploads are sent through texture deltas, and unchanged retained textures are not uploaded again every frame.
After a remote disconnect triggers wgpu device loss, the old GPU-side texture resources are gone. However, egui may still consider those textures alive and continue referencing their existing
TextureIds. Since those textures have not changed from egui's point of view, no fresh upload delta is produced for them.That leaves the recreated renderer in this state:
TextureIdthat has no valid GPU-side texture in the new renderer.The result is that images/textures that were visible before the remote disconnect can become blank after recovery.
How this is fixed
This change keeps enough CPU-side texture information for managed textures so they can be restored when the wgpu renderer/device is recreated.
The recovery path now:
This lets renderer recovery rebuild the GPU-side texture state after wgpu device loss, without requiring the application to modify or re-upload unchanged egui-managed textures manually.
Additional changes
A minimal
wgpu_recovery_minimalexample is added to make this remote-disconnect/device-loss recovery path easier to reproduce and manually inspect.Testing
I did not run the full test suite locally.
The new
wgpu_recovery_minimalexample is included as a focused manual repro for checking that retained textures are restored after wgpu device loss and renderer recovery.