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

View file

@ -53,6 +53,7 @@ getopts = "0.2.11"
fonts_traits = { path = "components/shared/fonts" } fonts_traits = { path = "components/shared/fonts" }
gleam = "0.15" gleam = "0.15"
glib = "0.19" glib = "0.19"
glow = "0.15"
gstreamer = { version = "0.22", features = ["v1_18"] } gstreamer = { version = "0.22", features = ["v1_18"] }
gstreamer-base = "0.22" gstreamer-base = "0.22"
gstreamer-gl = "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_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_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"] } 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"] } syn = { version = "2", default-features = false, features = ["clone-impls", "derive", "parsing"] }
synstructure = "0.13" synstructure = "0.13"
thin-vec = "0.2.13" thin-vec = "0.2.13"

View file

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

View file

@ -54,6 +54,7 @@ use crate::webgl_limits::GLLimitsDetect;
struct GLContextData { struct GLContextData {
ctx: Context, ctx: Context,
gl: Rc<Gl>, gl: Rc<Gl>,
glow: glow::Context,
state: GLState, state: GLState,
attributes: GLContextAttributes, 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 limits = GLLimits::detect(&gl, webgl_version);
let size = clamp_viewport(&gl, requested_size); let size = clamp_viewport(&gl, requested_size);
@ -622,6 +634,7 @@ impl WebGLThread {
GLContextData { GLContextData {
ctx, ctx,
gl, gl,
glow,
state, state,
attributes, attributes,
}, },
@ -674,7 +687,7 @@ impl WebGLThread {
.resize(&mut self.device, &mut data.ctx, size.to_i32()) .resize(&mut self.device, &mut data.ctx, size.to_i32())
.map_err(|err| format!("Failed to resize swap chain: {:?}", err))?; .map_err(|err| format!("Failed to resize swap chain: {:?}", err))?;
swap_chain 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))?; .map_err(|err| format!("Failed to clear resized swap chain: {:?}", err))?;
} else { } else {
error!("Failed to find swap chain"); error!("Failed to find swap chain");
@ -777,7 +790,7 @@ impl WebGLThread {
&mut self.device, &mut self.device,
&mut data.ctx, &mut data.ctx,
if data.attributes.preserve_drawing_buffer { if data.attributes.preserve_drawing_buffer {
PreserveBuffer::Yes(&data.gl) PreserveBuffer::Yes(&data.glow)
} else { } else {
PreserveBuffer::No PreserveBuffer::No
}, },
@ -793,7 +806,7 @@ impl WebGLThread {
.contains(ContextAttributeFlags::ALPHA); .contains(ContextAttributeFlags::ALPHA);
let clear_color = [0.0, 0.0, 0.0, !alpha as i32 as f32]; let clear_color = [0.0, 0.0, 0.0, !alpha as i32 as f32];
swap_chain 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(); .unwrap();
debug_assert_eq!(data.gl.get_error(), gl::NO_ERROR); 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) 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( let data = WebGLThread::make_current_if_needed(
device, device,
WebGLContextId::from(context_id), WebGLContextId::from(context_id),
self.contexts, self.contexts,
self.bound_context_id, 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 # gilrs is on 0.10.0, but Servo is still on 0.9.4
"core-foundation", "core-foundation",
# some non-servo crates still use 0.14
"glow",
] ]
# Files that are ignored for all tidy and lint checks. # Files that are ignored for all tidy and lint checks.
files = [ files = [