From 3af24ed119f8612b153daf443497ec767f687ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 3 Dec 2015 02:53:37 +0100 Subject: [PATCH 1/2] webgl: Fix texturing These two tiny changes were making WebGL textures not work. It was not seen in our texturing test since we render to a texture by default, and that texture was bound to `gl::TEXTURE_2D`. --- components/canvas/webgl_paint_task.rs | 2 +- components/script/dom/webgltexture.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/canvas/webgl_paint_task.rs b/components/canvas/webgl_paint_task.rs index 28fabacf72e..40247266472 100644 --- a/components/canvas/webgl_paint_task.rs +++ b/components/canvas/webgl_paint_task.rs @@ -257,7 +257,7 @@ impl WebGLPaintTask { } fn create_texture(&self, chan: IpcSender>>) { - let texture = gl::gen_framebuffers(1)[0]; + let texture = gl::gen_textures(1)[0]; let texture = if texture == 0 { None } else { diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs index 2288c9be7f7..e7f645ce235 100644 --- a/components/script/dom/webgltexture.rs +++ b/components/script/dom/webgltexture.rs @@ -70,7 +70,7 @@ impl WebGLTexture { self.target.set(Some(target)); } - self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BindTexture(self.id, target))).unwrap(); + self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BindTexture(target, self.id))).unwrap(); Ok(()) } From f3bd1f787947132edce63aa5dffe238d59f9c01f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 3 Dec 2015 19:24:33 +0100 Subject: [PATCH 2/2] webgl: Ensure we don't generate gl errors in the paint task The validations performed in the script side of this should always prevent this from happening, and this will allow us to catch bugs like the previous one. --- components/canvas/webgl_paint_task.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/canvas/webgl_paint_task.rs b/components/canvas/webgl_paint_task.rs index 40247266472..634a72e61fa 100644 --- a/components/canvas/webgl_paint_task.rs +++ b/components/canvas/webgl_paint_task.rs @@ -169,6 +169,9 @@ impl WebGLPaintTask { CanvasWebGLMsg::DrawingBufferHeight(sender) => 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); } /// Creates a new `WebGLPaintTask` and returns the out-of-process sender and the in-process