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

@ -14,7 +14,10 @@ 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 glow::{
self as gl, NativeBuffer, NativeFence, NativeFramebuffer, NativeProgram, NativeQuery,
NativeRenderbuffer, NativeSampler, NativeShader, NativeTexture, NativeVertexArray,
};
use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSender, IpcSharedMemory};
use malloc_size_of_derive::MallocSizeOf;
use pixels::PixelFormat;
@ -632,18 +635,43 @@ macro_rules! define_resource_id {
}
}
};
($name:ident, $type:tt, $glow:tt) => {
impl $name {
#[inline]
pub fn glow(self) -> $glow {
$glow(self.0)
}
#[inline]
pub fn from_glow(glow: $glow) -> Self {
Self(glow.0)
}
}
define_resource_id!($name, $type);
};
}
define_resource_id!(WebGLBufferId, u32);
define_resource_id!(WebGLFramebufferId, u32);
define_resource_id!(WebGLRenderbufferId, u32);
define_resource_id!(WebGLTextureId, u32);
define_resource_id!(WebGLProgramId, u32);
define_resource_id!(WebGLQueryId, u32);
define_resource_id!(WebGLSamplerId, u32);
define_resource_id!(WebGLShaderId, u32);
define_resource_id!(WebGLBufferId, u32, NativeBuffer);
define_resource_id!(WebGLFramebufferId, u32, NativeFramebuffer);
define_resource_id!(WebGLRenderbufferId, u32, NativeRenderbuffer);
define_resource_id!(WebGLTextureId, u32, NativeTexture);
define_resource_id!(WebGLProgramId, u32, NativeProgram);
define_resource_id!(WebGLQueryId, u32, NativeQuery);
define_resource_id!(WebGLSamplerId, u32, NativeSampler);
define_resource_id!(WebGLShaderId, u32, NativeShader);
define_resource_id!(WebGLSyncId, u64);
define_resource_id!(WebGLVertexArrayId, u32);
impl WebGLSyncId {
#[inline]
pub fn glow(&self) -> NativeFence {
NativeFence(self.0.get() as _)
}
#[inline]
pub fn from_glow(glow: NativeFence) -> Self {
Self::maybe_new(glow.0 as _).expect("Glow should have valid fence")
}
}
define_resource_id!(WebGLVertexArrayId, u32, NativeVertexArray);
define_resource_id!(WebXRLayerManagerId, u32);
#[derive(
@ -708,7 +736,7 @@ pub struct ActiveAttribInfo {
/// The type of the attribute.
pub type_: u32,
/// The location of the attribute.
pub location: i32,
pub location: Option<u32>,
}
/// Description of a single active uniform.