mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Simplify VertexAttribOffset
This commit is contained in:
parent
431e3ddf8d
commit
0747853ad0
3 changed files with 8 additions and 8 deletions
|
@ -1104,12 +1104,8 @@ impl WebGLImpl {
|
||||||
fn vertex_attrib_offset(gl: &gl::Gl,
|
fn vertex_attrib_offset(gl: &gl::Gl,
|
||||||
index: u32,
|
index: u32,
|
||||||
pname: u32,
|
pname: u32,
|
||||||
chan: WebGLSender<WebGLResult<isize>>) {
|
chan: WebGLSender<isize>) {
|
||||||
let result = match pname {
|
let result = gl.get_vertex_attrib_pointer_v(index, pname);
|
||||||
gl::VERTEX_ATTRIB_ARRAY_POINTER => Ok(gl.get_vertex_attrib_pointer_v(index, pname)),
|
|
||||||
_ => Err(WebGLError::InvalidEnum),
|
|
||||||
};
|
|
||||||
|
|
||||||
chan.send(result).unwrap();
|
chan.send(result).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ pub enum WebGLCommand {
|
||||||
GetAttribLocation(WebGLProgramId, String, WebGLSender<Option<i32>>),
|
GetAttribLocation(WebGLProgramId, String, WebGLSender<Option<i32>>),
|
||||||
GetUniformLocation(WebGLProgramId, String, WebGLSender<Option<i32>>),
|
GetUniformLocation(WebGLProgramId, String, WebGLSender<Option<i32>>),
|
||||||
GetVertexAttrib(u32, u32, WebGLSender<WebGLResult<WebGLParameter>>),
|
GetVertexAttrib(u32, u32, WebGLSender<WebGLResult<WebGLParameter>>),
|
||||||
GetVertexAttribOffset(u32, u32, WebGLSender<WebGLResult<isize>>),
|
GetVertexAttribOffset(u32, u32, WebGLSender<isize>),
|
||||||
GetShaderInfoLog(WebGLShaderId, WebGLSender<String>),
|
GetShaderInfoLog(WebGLShaderId, WebGLSender<String>),
|
||||||
GetProgramInfoLog(WebGLProgramId, WebGLSender<String>),
|
GetProgramInfoLog(WebGLProgramId, WebGLSender<String>),
|
||||||
PolygonOffset(f32, f32),
|
PolygonOffset(f32, f32),
|
||||||
|
|
|
@ -2421,10 +2421,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn GetVertexAttribOffset(&self, index: u32, pname: u32) -> i64 {
|
fn GetVertexAttribOffset(&self, index: u32, pname: u32) -> i64 {
|
||||||
|
if pname != constants::VERTEX_ATTRIB_ARRAY_POINTER {
|
||||||
|
self.webgl_error(InvalidEnum);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
let (sender, receiver) = webgl_channel().unwrap();
|
let (sender, receiver) = webgl_channel().unwrap();
|
||||||
self.send_command(WebGLCommand::GetVertexAttribOffset(index, pname, sender));
|
self.send_command(WebGLCommand::GetVertexAttribOffset(index, pname, sender));
|
||||||
|
|
||||||
handle_potential_webgl_error!(self, receiver.recv().unwrap(), 0) as i64
|
receiver.recv().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue