diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2018-11-15 10:39:01 +0100 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2018-11-16 12:39:20 +0100 |
commit | 1c89ac90b9dd6e4a296e3fcfd71b4995910a96eb (patch) | |
tree | 49ce339e95049946d7dc5a55f3118f12367a614a | |
parent | 1675991b1216ce5358da49d8641857b24bfb2108 (diff) | |
download | servo-1c89ac90b9dd6e4a296e3fcfd71b4995910a96eb.tar.gz servo-1c89ac90b9dd6e4a296e3fcfd71b4995910a96eb.zip |
Send alignment info directly in TexImage2D and TexSubImage2d messages
-rw-r--r-- | components/canvas/webgl_thread.rs | 6 | ||||
-rw-r--r-- | components/canvas_traits/webgl.rs | 2 | ||||
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 22 |
3 files changed, 10 insertions, 20 deletions
diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index c1839e19e32..e8af815f976 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -1050,8 +1050,11 @@ impl WebGLImpl { height, format, data_type, + unpacking_alignment, ref receiver, } => { + ctx.gl() + .pixel_store_i(gl::UNPACK_ALIGNMENT, unpacking_alignment as i32); ctx.gl().tex_image_2d( target, level as i32, @@ -1073,8 +1076,11 @@ impl WebGLImpl { height, format, data_type, + unpacking_alignment, ref receiver, } => { + ctx.gl() + .pixel_store_i(gl::UNPACK_ALIGNMENT, unpacking_alignment as i32); ctx.gl().tex_sub_image_2d( target, level as i32, diff --git a/components/canvas_traits/webgl.rs b/components/canvas_traits/webgl.rs index ae12c9410e1..7b8bc8103a2 100644 --- a/components/canvas_traits/webgl.rs +++ b/components/canvas_traits/webgl.rs @@ -280,6 +280,7 @@ pub enum WebGLCommand { height: u32, format: u32, data_type: u32, + unpacking_alignment: u32, receiver: IpcBytesReceiver, }, TexSubImage2D { @@ -291,6 +292,7 @@ pub enum WebGLCommand { height: u32, format: u32, data_type: u32, + unpacking_alignment: u32, receiver: IpcBytesReceiver, }, DrawingBufferWidth(WebGLSender<i32>), diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 36ce05256d6..42c03b735dc 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -721,16 +721,6 @@ impl WebGLRenderingContext { ) ); - // Set the unpack alignment. For textures coming from arrays, - // this will be the current value of the context's - // GL_UNPACK_ALIGNMENT, while for textures from images or - // canvas (produced by rgba8_image_to_tex_image_data()), it - // will be 1. - self.send_command(WebGLCommand::PixelStorei( - constants::UNPACK_ALIGNMENT, - unpacking_alignment as i32, - )); - let format = internal_format.as_gl_constant(); let data_type = data_type.as_gl_constant(); let internal_format = self @@ -747,6 +737,7 @@ impl WebGLRenderingContext { height, format, data_type: self.extension_manager.effective_type(data_type), + unpacking_alignment, receiver, }); sender.send(&pixels).unwrap(); @@ -805,16 +796,6 @@ impl WebGLRenderingContext { return self.webgl_error(InvalidOperation); } - // Set the unpack alignment. For textures coming from arrays, - // this will be the current value of the context's - // GL_UNPACK_ALIGNMENT, while for textures from images or - // canvas (produced by rgba8_image_to_tex_image_data()), it - // will be 1. - self.send_command(WebGLCommand::PixelStorei( - constants::UNPACK_ALIGNMENT, - unpacking_alignment as i32, - )); - // TODO(emilio): convert colorspace if requested let (sender, receiver) = ipc::bytes_channel().unwrap(); self.send_command(WebGLCommand::TexSubImage2D { @@ -828,6 +809,7 @@ impl WebGLRenderingContext { data_type: self .extension_manager .effective_type(data_type.as_gl_constant()), + unpacking_alignment, receiver, }); sender.send(&pixels).unwrap(); |