Properly implement the checks for gl.renderbufferStorage (fixes #20563)

This commit is contained in:
Anthony Ramine 2018-07-09 10:32:09 +02:00
parent fc0e403fb0
commit ef7d495838
2 changed files with 4 additions and 19 deletions

View file

@ -106,8 +106,6 @@ impl WebGLRenderbuffer {
_ => return Err(WebGLError::InvalidEnum), _ => return Err(WebGLError::InvalidEnum),
}; };
// FIXME: Check that w/h are < MAX_RENDERBUFFER_SIZE
// FIXME: Invalidate completeness after the call // FIXME: Invalidate completeness after the call
let msg = WebGLCommand::RenderbufferStorage(constants::RENDERBUFFER, internal_format, width, height); let msg = WebGLCommand::RenderbufferStorage(constants::RENDERBUFFER, internal_format, width, height);

View file

@ -3863,27 +3863,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
} }
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.7 // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.7
fn RenderbufferStorage(&self, target: u32, internal_format: u32, fn RenderbufferStorage(&self, target: u32, internal_format: u32, width: i32, height: i32) {
width: i32, height: i32) {
// From the GLES 2.0.25 spec:
//
// "target must be RENDERBUFFER."
if target != constants::RENDERBUFFER { if target != constants::RENDERBUFFER {
return self.webgl_error(InvalidEnum); return self.webgl_error(InvalidEnum);
} }
// From the GLES 2.0.25 spec: let max = self.limits.max_renderbuffer_size;
//
// "If either width or height is greater than the value of if width < 0 || width as u32 > max || height < 0 || height as u32 > max {
// MAX_RENDERBUFFER_SIZE , the error INVALID_VALUE is
// generated."
//
// and we have to throw out negative-size values as well just
// like for TexImage.
//
// FIXME: Handle max_renderbuffer_size, which doesn't seem to
// be in limits.
if width < 0 || height < 0 {
return self.webgl_error(InvalidValue); return self.webgl_error(InvalidValue);
} }