diff --git a/Cargo.toml b/Cargo.toml index 32f08144..72c932dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "surfman" license = "MIT OR Apache-2.0 OR MPL-2.0" edition = "2021" -version = "0.12.3" +version = "0.12.4" authors = [ "Patrick Walton ", "Emilio Cobos Álvarez ", diff --git a/src/cgl/device.rs b/src/cgl/device.rs index f7474ec2..b99a503f 100644 --- a/src/cgl/device.rs +++ b/src/cgl/device.rs @@ -370,6 +370,12 @@ impl Device { /// show up in their associated widgets until this method is called. pub fn present_bound_surface(&self, context: &mut Context) -> Result<(), Error> { if let Framebuffer::Surface(surface) = &mut context.framebuffer { + // Presenting the surface is not a GL operation on macOS, it's just + // CoreAnimation and IOSurface management. This means that it will + // leave any unprocessed OpenGL commands in the pipeline. Flushing + // here ensures that doesn't happen. + unsafe { context.gl.flush() }; + self.0.present_surface(&mut surface.system_surface)?; surface.bind_to_texture(&context.gl); }