Auto merge of #26025 - szeged:webgl_draw_range_elements, r=jdm

Add support for DrawRangeElements in WebGL2

Adds initial support for the WebGL2 `DrawRangeElements` call.

<!-- Please describe your changes on the following line: -->
I have started working on this function, but not sure how could I check for the Uniform Block Backing (https://www.khronos.org/registry/webgl/specs/latest/2.0/#ACTIVE_UNIFORM_BLOCK_BACKING).
I am looking for some advice.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] There are tests for these changes

cc @mmatyas @zakorgy @jdm
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2020-03-30 13:59:05 -04:00 committed by GitHub
commit 69004e43dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 {