mirror of
https://github.com/servo/servo.git
synced 2025-06-12 18:34:39 +00:00
webgl: Do validation of glScissor/glViewport(width, height) on the DOM side.
Avoids testcase CRASHes due to unexpected GL errors.
This commit is contained in:
parent
545ae86dff
commit
b8b74e4b37
3 changed files with 131 additions and 8 deletions
|
@ -1481,6 +1481,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.4
|
||||
fn Scissor(&self, x: i32, y: i32, width: i32, height: i32) {
|
||||
if width < 0 || height < 0 {
|
||||
return self.webgl_error(InvalidValue)
|
||||
}
|
||||
|
||||
self.ipc_renderer
|
||||
.send(CanvasMsg::WebGL(WebGLCommand::Scissor(x, y, width, height)))
|
||||
.unwrap()
|
||||
|
@ -1893,6 +1897,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.4
|
||||
fn Viewport(&self, x: i32, y: i32, width: i32, height: i32) {
|
||||
if width < 0 || height < 0 {
|
||||
return self.webgl_error(InvalidValue)
|
||||
}
|
||||
|
||||
self.ipc_renderer
|
||||
.send(CanvasMsg::WebGL(WebGLCommand::Viewport(x, y, width, height)))
|
||||
.unwrap()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue