Skip to content

Commit bc9d0cf

Browse files
committed
Fix two warnings
One about read's result not being used, second one about an unused doc comment. This commit does a breaking API change.
1 parent 91563ec commit bc9d0cf

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/context/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -517,19 +517,17 @@ impl Context {
517517
/// let pixels: Vec<Vec<(u8, u8, u8, u8)>> = display.read_front_buffer();
518518
/// # }
519519
/// ```
520-
pub fn read_front_buffer<T>(&self) -> T
520+
pub fn read_front_buffer<T>(&self) -> Result<T, ops::ReadError>
521521
where T: texture::Texture2dDataSink<(u8, u8, u8, u8)>
522522
{
523523
let mut ctxt = self.make_current();
524524
let dimensions = self.get_framebuffer_dimensions();
525525
let rect = ::Rect { left: 0, bottom: 0, width: dimensions.0, height: dimensions.1 };
526526

527-
// FIXME: See https://github.com/glium/glium/pull/1682#issuecomment-375596152
528-
// Leave it unchecked for now, it will generate warning as a reminder it needs fixing.
529527
let mut data = Vec::with_capacity(0);
530528
ops::read(&mut ctxt, ops::Source::DefaultFramebuffer(gl::FRONT_LEFT), &rect,
531-
&mut data, false);
532-
T::from_raw(Cow::Owned(data), dimensions.0, dimensions.1)
529+
&mut data, false)?;
530+
Ok(T::from_raw(Cow::Owned(data), dimensions.0, dimensions.1))
533531
}
534532

535533
/// Execute an arbitrary closure with the OpenGL context active. Useful if another

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ pub use program::ProgramCreationError::{CompilationError, LinkingError, ShaderTy
117117
pub use sync::{LinearSyncFence, SyncFence};
118118
pub use texture::Texture2d;
119119
pub use version::{Api, Version, get_supported_glsl_version};
120+
pub use ops::ReadError;
120121

121122
use std::rc::Rc;
122123
use std::thread;

src/program/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ pub fn is_subroutine_supported<C: ?Sized>(ctxt: &C) -> bool where C: Capabilitie
5555
ctxt.get_version() >= &Version(Api::Gl, 4, 0) || ctxt.get_extensions().gl_arb_shader_subroutine
5656
}
5757

58-
/// Some shader compilers have race-condition issues, so we lock this mutex
59-
/// in the GL thread every time we compile a shader or link a program.
58+
// Some shader compilers have race-condition issues, so we lock this mutex
59+
// in the GL thread every time we compile a shader or link a program.
6060
// TODO: replace by a StaticMutex
6161
lazy_static! {
6262
static ref COMPILER_GLOBAL_LOCK: Mutex<()> = Mutex::new(());

0 commit comments

Comments
 (0)