Replace sparkle with glow in components/canvas (#33918)

* Replace sparkle with glow in components/canvas

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Replace safe_gl with #34300

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Samson 2024-11-20 10:05:24 +01:00 committed by GitHub
parent 910e8dc89f
commit 063071ba72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 958 additions and 703 deletions

View file

@ -219,11 +219,11 @@ impl VertexArrayObject {
let mut has_active_attrib = false;
let mut has_divisor_0 = false;
for active_info in active_attribs {
if active_info.location < 0 {
let Some(location) = active_info.location else {
continue;
}
};
has_active_attrib = true;
let attrib = &attribs[active_info.location as usize];
let attrib = &attribs[location as usize];
if attrib.divisor == 0 {
has_divisor_0 = true;
}

View file

@ -294,13 +294,17 @@ impl WebGL2RenderingContext {
for prog_attrib in program.active_attribs().iter() {
let attrib = handle_potential_webgl_error!(
self.base,
vao.get_vertex_attrib(prog_attrib.location as u32)
// TODO(#34300): remove unwrap
vao.get_vertex_attrib(prog_attrib.location.unwrap_or(u32::MAX))
.ok_or(InvalidOperation),
return
);
let current_vertex_attrib =
self.base.current_vertex_attribs()[prog_attrib.location as usize];
// TODO(#34300): remove unwrap
let current_vertex_attrib = self.base.current_vertex_attribs()[prog_attrib
.location
.map(|l| l as usize)
.unwrap_or(usize::MAX)];
let attrib_data_base_type = if !attrib.enabled_as_array {
match current_vertex_attrib {
VertexAttrib::Int(_, _, _, _) => constants::INT,

View file

@ -173,9 +173,9 @@ impl WebGLProgram {
let mut used_locs = FnvHashSet::default();
let mut used_names = FnvHashSet::default();
for active_attrib in &*link_info.active_attribs {
if active_attrib.location == -1 {
let Some(location) = active_attrib.location else {
continue;
}
};
let columns = match active_attrib.type_ {
constants::FLOAT_MAT2 => 2,
constants::FLOAT_MAT3 => 3,
@ -185,7 +185,7 @@ impl WebGLProgram {
assert!(used_names.insert(&*active_attrib.name));
for column in 0..columns {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#6.31
if !used_locs.insert(active_attrib.location as u32 + column) {
if !used_locs.insert(location + column) {
return Ok(());
}
}
@ -364,7 +364,8 @@ impl WebGLProgram {
.borrow()
.iter()
.find(|attrib| attrib.name == *name)
.map_or(-1, |attrib| attrib.location);
.and_then(|attrib| attrib.location.map(|l| l as i32))
.unwrap_or(-1);
Ok(location)
}