Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webgl: Do validation of glScissor/glViewport(width, height) on the DOM side #13060

Merged
merged 1 commit into from Aug 29, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

webgl: Do validation of glScissor/glViewport(width, height) on the DO…

…M side.

Avoids testcase CRASHes due to unexpected GL errors.
  • Loading branch information
anholt committed Aug 26, 2016
commit b8b74e4b37dd9488ddef6362098aa45b5d6d3a3c
@@ -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()
@@ -1,3 +1,124 @@
[invalid-passed-params.html]
type: testharness
expected: CRASH
[WebGL test #4: getError expected: INVALID_VALUE. Was NO_ERROR : after evaluating: context.clear(desktopGL['ACCUM_BUFFER_BIT'\])]
expected: FAIL

[WebGL test #5: getError expected: INVALID_VALUE. Was NO_ERROR : after evaluating: context.clear(desktopGL['ACCUM_BUFFER_BIT'\] | context.COLOR_BUFFER_BIT)]
expected: FAIL

[WebGL test #6: getError expected: INVALID_VALUE. Was NO_ERROR : after evaluating: context.clear(desktopGL['ACCUM_BUFFER_BIT'\] | context.COLOR_BUFFER_BIT | context.DEPTH_BUFFER_BIT | context.STENCIL_BUFFER_BIT)]
expected: FAIL

[WebGL test #9: context.bufferData(context.ARRAY_BUFFER, 16, context.STREAM_DRAW) threw exception TypeError: Value is not an object.]
expected: FAIL

[WebGL test #10: context.bufferData(context.ARRAY_BUFFER, 16, context.STATIC_DRAW) threw exception TypeError: Value is not an object.]
expected: FAIL

[WebGL test #11: context.bufferData(context.ARRAY_BUFFER, 16, context.DYNAMIC_DRAW) threw exception TypeError: Value is not an object.]
expected: FAIL

[WebGL test #12: context.bufferData(context.ARRAY_BUFFER, 16, desktopGL['STREAM_READ'\]) threw exception TypeError: Value is not an object.]
expected: FAIL

[WebGL test #13: context.bufferData(context.ARRAY_BUFFER, 16, desktopGL['STREAM_COPY'\]) threw exception TypeError: Value is not an object.]
expected: FAIL

[WebGL test #14: context.bufferData(context.ARRAY_BUFFER, 16, desktopGL['STATIC_READ'\]) threw exception TypeError: Value is not an object.]
expected: FAIL

[WebGL test #15: context.bufferData(context.ARRAY_BUFFER, 16, desktopGL['STATIC_COPY'\]) threw exception TypeError: Value is not an object.]
expected: FAIL

[WebGL test #16: context.bufferData(context.ARRAY_BUFFER, 16, desktopGL['DYNAMIC_READ'\]) threw exception TypeError: Value is not an object.]
expected: FAIL

[WebGL test #17: context.bufferData(context.ARRAY_BUFFER, 16, desktopGL['DYNAMIC_COPY'\]) threw exception TypeError: Value is not an object.]
expected: FAIL

[WebGL test #19: context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, -16, -16, 0, context.RGBA, context.UNSIGNED_BYTE, null) threw exception TypeError: Value is not an object.]
expected: FAIL

[WebGL test #20: context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 16, 16, 0, context.RGBA, context.UNSIGNED_BYTE, null) threw exception TypeError: Value is not an object.]
expected: FAIL

[WebGL test #23: getError expected: NO_ERROR. Was INVALID_VALUE : after evaluating: context.texSubImage2D(context.TEXTURE_2D, 0, 0, 0, 2, 2, context.RGBA, context.UNSIGNED_BYTE, pixels)]
expected: FAIL

[WebGL test #30: context.renderbufferStorage(context.RENDERBUFFER, context.RGBA4, -2, -2) threw exception TypeError: context.renderbufferStorage is not a function]
expected: FAIL

[WebGL test #31: context.renderbufferStorage(context.RENDERBUFFER, context.RGBA4, 16, 16) threw exception TypeError: context.renderbufferStorage is not a function]
expected: FAIL

[WebGL test #44: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #46: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #48: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #50: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #52: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #54: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #55: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #56: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #57: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #58: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #59: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #60: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #61: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #62: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #63: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #64: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #65: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #66: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #67: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #68: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #69: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #70: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #71: context.getError() should be 1281. Was 0.]
expected: FAIL

[WebGL test #72: context.getError() should be 1281. Was 0.]
expected: FAIL
@@ -1,10 +1,4 @@
[gl-geterror.html]
type: testharness
expected:
if os == "mac": CRASH
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
[WebGL test #2: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL

[WebGL test #1: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.