webgl: Report invalid operations for more APIs that can't use an incomplete framebuffer.

This commit is contained in:
Josh Matthews 2019-09-19 17:38:46 -04:00
parent 540a73ed29
commit 46b1d8faee
2 changed files with 18 additions and 43 deletions

View file

@ -1241,9 +1241,17 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// GL_OES_read_format support (assuming an underlying GLES
// driver. Desktop is happy to format convert for us).
constants::IMPLEMENTATION_COLOR_READ_FORMAT => {
if self.validate_framebuffer().is_err() {
self.webgl_error(InvalidOperation);
return NullValue();
}
return Int32Value(constants::RGBA as i32);
},
constants::IMPLEMENTATION_COLOR_READ_TYPE => {
if self.validate_framebuffer().is_err() {
self.webgl_error(InvalidOperation);
return NullValue();
}
return Int32Value(constants::UNSIGNED_BYTE as i32);
},
constants::COMPRESSED_TEXTURE_FORMATS => unsafe {
@ -2819,6 +2827,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
pixel_type: u32,
mut pixels: CustomAutoRooterGuard<Option<ArrayBufferView>>,
) {
handle_potential_webgl_error!(self, self.validate_framebuffer(), return);
let pixels =
handle_potential_webgl_error!(self, pixels.as_mut().ok_or(InvalidValue), return);
@ -2834,7 +2844,6 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
return self.webgl_error(InvalidOperation);
}
handle_potential_webgl_error!(self, self.validate_framebuffer(), return);
let (fb_width, fb_height) = handle_potential_webgl_error!(
self,
self.get_current_framebuffer_size().ok_or(InvalidOperation),

View file

@ -1,58 +1,24 @@
[oes-texture-half-float.html]
[WebGL test #84: getError expected: INVALID_OPERATION. Was NO_ERROR : IMPLEMENTATION_COLOR_READ_TYPE should fail for incomplete framebuffers.]
[WebGL test #101: getError expected: NO_ERROR. Was INVALID_OPERATION : readPixels should return NO_ERROR when reading FLOAT data.]
expected: FAIL
[WebGL test #97: getError expected: INVALID_FRAMEBUFFER_OPERATION. Was INVALID_OPERATION : readPixels should fail on incomplete framebuffers.]
[WebGL test #103: Green channel should be 0.25 for FLOAT readPixels. Received: 0]
expected: FAIL
[WebGL test #89: gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE) should be null (of type object). Was 5121 (of type number).]
[WebGL test #104: Blue channel should be 0.5 for FLOAT readPixels. Received: 0]
expected: FAIL
[WebGL test #100: Green channel should be 0.25 for FLOAT readPixels. Received: 0]
[WebGL test #105: Alpha channel should be 0.75 for FLOAT readPixels. Received: 0]
expected: FAIL
[WebGL test #91: getError expected: INVALID_FRAMEBUFFER_OPERATION. Was INVALID_OPERATION : readPixels should fail on incomplete framebuffers.]
[WebGL test #110: getError expected: NO_ERROR. Was INVALID_OPERATION : readPixels should return NO_ERROR when reading FLOAT data.]
expected: FAIL
[WebGL test #88: getError expected: INVALID_OPERATION. Was NO_ERROR : IMPLEMENTATION_COLOR_READ_FORMAT should fail for incomplete framebuffers.]
[WebGL test #112: Green channel should be 0.25 for FLOAT readPixels. Received: 0]
expected: FAIL
[WebGL test #90: getError expected: INVALID_OPERATION. Was NO_ERROR : IMPLEMENTATION_COLOR_READ_TYPE should fail for incomplete framebuffers.]
[WebGL test #113: Blue channel should be 0.5 for FLOAT readPixels. Received: 0]
expected: FAIL
[WebGL test #95: gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE) should be null (of type object). Was 5121 (of type number).]
[WebGL test #114: Alpha channel should be 1 for FLOAT readPixels. Received: 0]
expected: FAIL
[WebGL test #85: getError expected: INVALID_FRAMEBUFFER_OPERATION. Was INVALID_OPERATION : readPixels should fail on incomplete framebuffers.]
expected: FAIL
[WebGL test #94: getError expected: INVALID_OPERATION. Was NO_ERROR : IMPLEMENTATION_COLOR_READ_FORMAT should fail for incomplete framebuffers.]
expected: FAIL
[WebGL test #101: Blue channel should be 0.5 for FLOAT readPixels. Received: 0]
expected: FAIL
[WebGL test #87: gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_FORMAT) should be null (of type object). Was 6408 (of type number).]
expected: FAIL
[WebGL test #83: gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE) should be null (of type object). Was 5121 (of type number).]
expected: FAIL
[WebGL test #81: gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_FORMAT) should be null (of type object). Was 6408 (of type number).]
expected: FAIL
[WebGL test #98: getError expected: NO_ERROR. Was INVALID_OPERATION : readPixels should return NO_ERROR when reading FLOAT data.]
expected: FAIL
[WebGL test #102: Alpha channel should be 0.75 for FLOAT readPixels. Received: 0]
expected: FAIL
[WebGL test #93: gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_FORMAT) should be null (of type object). Was 6408 (of type number).]
expected: FAIL
[WebGL test #96: getError expected: INVALID_OPERATION. Was NO_ERROR : IMPLEMENTATION_COLOR_READ_TYPE should fail for incomplete framebuffers.]
expected: FAIL
[WebGL test #82: getError expected: INVALID_OPERATION. Was NO_ERROR : IMPLEMENTATION_COLOR_READ_FORMAT should fail for incomplete framebuffers.]
expected: FAIL