mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Initialize a wevxr device registry from Servo
This commit is contained in:
parent
b4ed3b6f3c
commit
91d1b52b38
9 changed files with 61 additions and 0 deletions
|
@ -4,6 +4,8 @@
|
|||
|
||||
use euclid::{Rect, Size2D};
|
||||
use gleam::gl;
|
||||
use gleam::gl::GLsync;
|
||||
use gleam::gl::GLuint;
|
||||
use gleam::gl::Gl;
|
||||
use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSharedMemory};
|
||||
use pixels::PixelFormat;
|
||||
|
@ -175,6 +177,23 @@ impl WebGLMsgSender {
|
|||
}
|
||||
}
|
||||
|
||||
impl webxr_api::WebGLExternalImageApi for WebGLMsgSender {
|
||||
fn lock(&self) -> Result<(GLuint, Size2D<i32>, GLsync), webxr_api::Error> {
|
||||
let (sender, receiver) = webgl_channel().or(Err(webxr_api::Error::CommunicationError))?;
|
||||
self.sender
|
||||
.send(WebGLMsg::Lock(self.ctx_id, sender))
|
||||
.or(Err(webxr_api::Error::CommunicationError))?;
|
||||
let (texture, size, sync) = receiver
|
||||
.recv()
|
||||
.or(Err(webxr_api::Error::CommunicationError))?;
|
||||
Ok((texture, size, sync as GLsync))
|
||||
}
|
||||
|
||||
fn unlock(&self) {
|
||||
let _ = self.sender.send(WebGLMsg::Unlock(self.ctx_id));
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct TruncatedDebug<T>(T);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue