aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-06-22 17:58:32 +0200
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-06-22 19:42:03 +0200
commitdbaca24cde140052fb08fbe00924da4a528ea7cf (patch)
treebc86121c21cbe715826f67a749f3e5a1abb50c5a /src/lib.rs
parent1aedc828c55e94d6f301a100f958ffa1106a0a25 (diff)
downloadglutin-dbaca24cde140052fb08fbe00924da4a528ea7cf.tar.gz
glutin-dbaca24cde140052fb08fbe00924da4a528ea7cf.zip
Add with_robustness and handle robustness on all implementations
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 068b9b8..6e96efb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -197,6 +197,33 @@ impl GlRequest {
/// the compatibility profile features.
pub static GL_CORE: GlRequest = GlRequest::Specific(Api::OpenGl, (3, 2));
+/// Specifies the tolerance of the OpenGL context to faults. If you accept raw OpenGL commands
+/// and/or raw shader code from an untrusted source, you should definitely care about this.
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+pub enum Robustness {
+ /// Not everything is checked. Your application can crash if you do something wrong with your
+ /// shaders.
+ NotRobust,
+
+ /// Everything is checked to avoid any crash. The driver will attempt to avoid any problem,
+ /// but if a problem occurs the behavior is implementation-defined. You are just guaranteed not
+ /// to get a crash.
+ RobustNoResetNotification,
+
+ /// Same as `RobustNoResetNotification` but the context creation doesn't fail if it's not
+ /// supported.
+ TryRobustNoResetNotification,
+
+ /// Everything is checked to avoid any crash. If a problem occurs, the context will enter a
+ /// "context lost" state. It must then be recreated. For the moment, glutin doesn't provide a
+ /// way to recreate a context with the same window :-/
+ RobustLoseContextOnReset,
+
+ /// Same as `RobustLoseContextOnReset` but the context creation doesn't fail if it's not
+ /// supported.
+ TryRobustLoseContextOnReset,
+}
+
#[derive(Debug, Copy, Clone)]
pub enum MouseCursor {
/// The platform-dependent default cursor.
@@ -299,6 +326,7 @@ pub struct BuilderAttribs<'a> {
gl_version: GlRequest,
gl_profile: Option<GlProfile>,
gl_debug: bool,
+ gl_robustness: Robustness,
vsync: bool,
visible: bool,
multisampling: Option<u16>,
@@ -324,6 +352,7 @@ impl BuilderAttribs<'static> {
gl_version: GlRequest::Latest,
gl_profile: None,
gl_debug: cfg!(debug_assertions),
+ gl_robustness: Robustness::NotRobust,
vsync: false,
visible: true,
multisampling: None,
@@ -354,6 +383,7 @@ impl<'a> BuilderAttribs<'a> {
gl_version: self.gl_version,
gl_profile: self.gl_profile,
gl_debug: self.gl_debug,
+ gl_robustness: self.gl_robustness,
vsync: self.vsync,
visible: self.visible,
multisampling: self.multisampling,