mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
webgl: Fix validation of drawElements()'s type argument.
Fixes crash due to unexpected GL errors in gl-drawelements.html.
This commit is contained in:
parent
9b4713f536
commit
15fa1a5a7d
2 changed files with 5 additions and 6 deletions
|
@ -1165,10 +1165,12 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11
|
||||
fn DrawElements(&self, mode: u32, count: i32, type_: u32, offset: i64) {
|
||||
// From the GLES 2.0.25 spec, page 21:
|
||||
//
|
||||
// "type must be one of UNSIGNED_BYTE or UNSIGNED_SHORT"
|
||||
let type_size = match type_ {
|
||||
constants::BYTE | constants::UNSIGNED_BYTE => 1,
|
||||
constants::SHORT | constants::UNSIGNED_SHORT => 2,
|
||||
constants::INT | constants::UNSIGNED_INT | constants::FLOAT => 4,
|
||||
constants::UNSIGNED_BYTE => 1,
|
||||
constants::UNSIGNED_SHORT => 2,
|
||||
_ => return self.webgl_error(InvalidEnum),
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue