pathfinder/src/error.rs

56 lines
1.8 KiB
Rust
Raw Normal View History

2017-02-03 21:25:56 -05:00
// Copyright 2017 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! Errors.
use compute_shader;
use gl::types::GLenum;
/// An OpenGL error with the given code.
///
/// You cannot depend on these being reliably returned. Pathfinder does not call `glGetError()`
/// unless necessary, to avoid driver stalls.
#[derive(Clone, Copy, PartialEq, Debug)]
pub struct GlError(pub GLenum);
/// An initialization error. This could be an OpenGL error or a shader compilation/link error.
#[derive(Debug)]
pub enum InitError {
2017-02-07 23:20:14 -05:00
/// An OpenGL error occurred.
2017-02-03 21:25:56 -05:00
GlError(GlError),
2017-02-07 23:20:14 -05:00
/// Shader compilation failed.
///
/// The first string specifies the type of shader (vertex, fragment, etc.); the second holds
/// the error message that the driver returned.
2017-02-03 21:25:56 -05:00
CompileFailed(&'static str, String),
2017-02-07 23:20:14 -05:00
/// Shader linking failed.
///
/// The string holds the error message that the driver returned.
2017-02-03 21:25:56 -05:00
LinkFailed(String),
2017-02-07 23:20:14 -05:00
/// An error occurred setting up GPU compute.
2017-02-03 21:25:56 -05:00
ComputeError(compute_shader::error::Error),
2017-02-07 23:20:14 -05:00
2017-02-03 21:25:56 -05:00
/// One of the rasterization options had an invalid syntax.
InvalidSetting,
}
/// A rasterization error. This could be an OpenGL error or a compute error.
#[derive(Debug)]
pub enum RasterError {
2017-02-07 23:20:14 -05:00
/// An OpenGL error occurred.
2017-02-03 21:25:56 -05:00
GlError(GlError),
2017-02-07 23:20:14 -05:00
/// An error occurred during GPU compute.
2017-02-03 21:25:56 -05:00
ComputeError(compute_shader::error::Error),
}