From 2fa549bcc961e1194d4e90ca50c1f9481960ff19 Mon Sep 17 00:00:00 2001 From: Will Usher Date: Sat, 17 Oct 2015 14:14:27 -0600 Subject: [PATCH] Wrap ProgramChooserCreationError properly --- src/glium_renderer.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/glium_renderer.rs b/src/glium_renderer.rs index 92b2d56..2c932f7 100644 --- a/src/glium_renderer.rs +++ b/src/glium_renderer.rs @@ -17,7 +17,7 @@ pub type RendererResult = Result; pub enum RendererError { Vertex(vertex::BufferCreationError), Index(index::BufferCreationError), - Program(program::ProgramCreationError), + Program(program::ProgramChooserCreationError), Texture(texture::TextureCreationError), Draw(DrawError) } @@ -47,8 +47,8 @@ impl From for RendererError { } } -impl From for RendererError { - fn from(e: program::ProgramCreationError) -> RendererError { +impl From for RendererError { + fn from(e: program::ProgramChooserCreationError) -> RendererError { RendererError::Program(e) } } @@ -152,11 +152,7 @@ impl DeviceObjects { let vertex_buffer = try!(VertexBuffer::empty_dynamic(ctx, 0)); let index_buffer = try!(IndexBuffer::empty_dynamic(ctx, PrimitiveType::TrianglesList, 0)); - let program = match compile_default_program(ctx) { - Ok(p) => p, - Err(program::ProgramChooserCreationError::NoVersion) => panic!("No version for GLSL program"), - Err(e) => panic!("Error compiling shaders {:?}", e), - }; + let program = try!(compile_default_program(ctx)); let texture = try!(im_gui.prepare_texture(|handle| { let data = RawImage2d { data: Cow::Borrowed(handle.pixels),