diff options
author | Alan Jeffrey <ajeffrey@mozilla.com> | 2019-07-25 18:09:53 -0500 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2019-07-28 10:24:38 -0400 |
commit | c757a9c009b55e7c548ee25f5cd5499f2a61d36c (patch) | |
tree | 386dfc0e2af0c5eef89797205bae8da745014a5b /components/canvas | |
parent | b9b01764fb86427a7b6b59e97ae475cdaf1b0c09 (diff) | |
download | servo-c757a9c009b55e7c548ee25f5cd5499f2a61d36c.tar.gz servo-c757a9c009b55e7c548ee25f5cd5499f2a61d36c.zip |
Get XR sessions to track the draw texture, so we render the XR framebuffer rather than the default canvas framebuffer
Diffstat (limited to 'components/canvas')
-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. |