summaryrefslogtreecommitdiffstats
path: root/src/display.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2017-01-01 19:19:15 -0800
committerJoe Wilm <joe@jwilm.com>2017-01-01 19:19:15 -0800
commit7c794ada8801ed51a6efb4f53e694d02d254dff3 (patch)
tree68af3d4af48bbde72ffbd7e977206693dc931e5a /src/display.rs
parentd4e20a4741a4966fbb0b8162ed7cdf47007ca7b8 (diff)
Improve error handling for shader initialization
Shader initialization errors at startup should print a nice message now.
Diffstat (limited to 'src/display.rs')
-rw-r--r--src/display.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/display.rs b/src/display.rs
index 2ddf1bdd..ab6cbc07 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -24,7 +24,7 @@ use cli;
use config::Config;
use font::{self, Rasterize};
use meter::Meter;
-use renderer::{GlyphCache, QuadRenderer};
+use renderer::{self, GlyphCache, QuadRenderer};
use selection::Selection;
use term::{Term, SizeInfo};
@@ -37,6 +37,9 @@ pub enum Error {
/// Error dealing with fonts
Font(font::Error),
+
+ /// Error in renderer
+ Render(renderer::Error),
}
impl ::std::error::Error for Error {
@@ -44,6 +47,7 @@ impl ::std::error::Error for Error {
match *self {
Error::Window(ref err) => Some(err),
Error::Font(ref err) => Some(err),
+ Error::Render(ref err) => Some(err),
}
}
@@ -51,6 +55,7 @@ impl ::std::error::Error for Error {
match *self {
Error::Window(ref err) => err.description(),
Error::Font(ref err) => err.description(),
+ Error::Render(ref err) => err.description(),
}
}
}
@@ -60,6 +65,7 @@ impl ::std::fmt::Display for Error {
match *self {
Error::Window(ref err) => err.fmt(f),
Error::Font(ref err) => err.fmt(f),
+ Error::Render(ref err) => err.fmt(f),
}
}
}
@@ -76,6 +82,12 @@ impl From<font::Error> for Error {
}
}
+impl From<renderer::Error> for Error {
+ fn from(val: renderer::Error) -> Error {
+ Error::Render(val)
+ }
+}
+
/// The display wraps a window, font rasterizer, and GPU renderer
pub struct Display {
window: Window,
@@ -139,7 +151,7 @@ impl Display {
let rasterizer = font::Rasterizer::new(dpi.x(), dpi.y(), dpr)?;
// Create renderer
- let mut renderer = QuadRenderer::new(config, size);
+ let mut renderer = QuadRenderer::new(config, size)?;
// Initialize glyph cache
let glyph_cache = {