mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement OES_element_index_uint (fixes #20384)
This commit is contained in:
parent
8061d8c3d2
commit
838d1305ca
6 changed files with 127 additions and 5 deletions
|
@ -57,17 +57,20 @@ struct WebGLExtensionFeatures {
|
|||
hint_targets: FnvHashSet<GLenum>,
|
||||
/// WebGL GetParameter() names enabled by extensions.
|
||||
disabled_get_parameter_names: FnvHashSet<GLenum>,
|
||||
/// WebGL OES_element_index_uint extension.
|
||||
element_index_uint_enabled: bool,
|
||||
}
|
||||
|
||||
impl WebGLExtensionFeatures {
|
||||
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 => {
|
||||
(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 => {
|
||||
(Default::default(), Default::default())
|
||||
(Default::default(), Default::default(), true)
|
||||
}
|
||||
};
|
||||
Self {
|
||||
|
@ -78,6 +81,7 @@ impl WebGLExtensionFeatures {
|
|||
query_parameter_handlers: Default::default(),
|
||||
hint_targets: Default::default(),
|
||||
disabled_get_parameter_names,
|
||||
element_index_uint_enabled,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +100,7 @@ impl WebGLExtensions {
|
|||
Self {
|
||||
extensions: DomRefCell::new(HashMap::new()),
|
||||
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::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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue