Skip to content

Commit

Permalink
Replace sparkle with glow in components/canvas (servo#33918)
Browse files Browse the repository at this point in the history
* Replace sparkle with glow in components/canvas

Signed-off-by: sagudev <[email protected]>

* Replace safe_gl with servo#34300

Signed-off-by: sagudev <[email protected]>

---------

Signed-off-by: sagudev <[email protected]>
  • Loading branch information
sagudev authored Nov 20, 2024
1 parent 910e8dc commit 063071b
Show file tree
Hide file tree
Showing 12 changed files with 959 additions and 704 deletions.
10 changes: 0 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ servo_arc = { git = "https://github.com/servo/stylo", branch = "2024-10-04", fea
servo_atoms = { git = "https://github.com/servo/stylo", branch = "2024-10-04" }
smallbitvec = "2.5.3"
smallvec = "1.13"
sparkle = "0.1.26"
static_assertions = "1.1"
string_cache = "0.8"
string_cache_codegen = "0.5"
Expand Down
1 change: 0 additions & 1 deletion components/canvas/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ pixels = { path = "../pixels" }
range = { path = "../range" }
raqote = "0.8.5"
servo_arc = { workspace = true }
sparkle = { workspace = true }
style = { workspace = true }
style_traits = { workspace = true }
surfman = { workspace = true }
Expand Down
28 changes: 20 additions & 8 deletions components/canvas/webgl_limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

use canvas_traits::webgl::{GLLimits, WebGLVersion};
use sparkle::gl;
use sparkle::gl::{GLenum, Gl, GlType};
use glow::{self as gl, Context as Gl, HasContext};
type GLenum = u32;

pub trait GLLimitsDetect {
fn detect(gl: &Gl, webgl_version: WebGLVersion) -> Self;
Expand Down Expand Up @@ -32,7 +32,7 @@ impl GLLimitsDetect for GLLimits {
max_vertex_output_vectors,
max_fragment_input_vectors,
);
if gl.get_type() == GlType::Gles {
if gl.version().is_embedded {
max_fragment_uniform_vectors = gl.get_integer(gl::MAX_FRAGMENT_UNIFORM_VECTORS);
max_varying_vectors = gl.get_integer(gl::MAX_VARYING_VECTORS);
max_vertex_uniform_vectors = gl.get_integer(gl::MAX_VERTEX_UNIFORM_VECTORS);
Expand Down Expand Up @@ -220,7 +220,7 @@ macro_rules! create_fun {
unsafe {
self.$glcall(parameter, &mut value);
}
if self.get_error() != gl::NO_ERROR {
if unsafe { self.get_error() } != gl::NO_ERROR {
None
} else {
Some(value[0] as $rstype)
Expand All @@ -234,14 +234,26 @@ macro_rules! create_fun {
}

impl<'a> GLExt for &'a Gl {
create_fun!(try_get_integer, get_integer, i32, get_integer_v, u32);
create_fun!(try_get_integer64, get_integer64, i64, get_integer64_v, u64);
create_fun!(
try_get_integer,
get_integer,
i32,
get_parameter_i32_slice,
u32
);
create_fun!(
try_get_integer64,
get_integer64,
i64,
get_parameter_i64_slice,
u64
);
create_fun!(
try_get_signed_integer,
get_signed_integer,
i32,
get_integer_v,
get_parameter_i32_slice,
i32
);
create_fun!(try_get_float, get_float, f32, get_float_v, f32);
create_fun!(try_get_float, get_float, f32, get_parameter_f32_slice, f32);
}
Loading

0 comments on commit 063071b

Please sign in to comment.