mirror of
https://github.com/servo/servo.git
synced 2025-08-11 00:15:32 +01:00
webgl: Fix up maximum size validation.
We were checking to see if it was too big to be level 0, but we really want to see if it's too big to be the given level. This was the last remaining failure in texture-size-limit.html.
This commit is contained in:
parent
2f68297051
commit
5b852b1cdd
2 changed files with 8 additions and 191 deletions
|
@ -163,18 +163,18 @@ impl<'a> WebGLValidator for CommonTexImage2DValidator<'a> {
|
|||
return Err(TexImageValidationError::NegativeDimension);
|
||||
}
|
||||
|
||||
// GL_INVALID_VALUE is generated if width or height is greater than
|
||||
// GL_MAX_TEXTURE_SIZE when target is GL_TEXTURE_2D or
|
||||
// GL_MAX_CUBE_MAP_TEXTURE_SIZE when target is not GL_TEXTURE_2D.
|
||||
if self.width as u32 > max_size || self.height as u32 > max_size {
|
||||
self.context.webgl_error(InvalidValue);
|
||||
return Err(TexImageValidationError::TextureTooBig);
|
||||
}
|
||||
|
||||
let width = self.width as u32;
|
||||
let height = self.height as u32;
|
||||
let level = self.level as u32;
|
||||
|
||||
// GL_INVALID_VALUE is generated if width or height is greater than
|
||||
// GL_MAX_TEXTURE_SIZE when target is GL_TEXTURE_2D or
|
||||
// GL_MAX_CUBE_MAP_TEXTURE_SIZE when target is not GL_TEXTURE_2D.
|
||||
if width > max_size >> level || height > max_size >> level {
|
||||
self.context.webgl_error(InvalidValue);
|
||||
return Err(TexImageValidationError::TextureTooBig);
|
||||
}
|
||||
|
||||
// GL_INVALID_VALUE is generated if level is greater than zero and the
|
||||
// texture is not power of two.
|
||||
if level > 0 && (!width.is_power_of_two() || !height.is_power_of_two()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue