mirror of
https://github.com/servo/servo.git
synced 2025-06-18 22:34:30 +01:00
Integrate swapchain surface provider changes into webgl and webxr implementations.
This commit is contained in:
parent
b062f51495
commit
fbcf2bbc3e
17 changed files with 223 additions and 117 deletions
|
@ -142,9 +142,11 @@ impl WebGLFramebuffer {
|
|||
size: Size2D<i32, Viewport>,
|
||||
) -> Option<(WebXRSwapChainId, DomRoot<Self>)> {
|
||||
let (sender, receiver) = webgl_channel().unwrap();
|
||||
let _ = context
|
||||
.webgl_sender()
|
||||
.send_create_webxr_swap_chain(size.to_untyped(), sender);
|
||||
let _ = context.webgl_sender().send_create_webxr_swap_chain(
|
||||
size.to_untyped(),
|
||||
sender,
|
||||
session.session_id(),
|
||||
);
|
||||
let swap_chain_id = receiver.recv().unwrap()?;
|
||||
let framebuffer_id =
|
||||
WebGLFramebufferId::Opaque(WebGLOpaqueFramebufferId::WebXR(swap_chain_id));
|
||||
|
|
|
@ -81,6 +81,7 @@ use std::cell::Cell;
|
|||
use std::cmp;
|
||||
use std::ptr::{self, NonNull};
|
||||
use std::rc::Rc;
|
||||
use webxr_api::SessionId;
|
||||
use webxr_api::SwapChainId as WebXRSwapChainId;
|
||||
|
||||
// From the GLES 2.0.25 spec, page 85:
|
||||
|
@ -4576,8 +4577,9 @@ impl WebGLMessageSender {
|
|||
&self,
|
||||
size: Size2D<i32>,
|
||||
sender: WebGLSender<Option<WebXRSwapChainId>>,
|
||||
id: SessionId,
|
||||
) -> WebGLSendResult {
|
||||
self.wake_after_send(|| self.sender.send_create_webxr_swap_chain(size, sender))
|
||||
self.wake_after_send(|| self.sender.send_create_webxr_swap_chain(size, sender, id))
|
||||
}
|
||||
|
||||
pub fn send_resize(
|
||||
|
|
|
@ -51,7 +51,7 @@ use std::mem;
|
|||
use std::rc::Rc;
|
||||
use webxr_api::{
|
||||
self, util, Display, EnvironmentBlendMode, Event as XREvent, Frame, SelectEvent, SelectKind,
|
||||
Session, View, Viewer, Visibility,
|
||||
Session, SessionId, View, Viewer, Visibility,
|
||||
};
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -462,6 +462,10 @@ impl XRSession {
|
|||
viewport: Rect::from_size(size.to_i32()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn session_id(&self) -> SessionId {
|
||||
self.session.borrow().id()
|
||||
}
|
||||
}
|
||||
|
||||
impl XRSessionMethods for XRSession {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue