mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
webgl: Reset bound buffer when appropiate in BufferData
This makes the test bufferDataBadArgs pass appropiately.
This commit is contained in:
parent
bc08762414
commit
1ad7f73caf
1 changed files with 7 additions and 2 deletions
|
@ -616,6 +616,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
Err(e) => return self.webgl_error(e),
|
Err(e) => return self.webgl_error(e),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
slot.set(None);
|
||||||
// Unbind the current buffer
|
// Unbind the current buffer
|
||||||
self.ipc_renderer
|
self.ipc_renderer
|
||||||
.send(CanvasMsg::WebGL(WebGLCommand::BindBuffer(target, 0)))
|
.send(CanvasMsg::WebGL(WebGLCommand::BindBuffer(target, 0)))
|
||||||
|
@ -698,20 +699,24 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
constants::ELEMENT_ARRAY_BUFFER => self.bound_buffer_element_array.get(),
|
constants::ELEMENT_ARRAY_BUFFER => self.bound_buffer_element_array.get(),
|
||||||
_ => return self.webgl_error(InvalidEnum),
|
_ => return self.webgl_error(InvalidEnum),
|
||||||
};
|
};
|
||||||
|
|
||||||
let bound_buffer = match bound_buffer {
|
let bound_buffer = match bound_buffer {
|
||||||
Some(bound_buffer) => bound_buffer,
|
Some(bound_buffer) => bound_buffer,
|
||||||
None => return self.webgl_error(InvalidValue),
|
None => return self.webgl_error(InvalidValue),
|
||||||
};
|
};
|
||||||
|
|
||||||
match usage {
|
match usage {
|
||||||
constants::STREAM_DRAW |
|
constants::STREAM_DRAW |
|
||||||
constants::STATIC_DRAW |
|
constants::STATIC_DRAW |
|
||||||
constants::DYNAMIC_DRAW => (),
|
constants::DYNAMIC_DRAW => (),
|
||||||
_ => return self.webgl_error(InvalidEnum),
|
_ => return self.webgl_error(InvalidEnum),
|
||||||
}
|
}
|
||||||
|
|
||||||
let data = match data {
|
let data = match data {
|
||||||
Some(data) => data,
|
Some(data) => data,
|
||||||
None => return self.webgl_error(InvalidValue),
|
None => return self.webgl_error(InvalidValue),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(data_vec) = array_buffer_view_to_vec::<u8>(data) {
|
if let Some(data_vec) = array_buffer_view_to_vec::<u8>(data) {
|
||||||
handle_potential_webgl_error!(self, bound_buffer.buffer_data(target, &data_vec, usage));
|
handle_potential_webgl_error!(self, bound_buffer.buffer_data(target, &data_vec, usage));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue