Fix a small texSubImage2D bug

This commit is contained in:
Anthony Ramine 2018-09-18 10:49:31 +02:00
parent 8c100b23b1
commit fe6f53ffb4
2 changed files with 6 additions and 8 deletions

View file

@ -3613,7 +3613,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
height: i32,
format: u32,
data_type: u32,
mut pixels: CustomAutoRooterGuard<Option<ArrayBufferView>>,
pixels: CustomAutoRooterGuard<Option<ArrayBufferView>>,
) -> ErrorResult {
let validator = TexImage2DValidator::new(self, target, level,
format, width, height,
@ -3644,10 +3644,11 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// If data is null, a buffer of sufficient size
// initialized to 0 is passed.
let buff = match *pixels {
None => vec![0u8; expected_byte_length as usize],
Some(ref mut data) => data.to_vec(),
};
let buff = handle_potential_webgl_error!(
self,
pixels.as_ref().map(|p| p.to_vec()).ok_or(InvalidValue),
return Ok(())
);
// From the WebGL spec:
//