Add support for filtering WebGL extensions based on WebGL version

This commit is contained in:
Imanol Fernandez 2017-10-27 17:06:53 +02:00
parent d21657a9e5
commit f2f5817f56
13 changed files with 87 additions and 25 deletions

View file

@ -2,7 +2,7 @@
* 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::{webgl_channel, WebGLCommand, WebGLError};
use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLError, WebGLVersion};
use dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::{self, OESVertexArrayObjectMethods};
use dom::bindings::codegen::Bindings::OESVertexArrayObjectBinding::OESVertexArrayObjectConstants;
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
@ -14,7 +14,7 @@ use js::conversions::ToJSValConvertible;
use js::jsapi::JSContext;
use js::jsval::{JSVal, NullValue};
use std::iter;
use super::{WebGLExtension, WebGLExtensions};
use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec};
#[dom_struct]
pub struct OESVertexArrayObject {
@ -138,6 +138,10 @@ impl WebGLExtension for OESVertexArrayObject {
OESVertexArrayObjectBinding::Wrap)
}
fn spec() -> WebGLExtensionSpec {
WebGLExtensionSpec::Specific(WebGLVersion::WebGL1)
}
fn is_supported(ext: &WebGLExtensions) -> bool {
ext.supports_any_gl_extension(&["GL_OES_vertex_array_object",
"GL_ARB_vertex_array_object",