mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Check the bound buffer element array only for count > 0 in gl.drawElements
See https://www.khronos.org/registry/webgl/specs/latest/1.0/#6.2
This commit is contained in:
parent
7f1590dac0
commit
d16a73001f
1 changed files with 13 additions and 11 deletions
|
@ -2183,19 +2183,21 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
return self.webgl_error(InvalidOperation);
|
||||
}
|
||||
|
||||
if let Some(array_buffer) = self.bound_buffer_element_array.get() {
|
||||
// WebGL Spec: check buffer overflows, must be a valid multiple of the size.
|
||||
let val = offset as u64 + (count as u64 * type_size as u64);
|
||||
if val > array_buffer.capacity() as u64 {
|
||||
if count > 0 {
|
||||
if let Some(array_buffer) = self.bound_buffer_element_array.get() {
|
||||
// WebGL Spec: check buffer overflows, must be a valid multiple of the size.
|
||||
let val = offset as u64 + (count as u64 * type_size as u64);
|
||||
if val > array_buffer.capacity() as u64 {
|
||||
return self.webgl_error(InvalidOperation);
|
||||
}
|
||||
} else {
|
||||
// From the WebGL spec
|
||||
//
|
||||
// a non-null WebGLBuffer must be bound to the ELEMENT_ARRAY_BUFFER binding point
|
||||
// or an INVALID_OPERATION error will be generated.
|
||||
//
|
||||
return self.webgl_error(InvalidOperation);
|
||||
}
|
||||
} else {
|
||||
// From the WebGL spec
|
||||
//
|
||||
// a non-null WebGLBuffer must be bound to the ELEMENT_ARRAY_BUFFER binding point
|
||||
// or an INVALID_OPERATION error will be generated.
|
||||
//
|
||||
return self.webgl_error(InvalidOperation);
|
||||
}
|
||||
|
||||
if !self.validate_framebuffer_complete() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue