webgl: Improve debugging

Now we can keep track of errors more easily.
This commit is contained in:
Emilio Cobos Álvarez 2016-01-04 14:04:40 +01:00
parent 5c23c3851a
commit 48962bd6b6
2 changed files with 83 additions and 2 deletions

View file

@ -46,6 +46,8 @@ impl WebGLPaintThread {
/// NB: Not gl-related validations (names, lengths, accepted parameters...) are
/// done in the corresponding DOM interfaces
pub fn handle_webgl_message(&self, message: CanvasWebGLMsg) {
debug!("WebGL message: {:?}", message);
match message {
CanvasWebGLMsg::GetContextAttributes(sender) =>
self.context_attributes(sender),
@ -181,8 +183,9 @@ impl WebGLPaintThread {
self.send_drawing_buffer_height(sender),
}
// FIXME: Convert to `debug_assert!` once tests are run with debug assertions
assert!(gl::get_error() == gl::NO_ERROR);
// FIXME: Use debug_assertions once tests are run with them
let error = gl::get_error();
assert!(error == gl::NO_ERROR, "Unexpected WebGL error: 0x{:x} ({})", error, error);
}
/// Creates a new `WebGLPaintThread` and returns the out-of-process sender and the in-process
@ -299,6 +302,7 @@ impl WebGLPaintThread {
} else {
Some(unsafe { NonZero::new(program) })
};
chan.send(program).unwrap();
}