diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2018-05-25 14:58:50 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2018-06-06 12:24:47 +0200 |
commit | f1288cc6e0a52d377619f0ec9634eefd29ba15dc (patch) | |
tree | de9787bb29bf8adb2b759774bab0064c27cf44b2 /components/script/dom/webgl_extensions/ext | |
parent | eb1dfd07756f690dfbebae2e53447bc747c5763a (diff) | |
download | servo-f1288cc6e0a52d377619f0ec9634eefd29ba15dc.tar.gz servo-f1288cc6e0a52d377619f0ec9634eefd29ba15dc.zip |
Implement EXT_texture_filter_anisotropic
Diffstat (limited to 'components/script/dom/webgl_extensions/ext')
-rw-r--r-- | components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs | 54 | ||||
-rw-r--r-- | components/script/dom/webgl_extensions/ext/mod.rs | 1 |
2 files changed, 55 insertions, 0 deletions
diff --git a/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs b/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs new file mode 100644 index 00000000000..203f4da6251 --- /dev/null +++ b/components/script/dom/webgl_extensions/ext/exttexturefilteranisotropic.rs @@ -0,0 +1,54 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use canvas_traits::webgl::WebGLVersion; +use dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding; +use dom::bindings::codegen::Bindings::EXTTextureFilterAnisotropicBinding::EXTTextureFilterAnisotropicConstants; +use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; +use dom::bindings::root::DomRoot; +use dom::webglrenderingcontext::WebGLRenderingContext; +use dom_struct::dom_struct; +use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; + +#[dom_struct] +pub struct EXTTextureFilterAnisotropic { + reflector_: Reflector, +} + +impl EXTTextureFilterAnisotropic { + fn new_inherited() -> EXTTextureFilterAnisotropic { + Self { + reflector_: Reflector::new(), + } + } +} + +impl WebGLExtension for EXTTextureFilterAnisotropic { + type Extension = EXTTextureFilterAnisotropic; + + fn new(ctx: &WebGLRenderingContext) -> DomRoot<Self> { + reflect_dom_object( + Box::new(Self::new_inherited()), + &*ctx.global(), + EXTTextureFilterAnisotropicBinding::Wrap, + ) + } + + fn spec() -> WebGLExtensionSpec { + WebGLExtensionSpec::Specific(WebGLVersion::WebGL1) + } + + fn is_supported(ext: &WebGLExtensions) -> bool { + ext.supports_gl_extension("GL_EXT_texture_filter_anisotropic") + } + + fn enable(ext: &WebGLExtensions) { + ext.enable_get_tex_parameter_name(EXTTextureFilterAnisotropicConstants::TEXTURE_MAX_ANISOTROPY_EXT); + ext.enable_get_parameter_name(EXTTextureFilterAnisotropicConstants::MAX_TEXTURE_MAX_ANISOTROPY_EXT); + } + + fn name() -> &'static str { + "EXT_texture_filter_anisotropic" + } +} diff --git a/components/script/dom/webgl_extensions/ext/mod.rs b/components/script/dom/webgl_extensions/ext/mod.rs index b4b58fd10e1..e0c7b1f189a 100644 --- a/components/script/dom/webgl_extensions/ext/mod.rs +++ b/components/script/dom/webgl_extensions/ext/mod.rs @@ -6,6 +6,7 @@ use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderi use super::{ext_constants, WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; pub mod extshadertexturelod; +pub mod exttexturefilteranisotropic; pub mod oeselementindexuint; pub mod oesstandardderivatives; pub mod oestexturefloat; |