webxr: create glwindow with Rc window and without rendering context (#34813)

* Create webxr glwindow with Rc window

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>

* Remove obselte gurad type

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>

* Update GlWindow trait method

Signed-off-by: Wu Yuwei <yuweiwu@pm.me>

* Update how webxr discorvery is created

Now glwindow will create a hidden window. It's better to not use it
unless we really want to use this port.

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>

* Link back to upstream webxr repo

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>

---------

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
Signed-off-by: Wu Yuwei <yuweiwu@pm.me>
This commit is contained in:
Ngo Iok Ui (Wu Yu Wei) 2025-01-03 12:01:30 +09:00 committed by GitHub
parent b252f238d1
commit da2074e5d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 26 additions and 97 deletions

View file

@ -9,14 +9,13 @@ use std::rc::Rc;
use std::sync::RwLock;
use euclid::num::Zero;
use euclid::{Box2D, Length, Point2D, Rotation3D, Scale, Size2D, UnknownUnit, Vector3D};
use euclid::{Box2D, Length, Point2D, Scale, Size2D};
use servo::compositing::windowing::{
AnimationState, EmbedderCoordinates, EmbedderEvent, WindowMethods,
};
use servo::config::opts;
use servo::servo_geometry::DeviceIndependentPixel;
use servo::webrender_api::units::{DeviceIntSize, DevicePixel};
use surfman::{Context, Device};
use crate::desktop::window_trait::WindowPortsMethods;
@ -124,7 +123,7 @@ impl WindowPortsMethods for Window {
fn new_glwindow(
&self,
_events_loop: &winit::event_loop::ActiveEventLoop,
) -> Box<dyn webxr::glwindow::GlWindow> {
) -> Rc<dyn webxr::glwindow::GlWindow> {
unimplemented!()
}
@ -158,21 +157,3 @@ impl WindowMethods for Window {
self.animation_state.set(state);
}
}
impl webxr::glwindow::GlWindow for Window {
fn get_render_target(
&self,
_device: &mut Device,
_context: &mut Context,
) -> webxr::glwindow::GlWindowRenderTarget {
unimplemented!()
}
fn get_rotation(&self) -> Rotation3D<f32, UnknownUnit, UnknownUnit> {
Rotation3D::identity()
}
fn get_translation(&self) -> Vector3D<f32, UnknownUnit> {
Vector3D::zero()
}
}