Skip to content
Browse files

Add extra debug assertions for WebGL errors

  • Loading branch information
asajeffrey committed Dec 6, 2019
1 parent cfa50b8 commit 44db86fefdb5673f57880812d157f9088b87a270
Showing with 7 additions and 0 deletions.
  1. +7 −0 components/canvas/
@@ -680,10 +680,14 @@ impl WebGLThread {
.expect("Where's the GL data?");

// Ensure there are no pending GL errors from other parts of the pipeline.
debug_assert_eq!(, gl::NO_ERROR);

// Check to see if any of the current framebuffer bindings are the surface we're about
// to swap out. If so, we'll have to reset them after destroying the surface.
let framebuffer_rebinding_info =
FramebufferRebindingInfo::detect(&self.device, &data.ctx, &*;
debug_assert_eq!(, gl::NO_ERROR);

debug!("Getting swap chain for {:?}", swap_id);
let swap_chain = match swap_id {
@@ -698,17 +702,20 @@ impl WebGLThread {
.swap_buffers(&mut self.device, &mut data.ctx)
debug_assert_eq!(, gl::NO_ERROR);

// TODO: if preserveDrawingBuffer is true, then blit the front buffer to the back buffer
debug!("Clearing {:?}", swap_id);
.clear_surface(&mut self.device, &mut data.ctx, &*
debug_assert_eq!(, gl::NO_ERROR);

// Rebind framebuffers as appropriate.
debug!("Rebinding {:?}", swap_id);
framebuffer_rebinding_info.apply(&self.device, &data.ctx, &*;
debug_assert_eq!(, gl::NO_ERROR);

let SurfaceInfo {

0 comments on commit 44db86f

Please sign in to comment.
You can’t perform that action at this time.