Add support for DrawRangeElements in WebGL2

Adds initial support for the WebGL2 `DrawRangeElements` call.
This commit is contained in:
Istvan 2020-03-18 10:53:23 +01:00
parent c3ecf2ecef
commit bfa43fbeba
8 changed files with 216 additions and 108 deletions

View file

@ -960,7 +960,11 @@ impl WebGLRenderingContext {
let type_size = match type_ {
constants::UNSIGNED_BYTE => 1,
constants::UNSIGNED_SHORT => 2,
constants::UNSIGNED_INT if self.extension_manager.is_element_index_uint_enabled() => 4,
constants::UNSIGNED_INT => match self.webgl_version() {
WebGLVersion::WebGL1 if self.extension_manager.is_element_index_uint_enabled() => 4,
WebGLVersion::WebGL2 => 4,
_ => return Err(InvalidEnum),
},
_ => return Err(InvalidEnum),
};
if offset % type_size != 0 {