compositing: Allow WebGL contexts to have different Surfman devices#40721
Merged
mukilan merged 2 commits intoservo:mainfrom Nov 18, 2025
Merged
compositing: Allow WebGL contexts to have different Surfman devices#40721mukilan merged 2 commits intoservo:mainfrom
mukilan merged 2 commits intoservo:mainfrom
Conversation
Currently, a single `surfman::Device` is used for all WebGL contexts. This cannot work when we have multiple rendering contexts. So, extract the surfman `Connection` and `Adapter` into a per-painter data structure (`PainterSurfmanDetailsMap`) and store the `Device` directly in the WebGL context. This patch also modifies the WebXR traits so that the `Device` doesn't need to be explictly passed into most methods. Testing: Should be covered by existing tests. --------- Signed-off-by: Mukilan Thiyagarajan <[email protected]> Co-authored-by: Martin Robinson <[email protected]>
- Do not remove WebGL contexts from the context map before cleaning up the WebXR layers. The layer cleanup process consults the map. - When cleanup up layers, be sure to replace the WebXRBridge in the WebGLThread data structure. - Allow failing to the Device when processing WebXR commands. WebXR sometimes tries to access contexts after they have been removed. Signed-off-by: Martin Robinson <[email protected]>
|
🔨 Triggering try run (#19472012056) for Linux (WPT) |
|
|
Test results for linux-wpt from try job (#19472012056): Flaky unexpected result (35)
Stable unexpected results that are known to be intermittent (29)
|
|
✨ Try run (#19472012056) succeeded. |
mukilan
reviewed
Nov 18, 2025
| bound_context_id: &mut self.bound_context_id, | ||
| // Take `webxr_bridge` from the `WebGLThread` in order to avoid a double mutable borrow. | ||
| let Some(mut webxr_bridge) = self.webxr_bridge.take() else { | ||
| return; |
Member
There was a problem hiding this comment.
Maybe we can add a warn statement here to detect similar issues in the future where the bridge is not restored correctly but we continue to receive commands.
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.
Currently, a single
surfman::Deviceis used for all WebGL contexts.This cannot work when we have multiple rendering contexts. So, extract
the surfman
ConnectionandAdapterinto a per-painter data structure(
PainterSurfmanDetailsMap) and store theDevicedirectly in theWebGL context.
This patch also modifies the WebXR traits so that the
Devicedoesn'tneed to be explictly passed into most methods.
This is a reland of #40594 with the following changes:
WebXR layers. The layer cleanup process consults the map.
WebGLThread data structure.
sometimes tries to access contexts after they have been removed.
Testing: Should be covered by existing tests.