script/dom/webgl/extensions/
extension.rs1use canvas_traits::webgl::WebGLVersion;
6
7use super::WebGLExtensions;
8use crate::dom::bindings::reflector::DomObject;
9use crate::dom::bindings::root::DomRoot;
10use crate::dom::bindings::trace::JSTraceable;
11use crate::dom::webgl::webglrenderingcontext::WebGLRenderingContext;
12use crate::script_runtime::CanGc;
13
14pub(crate) trait WebGLExtension: Sized
16where
17 Self::Extension: DomObject + JSTraceable,
18{
19 #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
20 type Extension;
21
22 fn new(ctx: &WebGLRenderingContext, can_gc: CanGc) -> DomRoot<Self::Extension>;
24
25 fn spec() -> WebGLExtensionSpec;
27
28 fn is_supported(ext: &WebGLExtensions) -> bool;
30
31 fn enable(ext: &WebGLExtensions);
33
34 fn name() -> &'static str;
36}
37
38pub(crate) enum WebGLExtensionSpec {
39 All,
41 Specific(WebGLVersion),
43}