script/dom/webgl/extensions/ext/
webglcolorbufferfloat.rs1use dom_struct::dom_struct;
6use js::context::JSContext;
7use script_bindings::reflector::{Reflector, reflect_dom_object_with_cx};
8use servo_canvas_traits::webgl::WebGLVersion;
9
10use super::{WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
11use crate::dom::bindings::reflector::DomGlobal;
12use crate::dom::bindings::root::DomRoot;
13use crate::dom::webgl::extensions::oestexturefloat::OESTextureFloat;
14use crate::dom::webgl::webglrenderingcontext::WebGLRenderingContext;
15
16#[dom_struct]
17pub(crate) struct WEBGLColorBufferFloat {
18 reflector_: Reflector,
19}
20
21impl WEBGLColorBufferFloat {
22 fn new_inherited() -> WEBGLColorBufferFloat {
23 Self {
24 reflector_: Reflector::new(),
25 }
26 }
27}
28
29impl WebGLExtension for WEBGLColorBufferFloat {
30 type Extension = WEBGLColorBufferFloat;
31 fn new(cx: &mut JSContext, ctx: &WebGLRenderingContext) -> DomRoot<WEBGLColorBufferFloat> {
32 reflect_dom_object_with_cx(Box::new(Self::new_inherited()), &*ctx.global(), cx)
33 }
34
35 fn spec() -> WebGLExtensionSpec {
36 WebGLExtensionSpec::Specific(WebGLVersion::WebGL1)
37 }
38
39 fn is_supported(ext: &WebGLExtensions) -> bool {
40 OESTextureFloat::is_supported(ext)
41 }
42
43 fn enable(_ext: &WebGLExtensions) {}
44
45 fn name() -> &'static str {
46 "WEBGL_color_buffer_float"
47 }
48}