diff options
author | Pierre Krieger <pierre.krieger1708@gmail.com> | 2015-09-20 09:29:22 +0200 |
---|---|---|
committer | Pierre Krieger <pierre.krieger1708@gmail.com> | 2015-09-21 12:03:55 +0200 |
commit | c244f8c033f100a6e0f3e0b2b408f6ddc1006d47 (patch) | |
tree | 786cb96254b0fe69646700fc4845218c5703ffac /src/api | |
parent | f51ace4c7885fa25c146c24181c4d87f5632de3e (diff) | |
download | glutin-c244f8c033f100a6e0f3e0b2b408f6ddc1006d47.tar.gz glutin-c244f8c033f100a6e0f3e0b2b408f6ddc1006d47.zip |
Extract GlAttributes from BuilderAttribs
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/cocoa/mod.rs | 8 | ||||
-rw-r--r-- | src/api/egl/mod.rs | 22 | ||||
-rw-r--r-- | src/api/emscripten/mod.rs | 2 | ||||
-rw-r--r-- | src/api/glx/mod.rs | 28 | ||||
-rw-r--r-- | src/api/osmesa/mod.rs | 2 | ||||
-rw-r--r-- | src/api/wgl/mod.rs | 12 | ||||
-rw-r--r-- | src/api/win32/init.rs | 2 | ||||
-rw-r--r-- | src/api/x11/window.rs | 2 |
8 files changed, 39 insertions, 39 deletions
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs index 259f847..e259f39 100644 --- a/src/api/cocoa/mod.rs +++ b/src/api/cocoa/mod.rs @@ -267,11 +267,11 @@ impl<'a> Iterator for WaitEventsIterator<'a> { impl Window { #[cfg(feature = "window")] pub fn new(builder: BuilderAttribs) -> Result<Window, CreationError> { - if builder.sharing.is_some() { + if builder.opengl.sharing.is_some() { unimplemented!() } - match builder.gl_robustness { + match builder.opengl.robustness { Robustness::RobustNoResetNotification | Robustness::RobustLoseContextOnReset => { return Err(CreationError::RobustnessNotSupported); }, @@ -438,7 +438,7 @@ impl Window { } fn create_context(view: id, builder: &BuilderAttribs) -> Result<(IdRef, PixelFormat), CreationError> { - let profile = match (builder.gl_version, builder.gl_version.to_gl_version(), builder.gl_profile) { + let profile = match (builder.opengl.version, builder.opengl.version.to_gl_version(), builder.opengl.profile) { // Note: we are not using ranges because of a rust bug that should be fixed here: // https://github.com/rust-lang/rust/pull/27050 @@ -540,7 +540,7 @@ impl Window { }; cxt.setView_(view); - let value = if builder.vsync { 1 } else { 0 }; + let value = if builder.opengl.vsync { 1 } else { 0 }; cxt.setValues_forParameter_(&value, NSOpenGLContextParameter::NSOpenGLCPSwapInterval); CGLEnable(cxt.CGLContextObj(), kCGLCECrashOnRemovedFunctions); diff --git a/src/api/egl/mod.rs b/src/api/egl/mod.rs index 4cd7a7c..c06c8ef 100644 --- a/src/api/egl/mod.rs +++ b/src/api/egl/mod.rs @@ -162,7 +162,7 @@ impl Context { native_display: NativeDisplay) -> Result<ContextPrototype<'a>, CreationError> { - if builder.sharing.is_some() { + if builder.opengl.sharing.is_some() { unimplemented!() } @@ -197,7 +197,7 @@ impl Context { // binding the right API and choosing the version let (version, api) = unsafe { - match builder.gl_version { + match builder.opengl.version { GlRequest::Latest => { if egl_version >= (1, 4) { if egl.BindAPI(ffi::egl::OPENGL_API) != 0 { @@ -394,18 +394,18 @@ impl<'a> ContextPrototype<'a> { if let Some(version) = self.version { try!(create_context(&self.egl, self.display, &self.egl_version, &self.extensions, self.api, version, self.config_id, - self.builder.gl_debug, self.builder.gl_robustness)) + self.builder.opengl.debug, self.builder.opengl.robustness)) } else if self.api == Api::OpenGlEs { if let Ok(ctxt) = create_context(&self.egl, self.display, &self.egl_version, &self.extensions, self.api, (2, 0), self.config_id, - self.builder.gl_debug, self.builder.gl_robustness) + self.builder.opengl.debug, self.builder.opengl.robustness) { ctxt } else if let Ok(ctxt) = create_context(&self.egl, self.display, &self.egl_version, &self.extensions, self.api, (1, 0), - self.config_id, self.builder.gl_debug, - self.builder.gl_robustness) + self.config_id, self.builder.opengl.debug, + self.builder.opengl.robustness) { ctxt } else { @@ -415,19 +415,19 @@ impl<'a> ContextPrototype<'a> { } else { if let Ok(ctxt) = create_context(&self.egl, self.display, &self.egl_version, &self.extensions, self.api, (3, 2), self.config_id, - self.builder.gl_debug, self.builder.gl_robustness) + self.builder.opengl.debug, self.builder.opengl.robustness) { ctxt } else if let Ok(ctxt) = create_context(&self.egl, self.display, &self.egl_version, &self.extensions, self.api, (3, 1), - self.config_id, self.builder.gl_debug, - self.builder.gl_robustness) + self.config_id, self.builder.opengl.debug, + self.builder.opengl.robustness) { ctxt } else if let Ok(ctxt) = create_context(&self.egl, self.display, &self.egl_version, &self.extensions, self.api, (1, 0), - self.config_id, self.builder.gl_debug, - self.builder.gl_robustness) + self.config_id, self.builder.opengl.debug, + self.builder.opengl.robustness) { ctxt } else { diff --git a/src/api/emscripten/mod.rs b/src/api/emscripten/mod.rs index 79dda6b..e6f51e3 100644 --- a/src/api/emscripten/mod.rs +++ b/src/api/emscripten/mod.rs @@ -83,7 +83,7 @@ impl Window { // setting the attributes // FIXME: - /*match builder.gl_version { + /*match builder.opengl.version { Some((major, minor)) => { attributes.majorVersion = major as libc::c_int; attributes.minorVersion = minor as libc::c_int; diff --git a/src/api/glx/mod.rs b/src/api/glx/mod.rs index a1ee092..6a4461c 100644 --- a/src/api/glx/mod.rs +++ b/src/api/glx/mod.rs @@ -133,7 +133,7 @@ impl<'a> ContextPrototype<'a> { } pub fn finish(self, window: ffi::Window) -> Result<Context, CreationError> { - let share = if let Some(win) = self.builder.sharing { + let share = if let Some(win) = self.builder.opengl.sharing { match win { &PlatformWindow::X(ref win) => match win.x.context { ::api::x11::Context::Glx(ref c) => c.context, @@ -160,46 +160,46 @@ impl<'a> ContextPrototype<'a> { }); // creating GL context - let context = match self.builder.gl_version { + let context = match self.builder.opengl.version { GlRequest::Latest => { if let Ok(ctxt) = create_context(&self.glx, &extra_functions, &extensions, (3, 2), - self.builder.gl_profile, self.builder.gl_debug, - self.builder.gl_robustness, share, + self.builder.opengl.profile, self.builder.opengl.debug, + self.builder.opengl.robustness, share, self.display, self.fb_config, &self.visual_infos) { ctxt } else if let Ok(ctxt) = create_context(&self.glx, &extra_functions, &extensions, - (3, 1), self.builder.gl_profile, - self.builder.gl_debug, - self.builder.gl_robustness, share, self.display, + (3, 1), self.builder.opengl.profile, + self.builder.opengl.debug, + self.builder.opengl.robustness, share, self.display, self.fb_config, &self.visual_infos) { ctxt } else { try!(create_context(&self.glx, &extra_functions, &extensions, (1, 0), - self.builder.gl_profile, self.builder.gl_debug, - self.builder.gl_robustness, + self.builder.opengl.profile, self.builder.opengl.debug, + self.builder.opengl.robustness, share, self.display, self.fb_config, &self.visual_infos)) } }, GlRequest::Specific(Api::OpenGl, (major, minor)) => { try!(create_context(&self.glx, &extra_functions, &extensions, (major, minor), - self.builder.gl_profile, self.builder.gl_debug, - self.builder.gl_robustness, share, self.display, self.fb_config, + self.builder.opengl.profile, self.builder.opengl.debug, + self.builder.opengl.robustness, share, self.display, self.fb_config, &self.visual_infos)) }, GlRequest::Specific(_, _) => panic!("Only OpenGL is supported"), GlRequest::GlThenGles { opengl_version: (major, minor), .. } => { try!(create_context(&self.glx, &extra_functions, &extensions, (major, minor), - self.builder.gl_profile, self.builder.gl_debug, - self.builder.gl_robustness, share, self.display, self.fb_config, + self.builder.opengl.profile, self.builder.opengl.debug, + self.builder.opengl.robustness, share, self.display, self.fb_config, &self.visual_infos)) }, }; // vsync - if self.builder.vsync { + if self.builder.opengl.vsync { unsafe { self.glx.MakeCurrent(self.display as *mut _, window, context) }; if extra_functions.SwapIntervalEXT.is_loaded() { diff --git a/src/api/osmesa/mod.rs b/src/api/osmesa/mod.rs index 9bd24b6..2bfc8f5 100644 --- a/src/api/osmesa/mod.rs +++ b/src/api/osmesa/mod.rs @@ -39,7 +39,7 @@ impl OsMesaContext { let dimensions = builder.dimensions.unwrap(); - match builder.gl_robustness { + match builder.opengl.robustness { Robustness::RobustNoResetNotification | Robustness::RobustLoseContextOnReset => { return Err(CreationError::RobustnessNotSupported.into()); }, diff --git a/src/api/wgl/mod.rs b/src/api/wgl/mod.rs index 89538f1..a32d023 100644 --- a/src/api/wgl/mod.rs +++ b/src/api/wgl/mod.rs @@ -131,7 +131,7 @@ impl Context { let gl_library = try!(load_opengl32_dll()); // handling vsync - if builder.vsync { + if builder.opengl.vsync { if extensions.split(' ').find(|&i| i == "WGL_EXT_swap_control").is_some() { let _guard = try!(CurrentContextGuard::make_current(hdc, context.0)); @@ -220,7 +220,7 @@ unsafe fn create_context(extra: Option<(&gl::wgl_extra::Wgl, &BuilderAttribs<'st if extensions.split(' ').find(|&i| i == "WGL_ARB_create_context").is_some() { let mut attributes = Vec::new(); - match builder.gl_version { + match builder.opengl.version { GlRequest::Latest => {}, GlRequest::Specific(Api::OpenGl, (major, minor)) => { attributes.push(gl::wgl_extra::CONTEXT_MAJOR_VERSION_ARB as libc::c_int); @@ -252,7 +252,7 @@ unsafe fn create_context(extra: Option<(&gl::wgl_extra::Wgl, &BuilderAttribs<'st }, } - if let Some(profile) = builder.gl_profile { + if let Some(profile) = builder.opengl.profile { if extensions.split(' ').find(|&i| i == "WGL_ARB_create_context_profile").is_some() { let flag = match profile { @@ -273,7 +273,7 @@ unsafe fn create_context(extra: Option<(&gl::wgl_extra::Wgl, &BuilderAttribs<'st // robustness if extensions.split(' ').find(|&i| i == "WGL_ARB_create_context_robustness").is_some() { - match builder.gl_robustness { + match builder.opengl.robustness { Robustness::RobustNoResetNotification | Robustness::TryRobustNoResetNotification => { attributes.push(gl::wgl_extra::CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB as libc::c_int); attributes.push(gl::wgl_extra::NO_RESET_NOTIFICATION_ARB as libc::c_int); @@ -288,7 +288,7 @@ unsafe fn create_context(extra: Option<(&gl::wgl_extra::Wgl, &BuilderAttribs<'st Robustness::NoError => (), } } else { - match builder.gl_robustness { + match builder.opengl.robustness { Robustness::RobustNoResetNotification | Robustness::RobustLoseContextOnReset => { return Err(CreationError::RobustnessNotSupported); }, @@ -296,7 +296,7 @@ unsafe fn create_context(extra: Option<(&gl::wgl_extra::Wgl, &BuilderAttribs<'st } } - if builder.gl_debug { + if builder.opengl.debug { flags = flags | gl::wgl_extra::CONTEXT_DEBUG_BIT_ARB as libc::c_int; } diff --git a/src/api/win32/init.rs b/src/api/win32/init.rs index c3225b6..daa6b5a 100644 --- a/src/api/win32/init.rs +++ b/src/api/win32/init.rs @@ -159,7 +159,7 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>, }; // creating the OpenGL context - let context = match builder.gl_version { + let context = match builder.opengl.version { GlRequest::Specific(Api::OpenGlEs, (_major, _minor)) => { if let Some(egl) = egl { if let Ok(c) = EglContext::new(egl, &builder, diff --git a/src/api/x11/window.rs b/src/api/x11/window.rs index 5bfbda9..8e2bdb5 100644 --- a/src/api/x11/window.rs +++ b/src/api/x11/window.rs @@ -349,7 +349,7 @@ impl Window { Egl(::api::egl::ContextPrototype<'a>), } let builder_clone = builder.clone(); - let context = match builder.gl_version { + let context = match builder.opengl.version { GlRequest::Latest | GlRequest::Specific(Api::OpenGl, _) | GlRequest::GlThenGles { .. } => { // GLX should be preferred over EGL, otherwise crashes may occur // on X11 – issue #314 |