Replace sparkle with glow in shared/canvas (#34292)

Also updates glow to 0.16

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Samson 2024-11-19 19:34:37 +01:00 committed by GitHub
parent 4d28d6f96e
commit 65c84d230b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 30 additions and 36 deletions

View file

@ -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"] }

View file

@ -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.