diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-07-28 10:28:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-28 10:28:34 -0400 |
commit | eb4f2d150af353ecbae3eacb23b32b4ac0970ce8 (patch) | |
tree | 4fe481624e923877875b43882119aefca876568e /components/canvas/webgl_mode/inprocess.rs | |
parent | b52bfbe68aed9b0abb39a6e994c5dad37cf7d33c (diff) | |
parent | c757a9c009b55e7c548ee25f5cd5499f2a61d36c (diff) | |
download | servo-eb4f2d150af353ecbae3eacb23b32b4ac0970ce8.tar.gz servo-eb4f2d150af353ecbae3eacb23b32b4ac0970ce8.zip |
Auto merge of #23857 - asajeffrey:webxr-sessions-track-draw-texture, r=Manishearth
WebXR sessions track draw texture
<!-- Please describe your changes on the following line: -->
Send the XR framebuffer texture to the XR session.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because we don't have webxr reftests
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23857)
<!-- Reviewable:end -->
Diffstat (limited to 'components/canvas/webgl_mode/inprocess.rs')
-rw-r--r-- | components/canvas/webgl_mode/inprocess.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/components/canvas/webgl_mode/inprocess.rs b/components/canvas/webgl_mode/inprocess.rs index 1ca4e9c53cb..b7b7189bd96 100644 --- a/components/canvas/webgl_mode/inprocess.rs +++ b/components/canvas/webgl_mode/inprocess.rs @@ -117,8 +117,8 @@ impl SendableWebGLExternalImages { } } -impl webxr_api::WebGLExternalImageApi for SendableWebGLExternalImages { - fn lock(&self, id: usize) -> (u32, Size2D<i32>, Option<gl::GLsync>) { +impl SendableWebGLExternalImages { + fn lock_and_get_current_texture(&self, id: usize) -> (u32, Size2D<i32>, Option<gl::GLsync>) { if let Some(main_thread) = WebGLMainThread::on_current_thread() { // If we're on the same thread as WebGL, we can get the data directly let (image_id, size) = main_thread @@ -141,6 +141,13 @@ impl webxr_api::WebGLExternalImageApi for SendableWebGLExternalImages { (image_id, size, Some(gl_sync as gl::GLsync)) } } +} + +impl webxr_api::WebGLExternalImageApi for SendableWebGLExternalImages { + fn lock(&self, id: usize) -> Option<gl::GLsync> { + let (_, _, gl_sync) = self.lock_and_get_current_texture(id); + gl_sync + } fn unlock(&self, id: usize) { if let Some(main_thread) = WebGLMainThread::on_current_thread() { @@ -178,7 +185,7 @@ impl WebGLExternalImages { impl WebrenderExternalImageApi for WebGLExternalImages { fn lock(&mut self, id: u64) -> (u32, Size2D<i32>) { - let (image_id, size, gl_sync) = self.sendable.lock(id as usize); + let (image_id, size, gl_sync) = self.sendable.lock_and_get_current_texture(id as usize); // The next glWaitSync call is run on the WR thread and it's used to synchronize the two // flows of OpenGL commands in order to avoid WR using a semi-ready WebGL texture. // glWaitSync doesn't block WR thread, it affects only internal OpenGL subsystem. |