mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Send alignment info directly in TexImage2D and TexSubImage2d messages
This commit is contained in:
parent
1675991b12
commit
1c89ac90b9
3 changed files with 10 additions and 20 deletions
|
@ -1050,8 +1050,11 @@ impl WebGLImpl {
|
||||||
height,
|
height,
|
||||||
format,
|
format,
|
||||||
data_type,
|
data_type,
|
||||||
|
unpacking_alignment,
|
||||||
ref receiver,
|
ref receiver,
|
||||||
} => {
|
} => {
|
||||||
|
ctx.gl()
|
||||||
|
.pixel_store_i(gl::UNPACK_ALIGNMENT, unpacking_alignment as i32);
|
||||||
ctx.gl().tex_image_2d(
|
ctx.gl().tex_image_2d(
|
||||||
target,
|
target,
|
||||||
level as i32,
|
level as i32,
|
||||||
|
@ -1073,8 +1076,11 @@ impl WebGLImpl {
|
||||||
height,
|
height,
|
||||||
format,
|
format,
|
||||||
data_type,
|
data_type,
|
||||||
|
unpacking_alignment,
|
||||||
ref receiver,
|
ref receiver,
|
||||||
} => {
|
} => {
|
||||||
|
ctx.gl()
|
||||||
|
.pixel_store_i(gl::UNPACK_ALIGNMENT, unpacking_alignment as i32);
|
||||||
ctx.gl().tex_sub_image_2d(
|
ctx.gl().tex_sub_image_2d(
|
||||||
target,
|
target,
|
||||||
level as i32,
|
level as i32,
|
||||||
|
|
|
@ -280,6 +280,7 @@ pub enum WebGLCommand {
|
||||||
height: u32,
|
height: u32,
|
||||||
format: u32,
|
format: u32,
|
||||||
data_type: u32,
|
data_type: u32,
|
||||||
|
unpacking_alignment: u32,
|
||||||
receiver: IpcBytesReceiver,
|
receiver: IpcBytesReceiver,
|
||||||
},
|
},
|
||||||
TexSubImage2D {
|
TexSubImage2D {
|
||||||
|
@ -291,6 +292,7 @@ pub enum WebGLCommand {
|
||||||
height: u32,
|
height: u32,
|
||||||
format: u32,
|
format: u32,
|
||||||
data_type: u32,
|
data_type: u32,
|
||||||
|
unpacking_alignment: u32,
|
||||||
receiver: IpcBytesReceiver,
|
receiver: IpcBytesReceiver,
|
||||||
},
|
},
|
||||||
DrawingBufferWidth(WebGLSender<i32>),
|
DrawingBufferWidth(WebGLSender<i32>),
|
||||||
|
|
|
@ -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 format = internal_format.as_gl_constant();
|
||||||
let data_type = data_type.as_gl_constant();
|
let data_type = data_type.as_gl_constant();
|
||||||
let internal_format = self
|
let internal_format = self
|
||||||
|
@ -747,6 +737,7 @@ impl WebGLRenderingContext {
|
||||||
height,
|
height,
|
||||||
format,
|
format,
|
||||||
data_type: self.extension_manager.effective_type(data_type),
|
data_type: self.extension_manager.effective_type(data_type),
|
||||||
|
unpacking_alignment,
|
||||||
receiver,
|
receiver,
|
||||||
});
|
});
|
||||||
sender.send(&pixels).unwrap();
|
sender.send(&pixels).unwrap();
|
||||||
|
@ -805,16 +796,6 @@ impl WebGLRenderingContext {
|
||||||
return self.webgl_error(InvalidOperation);
|
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
|
// TODO(emilio): convert colorspace if requested
|
||||||
let (sender, receiver) = ipc::bytes_channel().unwrap();
|
let (sender, receiver) = ipc::bytes_channel().unwrap();
|
||||||
self.send_command(WebGLCommand::TexSubImage2D {
|
self.send_command(WebGLCommand::TexSubImage2D {
|
||||||
|
@ -828,6 +809,7 @@ impl WebGLRenderingContext {
|
||||||
data_type: self
|
data_type: self
|
||||||
.extension_manager
|
.extension_manager
|
||||||
.effective_type(data_type.as_gl_constant()),
|
.effective_type(data_type.as_gl_constant()),
|
||||||
|
unpacking_alignment,
|
||||||
receiver,
|
receiver,
|
||||||
});
|
});
|
||||||
sender.send(&pixels).unwrap();
|
sender.send(&pixels).unwrap();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue