script/dom/webgl/extensions/
extension.rs1use js::context::JSContext;
6use script_bindings::reflector::DomObject;
7use servo_canvas_traits::webgl::WebGLVersion;
8
9use super::WebGLExtensions;
10use crate::dom::bindings::root::DomRoot;
11use crate::dom::bindings::trace::JSTraceable;
12use crate::dom::webgl::webglrenderingcontext::WebGLRenderingContext;
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(cx: &mut JSContext, ctx: &WebGLRenderingContext) -> 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}