From 65c84d230bcac6545cde7c06fe7fe22b1fb2f8cb Mon Sep 17 00:00:00 2001 From: Samson <16504129+sagudev@users.noreply.github.com> Date: Tue, 19 Nov 2024 19:34:37 +0100 Subject: [PATCH] Replace sparkle with glow in shared/canvas (#34292) Also updates glow to 0.16 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- Cargo.lock | 22 ++++++++--------- Cargo.toml | 4 +-- components/shared/canvas/Cargo.toml | 2 +- components/shared/canvas/webgl.rs | 38 ++++++++++++----------------- 4 files changed, 30 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 34d7f30f7f9..d560bc7b244 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -701,7 +701,7 @@ dependencies = [ "fnv", "font-kit", "fonts", - "glow 0.15.0", + "glow 0.16.0", "half", "ipc-channel", "log", @@ -733,6 +733,7 @@ dependencies = [ "base", "crossbeam-channel", "euclid", + "glow 0.16.0", "ipc-channel", "malloc_size_of", "malloc_size_of_derive", @@ -740,7 +741,6 @@ dependencies = [ "serde", "serde_bytes", "servo_config", - "sparkle", "style", "webrender_api", "webxr-api", @@ -2518,9 +2518,9 @@ dependencies = [ [[package]] name = "glow" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33cd8ff5e02c1a5463ec10a846c8f3166a3ae0382ec33de6a327ea6dd61c41d" +checksum = "c5e5ea60d70410161c8bf5da3fdfeaa1c72ed2c15f8bbb9d19fe3a4fad085f08" dependencies = [ "js-sys", "slotmap", @@ -6134,7 +6134,7 @@ dependencies = [ "fonts", "fonts_traits", "fxhash", - "glow 0.15.0", + "glow 0.16.0", "headers", "html5ever", "http", @@ -7147,7 +7147,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "surfman" version = "0.9.8" -source = "git+https://github.com/servo/surfman?rev=e0c34af64f2860bc56bc8a56e1c169a915b16aa3#e0c34af64f2860bc56bc8a56e1c169a915b16aa3" +source = "git+https://github.com/servo/surfman?rev=c8d6b4b65aeab739ee7651602e29c8d58ceee123#c8d6b4b65aeab739ee7651602e29c8d58ceee123" dependencies = [ "bitflags 2.6.0", "cfg_aliases 0.2.1", @@ -7158,7 +7158,7 @@ dependencies = [ "euclid", "fnv", "gl_generator", - "glow 0.15.0", + "glow 0.16.0", "io-surface", "libc", "log", @@ -8389,11 +8389,11 @@ dependencies = [ [[package]] name = "webxr" version = "0.0.1" -source = "git+https://github.com/servo/webxr#042a7af3271d93d68e357b0b19c9aaa2cb30d322" +source = "git+https://github.com/servo/webxr#84c3022dc6e980119e2a04e1e248e74f825694b7" dependencies = [ "crossbeam-channel", "euclid", - "glow 0.15.0", + "glow 0.16.0", "log", "openxr", "serde", @@ -8406,7 +8406,7 @@ dependencies = [ [[package]] name = "webxr-api" version = "0.0.1" -source = "git+https://github.com/servo/webxr#042a7af3271d93d68e357b0b19c9aaa2cb30d322" +source = "git+https://github.com/servo/webxr#84c3022dc6e980119e2a04e1e248e74f825694b7" dependencies = [ "euclid", "ipc-channel", @@ -8536,7 +8536,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 98e0e92940c..85a27a9c1c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,7 @@ fxhash = "0.2" getopts = "0.2.11" gleam = "0.15" glib = "0.19" -glow = "0.15" +glow = "0.16" gstreamer = { version = "0.22", features = ["v1_18"] } gstreamer-base = "0.22" gstreamer-gl = "0.22" @@ -125,7 +125,7 @@ style = { git = "https://github.com/servo/stylo", branch = "2024-10-04", feature style_config = { git = "https://github.com/servo/stylo", branch = "2024-10-04" } style_dom = { git = "https://github.com/servo/stylo", package = "dom", branch = "2024-10-04" } style_traits = { git = "https://github.com/servo/stylo", branch = "2024-10-04", features = ["servo"] } -surfman = { git = "https://github.com/servo/surfman", rev = "e0c34af64f2860bc56bc8a56e1c169a915b16aa3", features = ["chains"] } +surfman = { git = "https://github.com/servo/surfman", rev = "c8d6b4b65aeab739ee7651602e29c8d58ceee123", features = ["chains"] } syn = { version = "2", default-features = false, features = ["clone-impls", "derive", "parsing"] } synstructure = "0.13" thin-vec = "0.2.13" diff --git a/components/shared/canvas/Cargo.toml b/components/shared/canvas/Cargo.toml index 62070161f3e..6324c4ae2e9 100644 --- a/components/shared/canvas/Cargo.toml +++ b/components/shared/canvas/Cargo.toml @@ -25,7 +25,7 @@ pixels = { path = "../../pixels" } serde = { workspace = true } serde_bytes = { workspace = true } servo_config = { path = "../../config" } -sparkle = { workspace = true } +glow = { workspace = true } style = { workspace = true } webrender_api = { workspace = true } webxr-api = { workspace = true, features = ["ipc"] } diff --git a/components/shared/canvas/webgl.rs b/components/shared/canvas/webgl.rs index c42e5dc6e61..c19f0f1e6c6 100644 --- a/components/shared/canvas/webgl.rs +++ b/components/shared/canvas/webgl.rs @@ -14,11 +14,11 @@ pub use base::generic_channel::GenericSender as WebGLSender; /// Result type for send()/recv() calls in in WebGLCommands. pub use base::generic_channel::SendResult as WebGLSendResult; use euclid::default::{Rect, Size2D}; +use glow as gl; use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSender, IpcSharedMemory}; use malloc_size_of_derive::MallocSizeOf; use pixels::PixelFormat; use serde::{Deserialize, Serialize}; -use sparkle::gl; use webrender_api::ImageKey; use webxr_api::{ ContextId as WebXRContextId, Error as WebXRError, LayerId as WebXRLayerId, @@ -936,23 +936,9 @@ macro_rules! gl_enums { } } -// FIXME: These should come from sparkle +// TODO(sagudev): These should come from glow mod gl_ext_constants { - use sparkle::gl::types::GLenum; - - pub const COMPRESSED_RGB_S3TC_DXT1_EXT: GLenum = 0x83F0; - pub const COMPRESSED_RGBA_S3TC_DXT1_EXT: GLenum = 0x83F1; - pub const COMPRESSED_RGBA_S3TC_DXT3_EXT: GLenum = 0x83F2; - pub const COMPRESSED_RGBA_S3TC_DXT5_EXT: GLenum = 0x83F3; - pub const COMPRESSED_RGB_ETC1_WEBGL: GLenum = 0x8D64; - - pub static COMPRESSIONS: &[GLenum] = &[ - COMPRESSED_RGB_S3TC_DXT1_EXT, - COMPRESSED_RGBA_S3TC_DXT1_EXT, - COMPRESSED_RGBA_S3TC_DXT3_EXT, - COMPRESSED_RGBA_S3TC_DXT5_EXT, - COMPRESSED_RGB_ETC1_WEBGL, - ]; + pub const COMPRESSED_RGB_ETC1_WEBGL: u32 = 0x8D64; pub const ALPHA16F_ARB: u32 = 0x881C; pub const ALPHA32F_ARB: u32 = 0x8816; @@ -983,10 +969,10 @@ gl_enums! { Luminance16f = gl_ext_constants::LUMINANCE16F_ARB, LuminanceAlpha32f = gl_ext_constants::LUMINANCE_ALPHA32F_ARB, LuminanceAlpha16f = gl_ext_constants::LUMINANCE_ALPHA16F_ARB, - CompressedRgbS3tcDxt1 = gl_ext_constants::COMPRESSED_RGB_S3TC_DXT1_EXT, - CompressedRgbaS3tcDxt1 = gl_ext_constants::COMPRESSED_RGBA_S3TC_DXT1_EXT, - CompressedRgbaS3tcDxt3 = gl_ext_constants::COMPRESSED_RGBA_S3TC_DXT3_EXT, - CompressedRgbaS3tcDxt5 = gl_ext_constants::COMPRESSED_RGBA_S3TC_DXT5_EXT, + CompressedRgbS3tcDxt1 = gl::COMPRESSED_RGB_S3TC_DXT1_EXT, + CompressedRgbaS3tcDxt1 = gl::COMPRESSED_RGBA_S3TC_DXT1_EXT, + CompressedRgbaS3tcDxt3 = gl::COMPRESSED_RGBA_S3TC_DXT3_EXT, + CompressedRgbaS3tcDxt5 = gl::COMPRESSED_RGBA_S3TC_DXT5_EXT, CompressedRgbEtc1 = gl_ext_constants::COMPRESSED_RGB_ETC1_WEBGL, R8 = gl::R8, R8SNorm = gl::R8_SNORM, @@ -1080,7 +1066,15 @@ impl TexFormat { /// Returns whether this format is a known texture compression format. pub fn is_compressed(&self) -> bool { - gl_ext_constants::COMPRESSIONS.contains(&self.as_gl_constant()) + let gl_const = self.as_gl_constant(); + matches!( + gl_const, + gl::COMPRESSED_RGB_S3TC_DXT1_EXT | + gl::COMPRESSED_RGBA_S3TC_DXT1_EXT | + gl::COMPRESSED_RGBA_S3TC_DXT3_EXT | + gl::COMPRESSED_RGBA_S3TC_DXT5_EXT | + gl_ext_constants::COMPRESSED_RGB_ETC1_WEBGL + ) } /// Returns whether this format is a known sized or unsized format.