aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webgl_validations
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2018-04-09 11:55:32 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2018-04-09 14:44:02 +0200
commitfcb6d5112e62e74cf224e88d8693dce6983b281e (patch)
treed304298f21b1ac6286bbd317aa3d75a2c2333797 /components/script/dom/webgl_validations
parent68898f4ebd1a9112b7281ec766a725e24c62205e (diff)
downloadservo-fcb6d5112e62e74cf224e88d8693dce6983b281e.tar.gz
servo-fcb6d5112e62e74cf224e88d8693dce6983b281e.zip
Properly check for cubic dimensions in gl.copyTexImage2D
Diffstat (limited to 'components/script/dom/webgl_validations')
-rw-r--r--components/script/dom/webgl_validations/tex_image_2d.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/components/script/dom/webgl_validations/tex_image_2d.rs b/components/script/dom/webgl_validations/tex_image_2d.rs
index dc180729902..8a1b9ad9c16 100644
--- a/components/script/dom/webgl_validations/tex_image_2d.rs
+++ b/components/script/dom/webgl_validations/tex_image_2d.rs
@@ -151,6 +151,13 @@ impl<'a> WebGLValidator for CommonTexImage2DValidator<'a> {
}
};
+ // GL_INVALID_VALUE is generated if target is one of the six cube map 2D
+ // image targets and the width and height parameters are not equal.
+ if target.is_cubic() && self.width != self.height {
+ self.context.webgl_error(InvalidValue);
+ return Err(TexImageValidationError::InvalidCubicTextureDimensions);
+ }
+
// GL_INVALID_VALUE is generated if level is less than 0.
if self.level < 0 {
self.context.webgl_error(InvalidValue);
@@ -287,13 +294,6 @@ impl<'a> WebGLValidator for TexImage2DValidator<'a> {
border,
} = self.common_validator.validate()?;
- // GL_INVALID_VALUE is generated if target is one of the six cube map 2D
- // image targets and the width and height parameters are not equal.
- if target.is_cubic() && width != height {
- context.webgl_error(InvalidValue);
- return Err(TexImageValidationError::InvalidCubicTextureDimensions);
- }
-
// GL_INVALID_ENUM is generated if format or data_type is not an
// accepted value.
let data_type = match TexDataType::from_gl_constant(self.data_type) {