Auto merge of #20565 - servo:webgl, r=emilio

Daily batch of drive-by WebGL improvements, wholesome and gluten-free

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20565)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-04-06 05:52:06 -04:00 committed by GitHub
commit c096629939
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 15 deletions

View file

@ -95,11 +95,14 @@ impl WebGLRenderbuffer {
// validation.
match internal_format {
constants::RGBA4 |
constants::DEPTH_STENCIL |
constants::RGB565 |
constants::RGB5_A1 |
constants::DEPTH_COMPONENT16 |
constants::STENCIL_INDEX8 =>
self.internal_format.set(Some(internal_format)),
constants::STENCIL_INDEX8 |
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#6.7
constants::DEPTH_STENCIL => {
self.internal_format.set(Some(internal_format))
}
_ => return Err(WebGLError::InvalidEnum),
};

View file

@ -11,7 +11,6 @@ use canvas_traits::webgl::DOMToTextureCommand;
use canvas_traits::webgl::WebGLError::*;
use canvas_traits::webgl::webgl_channel;
use dom::bindings::cell::DomRefCell;
use dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextConstants as WebGL2Constants;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{self, WebGLContextAttributes};
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
@ -1576,12 +1575,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.6
fn BindFramebuffer(&self, target: u32, framebuffer: Option<&WebGLFramebuffer>) {
if target == WebGL2Constants::READ_FRAMEBUFFER {
return self.webgl_error(InvalidEnum);
}
if target != constants::FRAMEBUFFER {
return self.webgl_error(InvalidOperation);
return self.webgl_error(InvalidEnum);
}
if let Some(framebuffer) = framebuffer {
@ -3523,7 +3518,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
//
// "target must be RENDERBUFFER."
if target != constants::RENDERBUFFER {
return self.webgl_error(InvalidOperation)
return self.webgl_error(InvalidEnum);
}
// From the GLES 2.0.25 spec:

View file

@ -1,9 +1,17 @@
[tex-input-validation.html]
type: testharness
expected: CRASH
[WebGL test #3: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
[WebGL test #34: getError expected: INVALID_OPERATION. Was NO_ERROR : colorBufferFormat: RGB565 internalFormat: RGBA target: TEXTURE_2D border: 0]
expected: FAIL
[WebGL test #20: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
[WebGL test #37: getError expected: NO_ERROR. Was INVALID_OPERATION : colorBufferFormat: RGB565 internalFormat: RGB target: TEXTURE_2D border: 0]
expected: FAIL
[WebGL test #45: getError expected: INVALID_OPERATION. Was NO_ERROR : colorBufferFormat: RGB565 internalFormat: RGBA target: TEXTURE_2D]
expected: FAIL
[WebGL test #53: getError expected: INVALID_OPERATION. Was NO_ERROR : colorBufferFormat: RGB internalFormat: RGBA]
expected: FAIL
[WebGL test #61: getError expected: INVALID_OPERATION. Was NO_ERROR : colorBufferFormat: RGB internalFormat: RGBA]
expected: FAIL

View file

@ -95,6 +95,6 @@
[WebGL test #55: getError expected: NO_ERROR. Was INVALID_ENUM : bind read framebuffer to default (null) framebuffer.]
expected: FAIL
[WebGL test #56: getError expected: NO_ERROR. Was INVALID_OPERATION : bind draw framebuffer to default (null) framebuffer.]
[WebGL test #56: getError expected: NO_ERROR. Was INVALID_ENUM : bind draw framebuffer to default (null) framebuffer.]
expected: FAIL