Update to surfman&webxr without sparkle and use glow 0.15 (#33538)

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Samson 2024-10-18 19:16:48 +02:00 committed by GitHub
parent f73ae0414b
commit a58da5aa83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 46 additions and 17 deletions

33
Cargo.lock generated
View file

@ -666,6 +666,7 @@ dependencies = [
"fnv",
"font-kit",
"fonts",
"glow 0.15.0",
"half",
"ipc-channel",
"log",
@ -1735,7 +1736,7 @@ dependencies = [
"bytemuck",
"egui",
"egui-winit",
"glow",
"glow 0.14.2",
"log",
"memoffset",
"wasm-bindgen",
@ -2498,6 +2499,18 @@ dependencies = [
"web-sys",
]
[[package]]
name = "glow"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e33cd8ff5e02c1a5463ec10a846c8f3166a3ae0382ec33de6a327ea6dd61c41d"
dependencies = [
"js-sys",
"slotmap",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "glslopt"
version = "0.1.11"
@ -4064,7 +4077,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
dependencies = [
"cfg-if",
"windows-targets 0.48.5",
"windows-targets 0.52.6",
]
[[package]]
@ -6622,7 +6635,7 @@ dependencies = [
"gilrs",
"gl_generator",
"gleam",
"glow",
"glow 0.14.2",
"headers",
"hilog",
"hitrace",
@ -7065,8 +7078,7 @@ dependencies = [
[[package]]
name = "surfman"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb5f2d85c044920e1f2aaf5ad3795ae3b935025297271f2eadb021931571b4c3"
source = "git+https://github.com/servo/surfman?rev=e0c34af64f2860bc56bc8a56e1c169a915b16aa3#e0c34af64f2860bc56bc8a56e1c169a915b16aa3"
dependencies = [
"bitflags 2.6.0",
"cfg_aliases 0.2.1",
@ -7077,8 +7089,8 @@ dependencies = [
"euclid",
"fnv",
"gl_generator",
"glow 0.15.0",
"io-surface",
"lazy_static",
"libc",
"log",
"mach2",
@ -7086,7 +7098,6 @@ dependencies = [
"objc",
"raw-window-handle",
"servo-display-link",
"sparkle",
"wayland-sys 0.30.1",
"winapi",
"wio",
@ -8296,14 +8307,14 @@ dependencies = [
[[package]]
name = "webxr"
version = "0.0.1"
source = "git+https://github.com/servo/webxr#2094e041f6b59ca8a2aa3ab572e69e3cf7fae6ab"
source = "git+https://github.com/servo/webxr#042a7af3271d93d68e357b0b19c9aaa2cb30d322"
dependencies = [
"crossbeam-channel",
"euclid",
"glow 0.15.0",
"log",
"openxr",
"serde",
"sparkle",
"surfman",
"webxr-api",
"winapi",
@ -8313,7 +8324,7 @@ dependencies = [
[[package]]
name = "webxr-api"
version = "0.0.1"
source = "git+https://github.com/servo/webxr#2094e041f6b59ca8a2aa3ab572e69e3cf7fae6ab"
source = "git+https://github.com/servo/webxr#042a7af3271d93d68e357b0b19c9aaa2cb30d322"
dependencies = [
"euclid",
"ipc-channel",
@ -8366,7 +8377,7 @@ dependencies = [
"bytemuck",
"cfg_aliases 0.1.1",
"core-graphics-types",
"glow",
"glow 0.14.2",
"glutin_wgl_sys",
"gpu-alloc",
"gpu-allocator",

View file

@ -53,6 +53,7 @@ getopts = "0.2.11"
fonts_traits = { path = "components/shared/fonts" }
gleam = "0.15"
glib = "0.19"
glow = "0.15"
gstreamer = { version = "0.22", features = ["v1_18"] }
gstreamer-base = "0.22"
gstreamer-gl = "0.22"
@ -121,7 +122,7 @@ style = { git = "https://github.com/servo/stylo", branch = "2024-09-02", feature
style_config = { git = "https://github.com/servo/stylo", branch = "2024-09-02" }
style_dom = { git = "https://github.com/servo/stylo", package = "dom", branch = "2024-09-02" }
style_traits = { git = "https://github.com/servo/stylo", branch = "2024-09-02", features = ["servo"] }
surfman = { version = "0.9.8", features = ["chains"] }
surfman = { git = "https://github.com/servo/surfman", rev = "e0c34af64f2860bc56bc8a56e1c169a915b16aa3", features = ["chains"] }
syn = { version = "2", default-features = false, features = ["clone-impls", "derive", "parsing"] }
synstructure = "0.13"
thin-vec = "0.2.13"

View file

@ -25,6 +25,7 @@ euclid = { workspace = true }
fnv = { workspace = true }
font-kit = "0.14"
fonts = { path = "../fonts" }
glow = { workspace = true }
half = "2"
ipc-channel = { workspace = true }
log = { workspace = true }

View file

@ -54,6 +54,7 @@ use crate::webgl_limits::GLLimitsDetect;
struct GLContextData {
ctx: Context,
gl: Rc<Gl>,
glow: glow::Context,
state: GLState,
attributes: GLContextAttributes,
}
@ -560,6 +561,17 @@ impl WebGLThread {
})),
};
let glow = unsafe {
match self.api_type {
gl::GlType::Gl => glow::Context::from_loader_function(|symbol_name| {
self.device.get_proc_address(&ctx, symbol_name)
}),
gl::GlType::Gles => glow::Context::from_loader_function(|symbol_name| {
self.device.get_proc_address(&ctx, symbol_name)
}),
}
};
let limits = GLLimits::detect(&gl, webgl_version);
let size = clamp_viewport(&gl, requested_size);
@ -622,6 +634,7 @@ impl WebGLThread {
GLContextData {
ctx,
gl,
glow,
state,
attributes,
},
@ -674,7 +687,7 @@ impl WebGLThread {
.resize(&mut self.device, &mut data.ctx, size.to_i32())
.map_err(|err| format!("Failed to resize swap chain: {:?}", err))?;
swap_chain
.clear_surface(&mut self.device, &mut data.ctx, &data.gl, clear_color)
.clear_surface(&mut self.device, &mut data.ctx, &data.glow, clear_color)
.map_err(|err| format!("Failed to clear resized swap chain: {:?}", err))?;
} else {
error!("Failed to find swap chain");
@ -777,7 +790,7 @@ impl WebGLThread {
&mut self.device,
&mut data.ctx,
if data.attributes.preserve_drawing_buffer {
PreserveBuffer::Yes(&data.gl)
PreserveBuffer::Yes(&data.glow)
} else {
PreserveBuffer::No
},
@ -793,7 +806,7 @@ impl WebGLThread {
.contains(ContextAttributeFlags::ALPHA);
let clear_color = [0.0, 0.0, 0.0, !alpha as i32 as f32];
swap_chain
.clear_surface(&mut self.device, &mut data.ctx, &data.gl, clear_color)
.clear_surface(&mut self.device, &mut data.ctx, &data.glow, clear_color)
.unwrap();
debug_assert_eq!(data.gl.get_error(), gl::NO_ERROR);
}
@ -3303,13 +3316,13 @@ impl<'a> WebXRContexts<WebXRSurfman> for WebXRBridgeContexts<'a> {
)?;
Some(&mut data.ctx)
}
fn bindings(&mut self, device: &Device, context_id: WebXRContextId) -> Option<&Gl> {
fn bindings(&mut self, device: &Device, context_id: WebXRContextId) -> Option<&glow::Context> {
let data = WebGLThread::make_current_if_needed(
device,
WebGLContextId::from(context_id),
self.contexts,
self.bound_context_id,
)?;
Some(&data.gl)
Some(&data.glow)
}
}

View file

@ -79,6 +79,9 @@ packages = [
# gilrs is on 0.10.0, but Servo is still on 0.9.4
"core-foundation",
# some non-servo crates still use 0.14
"glow",
]
# Files that are ignored for all tidy and lint checks.
files = [