зеркало из https://github.com/mozilla/gecko-dev.git
Source-Repo: https://github.com/servo/servo Source-Revision: 4a6453ac9ad956502ec6d39093b83820d94a409e --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 4a9cc25b7e4a711d31a658e59ed4b37dc1b4f912
This commit is contained in:
Родитель
19fa52aa34
Коммит
4a6c64ca20
|
@ -185,18 +185,17 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
||||||
fn AttachShader(&self, program: Option<&WebGLProgram>, shader: Option<&WebGLShader>) {
|
fn AttachShader(&self, program: &WebGLProgram, shader: &WebGLShader) {
|
||||||
self.base.AttachShader(program, shader)
|
self.base.AttachShader(program, shader)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
||||||
fn DetachShader(&self, program: Option<&WebGLProgram>, shader: Option<&WebGLShader>) {
|
fn DetachShader(&self, program: &WebGLProgram, shader: &WebGLShader) {
|
||||||
self.base.DetachShader(program, shader)
|
self.base.DetachShader(program, shader)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
||||||
fn BindAttribLocation(&self, program: Option<&WebGLProgram>,
|
fn BindAttribLocation(&self, program: &WebGLProgram, index: u32, name: DOMString) {
|
||||||
index: u32, name: DOMString) {
|
|
||||||
self.base.BindAttribLocation(program, index, name)
|
self.base.BindAttribLocation(program, index, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
|
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
|
||||||
use super::{ext_constants, WebGLExtension, WebGLExtensions, WebGLExtensionSpec};
|
use super::{ext_constants, WebGLExtension, WebGLExtensions, WebGLExtensionSpec};
|
||||||
|
|
||||||
|
pub mod oeselementindexuint;
|
||||||
pub mod oesstandardderivatives;
|
pub mod oesstandardderivatives;
|
||||||
pub mod oestexturefloat;
|
pub mod oestexturefloat;
|
||||||
pub mod oestexturefloatlinear;
|
pub mod oestexturefloatlinear;
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
/* 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::OESElementIndexUintBinding;
|
||||||
|
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 OESElementIndexUint {
|
||||||
|
reflector_: Reflector,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl OESElementIndexUint {
|
||||||
|
fn new_inherited() -> Self {
|
||||||
|
Self { reflector_: Reflector::new() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WebGLExtension for OESElementIndexUint {
|
||||||
|
type Extension = Self;
|
||||||
|
|
||||||
|
fn new(ctx: &WebGLRenderingContext) -> DomRoot<Self> {
|
||||||
|
reflect_dom_object(
|
||||||
|
Box::new(OESElementIndexUint::new_inherited()),
|
||||||
|
&*ctx.global(),
|
||||||
|
OESElementIndexUintBinding::Wrap,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn spec() -> WebGLExtensionSpec {
|
||||||
|
WebGLExtensionSpec::Specific(WebGLVersion::WebGL1)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_supported(ext: &WebGLExtensions) -> bool {
|
||||||
|
ext.supports_gl_extension("GL_OES_element_index_uint")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn enable(ext: &WebGLExtensions) {
|
||||||
|
ext.enable_element_index_uint();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn name() -> &'static str {
|
||||||
|
"OES_element_index_uint"
|
||||||
|
}
|
||||||
|
}
|
|
@ -57,17 +57,20 @@ struct WebGLExtensionFeatures {
|
||||||
hint_targets: FnvHashSet<GLenum>,
|
hint_targets: FnvHashSet<GLenum>,
|
||||||
/// WebGL GetParameter() names enabled by extensions.
|
/// WebGL GetParameter() names enabled by extensions.
|
||||||
disabled_get_parameter_names: FnvHashSet<GLenum>,
|
disabled_get_parameter_names: FnvHashSet<GLenum>,
|
||||||
|
/// WebGL OES_element_index_uint extension.
|
||||||
|
element_index_uint_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WebGLExtensionFeatures {
|
impl WebGLExtensionFeatures {
|
||||||
fn new(webgl_version: WebGLVersion) -> Self {
|
fn new(webgl_version: WebGLVersion) -> Self {
|
||||||
let (disabled_tex_types, disabled_get_parameter_names) = match webgl_version {
|
let (disabled_tex_types, disabled_get_parameter_names, element_index_uint_enabled) = match webgl_version {
|
||||||
WebGLVersion::WebGL1 => {
|
WebGLVersion::WebGL1 => {
|
||||||
(DEFAULT_DISABLED_TEX_TYPES_WEBGL1.iter().cloned().collect(),
|
(DEFAULT_DISABLED_TEX_TYPES_WEBGL1.iter().cloned().collect(),
|
||||||
DEFAULT_DISABLED_GET_PARAMETER_NAMES_WEBGL1.iter().cloned().collect())
|
DEFAULT_DISABLED_GET_PARAMETER_NAMES_WEBGL1.iter().cloned().collect(),
|
||||||
|
false)
|
||||||
},
|
},
|
||||||
WebGLVersion::WebGL2 => {
|
WebGLVersion::WebGL2 => {
|
||||||
(Default::default(), Default::default())
|
(Default::default(), Default::default(), true)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Self {
|
Self {
|
||||||
|
@ -78,6 +81,7 @@ impl WebGLExtensionFeatures {
|
||||||
query_parameter_handlers: Default::default(),
|
query_parameter_handlers: Default::default(),
|
||||||
hint_targets: Default::default(),
|
hint_targets: Default::default(),
|
||||||
disabled_get_parameter_names,
|
disabled_get_parameter_names,
|
||||||
|
element_index_uint_enabled,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +100,7 @@ impl WebGLExtensions {
|
||||||
Self {
|
Self {
|
||||||
extensions: DomRefCell::new(HashMap::new()),
|
extensions: DomRefCell::new(HashMap::new()),
|
||||||
features: DomRefCell::new(WebGLExtensionFeatures::new(webgl_version)),
|
features: DomRefCell::new(WebGLExtensionFeatures::new(webgl_version)),
|
||||||
webgl_version
|
webgl_version,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,6 +244,14 @@ impl WebGLExtensions {
|
||||||
self.register::<ext::oestexturehalffloatlinear::OESTextureHalfFloatLinear>();
|
self.register::<ext::oestexturehalffloatlinear::OESTextureHalfFloatLinear>();
|
||||||
self.register::<ext::oesvertexarrayobject::OESVertexArrayObject>();
|
self.register::<ext::oesvertexarrayobject::OESVertexArrayObject>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn enable_element_index_uint(&self) {
|
||||||
|
self.features.borrow_mut().element_index_uint_enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_element_index_uint_enabled(&self) -> bool {
|
||||||
|
self.features.borrow().element_index_uint_enabled
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper structs
|
// Helper structs
|
||||||
|
|
|
@ -1514,30 +1514,19 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
||||||
fn AttachShader(&self, program: Option<&WebGLProgram>, shader: Option<&WebGLShader>) {
|
fn AttachShader(&self, program: &WebGLProgram, shader: &WebGLShader) {
|
||||||
if let Some(program) = program {
|
|
||||||
if let Some(shader) = shader {
|
|
||||||
handle_potential_webgl_error!(self, program.attach_shader(shader));
|
handle_potential_webgl_error!(self, program.attach_shader(shader));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
||||||
fn DetachShader(&self, program: Option<&WebGLProgram>, shader: Option<&WebGLShader>) {
|
fn DetachShader(&self, program: &WebGLProgram, shader: &WebGLShader) {
|
||||||
if let Some(program) = program {
|
|
||||||
if let Some(shader) = shader {
|
|
||||||
handle_potential_webgl_error!(self, program.detach_shader(shader));
|
handle_potential_webgl_error!(self, program.detach_shader(shader));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
||||||
fn BindAttribLocation(&self, program: Option<&WebGLProgram>,
|
fn BindAttribLocation(&self, program: &WebGLProgram, index: u32, name: DOMString) {
|
||||||
index: u32, name: DOMString) {
|
|
||||||
if let Some(program) = program {
|
|
||||||
handle_potential_webgl_error!(self, program.bind_attrib_location(index, name));
|
handle_potential_webgl_error!(self, program.bind_attrib_location(index, name));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
|
||||||
fn BindBuffer(&self, target: u32, buffer: Option<&WebGLBuffer>) {
|
fn BindBuffer(&self, target: u32, buffer: Option<&WebGLBuffer>) {
|
||||||
|
@ -2174,6 +2163,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
let type_size = match type_ {
|
let type_size = match type_ {
|
||||||
constants::UNSIGNED_BYTE => 1,
|
constants::UNSIGNED_BYTE => 1,
|
||||||
constants::UNSIGNED_SHORT => 2,
|
constants::UNSIGNED_SHORT => 2,
|
||||||
|
constants::UNSIGNED_INT if self.extension_manager.is_element_index_uint_enabled() => 4,
|
||||||
_ => return self.webgl_error(InvalidEnum),
|
_ => return self.webgl_error(InvalidEnum),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
/* 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/. */
|
||||||
|
/*
|
||||||
|
* WebGL IDL definitions from the Khronos specification:
|
||||||
|
* https://www.khronos.org/registry/webgl/extensions/OES_element_index_uint/
|
||||||
|
*/
|
||||||
|
|
||||||
|
[NoInterfaceObject]
|
||||||
|
interface OESElementIndexUint {
|
||||||
|
};
|
|
@ -475,8 +475,8 @@ interface WebGLRenderingContextBase
|
||||||
object? getExtension(DOMString name);
|
object? getExtension(DOMString name);
|
||||||
|
|
||||||
void activeTexture(GLenum texture);
|
void activeTexture(GLenum texture);
|
||||||
void attachShader(WebGLProgram? program, WebGLShader? shader);
|
void attachShader(WebGLProgram program, WebGLShader shader);
|
||||||
void bindAttribLocation(WebGLProgram? program, GLuint index, DOMString name);
|
void bindAttribLocation(WebGLProgram program, GLuint index, DOMString name);
|
||||||
void bindBuffer(GLenum target, WebGLBuffer? buffer);
|
void bindBuffer(GLenum target, WebGLBuffer? buffer);
|
||||||
void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer);
|
void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer);
|
||||||
void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer);
|
void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer);
|
||||||
|
@ -559,7 +559,7 @@ interface WebGLRenderingContextBase
|
||||||
void depthFunc(GLenum func);
|
void depthFunc(GLenum func);
|
||||||
void depthMask(GLboolean flag);
|
void depthMask(GLboolean flag);
|
||||||
void depthRange(GLclampf zNear, GLclampf zFar);
|
void depthRange(GLclampf zNear, GLclampf zFar);
|
||||||
void detachShader(WebGLProgram? program, WebGLShader? shader);
|
void detachShader(WebGLProgram program, WebGLShader shader);
|
||||||
void disable(GLenum cap);
|
void disable(GLenum cap);
|
||||||
void disableVertexAttribArray(GLuint index);
|
void disableVertexAttribArray(GLuint index);
|
||||||
void drawArrays(GLenum mode, GLint first, GLsizei count);
|
void drawArrays(GLenum mode, GLint first, GLsizei count);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче