mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Make TexImage2D and TexSubImage2D struct variants
This commit is contained in:
parent
da43e35ab2
commit
65d1b11929
3 changed files with 70 additions and 47 deletions
|
@ -1042,47 +1042,51 @@ impl WebGLImpl {
|
|||
WebGLCommand::SetViewport(x, y, width, height) => {
|
||||
ctx.gl().viewport(x, y, width, height);
|
||||
},
|
||||
WebGLCommand::TexImage2D(
|
||||
WebGLCommand::TexImage2D {
|
||||
target,
|
||||
level,
|
||||
internal,
|
||||
internal_format,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
data_type,
|
||||
ref chan,
|
||||
) => ctx.gl().tex_image_2d(
|
||||
ref receiver,
|
||||
} => {
|
||||
ctx.gl().tex_image_2d(
|
||||
target,
|
||||
level,
|
||||
internal,
|
||||
width,
|
||||
height,
|
||||
level as i32,
|
||||
internal_format as i32,
|
||||
width as i32,
|
||||
height as i32,
|
||||
0,
|
||||
format,
|
||||
data_type,
|
||||
Some(&chan.recv().unwrap()),
|
||||
),
|
||||
WebGLCommand::TexSubImage2D(
|
||||
Some(&receiver.recv().unwrap()),
|
||||
);
|
||||
},
|
||||
WebGLCommand::TexSubImage2D {
|
||||
target,
|
||||
level,
|
||||
xoffset,
|
||||
yoffset,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
ref chan,
|
||||
) => ctx.gl().tex_sub_image_2d(
|
||||
format,
|
||||
data_type,
|
||||
ref receiver,
|
||||
} => {
|
||||
ctx.gl().tex_sub_image_2d(
|
||||
target,
|
||||
level,
|
||||
level as i32,
|
||||
xoffset,
|
||||
yoffset,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
&chan.recv().unwrap(),
|
||||
),
|
||||
width as i32,
|
||||
height as i32,
|
||||
format,
|
||||
data_type,
|
||||
&receiver.recv().unwrap(),
|
||||
);
|
||||
},
|
||||
WebGLCommand::DrawingBufferWidth(ref sender) => sender
|
||||
.send(ctx.borrow_draw_buffer().unwrap().size().width)
|
||||
.unwrap(),
|
||||
|
|
|
@ -272,8 +272,27 @@ pub enum WebGLCommand {
|
|||
VertexAttribPointer(u32, i32, u32, bool, i32, u32),
|
||||
VertexAttribPointer2f(u32, i32, bool, i32, u32),
|
||||
SetViewport(i32, i32, i32, i32),
|
||||
TexImage2D(u32, i32, i32, i32, i32, u32, u32, IpcBytesReceiver),
|
||||
TexSubImage2D(u32, i32, i32, i32, i32, i32, u32, u32, IpcBytesReceiver),
|
||||
TexImage2D {
|
||||
target: u32,
|
||||
level: u32,
|
||||
internal_format: u32,
|
||||
width: u32,
|
||||
height: u32,
|
||||
format: u32,
|
||||
data_type: u32,
|
||||
receiver: IpcBytesReceiver,
|
||||
},
|
||||
TexSubImage2D {
|
||||
target: u32,
|
||||
level: u32,
|
||||
xoffset: i32,
|
||||
yoffset: i32,
|
||||
width: u32,
|
||||
height: u32,
|
||||
format: u32,
|
||||
data_type: u32,
|
||||
receiver: IpcBytesReceiver,
|
||||
},
|
||||
DrawingBufferWidth(WebGLSender<i32>),
|
||||
DrawingBufferHeight(WebGLSender<i32>),
|
||||
Finish(WebGLSender<()>),
|
||||
|
|
|
@ -739,16 +739,16 @@ impl WebGLRenderingContext {
|
|||
|
||||
// TODO(emilio): convert colorspace if requested
|
||||
let (sender, receiver) = ipc::bytes_channel().unwrap();
|
||||
self.send_command(WebGLCommand::TexImage2D(
|
||||
target.as_gl_constant(),
|
||||
level as i32,
|
||||
internal_format as i32,
|
||||
width as i32,
|
||||
height as i32,
|
||||
self.send_command(WebGLCommand::TexImage2D {
|
||||
target: target.as_gl_constant(),
|
||||
level,
|
||||
internal_format,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
self.extension_manager.effective_type(data_type),
|
||||
data_type: self.extension_manager.effective_type(data_type),
|
||||
receiver,
|
||||
));
|
||||
});
|
||||
sender.send(&pixels).unwrap();
|
||||
|
||||
if let Some(fb) = self.bound_framebuffer.get() {
|
||||
|
@ -817,17 +817,17 @@ impl WebGLRenderingContext {
|
|||
|
||||
// TODO(emilio): convert colorspace if requested
|
||||
let (sender, receiver) = ipc::bytes_channel().unwrap();
|
||||
self.send_command(WebGLCommand::TexSubImage2D(
|
||||
target.as_gl_constant(),
|
||||
level as i32,
|
||||
self.send_command(WebGLCommand::TexSubImage2D {
|
||||
target: target.as_gl_constant(),
|
||||
level,
|
||||
xoffset,
|
||||
yoffset,
|
||||
width as i32,
|
||||
height as i32,
|
||||
format.as_gl_constant(),
|
||||
data_type.as_gl_constant(),
|
||||
width,
|
||||
height,
|
||||
format: format.as_gl_constant(),
|
||||
data_type: data_type.as_gl_constant(),
|
||||
receiver,
|
||||
));
|
||||
});
|
||||
sender.send(&pixels).unwrap();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue