From 0d0c14e6ecc3137fd1d12c389e03e6f312f1f207 Mon Sep 17 00:00:00 2001 From: Tomaka17 Date: Tue, 21 Oct 2014 08:11:08 +0200 Subject: [PATCH 1/2] Update for gl-rs --- src/android/ffi.rs | 7 ++++++- src/win32/ffi.rs | 17 +++++++++++++++-- src/x11/ffi.rs | 17 +++++++++++++++-- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/android/ffi.rs b/src/android/ffi.rs index a7482e31..78ef0705 100644 --- a/src/android/ffi.rs +++ b/src/android/ffi.rs @@ -17,7 +17,12 @@ pub mod egl { pub type NativePixmapType = super::EGLNativePixmapType; pub type NativeWindowType = super::EGLNativeWindowType; - generate_gl_bindings!("egl", "core", "1.5", "static") + generate_gl_bindings! { + api: egl, + profile: core, + version: 1.5, + generator: static + } } pub type khronos_utime_nanoseconds_t = khronos_uint64_t; diff --git a/src/win32/ffi.rs b/src/win32/ffi.rs index 23859546..5662a988 100644 --- a/src/win32/ffi.rs +++ b/src/win32/ffi.rs @@ -7,12 +7,25 @@ use libc; /// WGL bindings pub mod wgl { - generate_gl_bindings!("wgl", "core", "1.0", "static") + generate_gl_bindings! { + api: wgl, + profile: core, + version: 1.0, + generator: static + } } /// Functions that are not necessarly always available pub mod wgl_extra { - generate_gl_bindings!("wgl", "core", "1.0", "struct", [ "WGL_ARB_create_context" ]) + generate_gl_bindings! { + api: wgl, + profile: core, + version: 1.0, + generator: struct, + extensions: [ + WGL_ARB_create_context + ] + } } // http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx diff --git a/src/x11/ffi.rs b/src/x11/ffi.rs index 39a6ae5f..f6a0a3b2 100644 --- a/src/x11/ffi.rs +++ b/src/x11/ffi.rs @@ -8,12 +8,25 @@ use libc; /// GLX bindings pub mod glx { - generate_gl_bindings!("glx", "core", "1.4", "static") + generate_gl_bindings! { + api: glx, + profile: core, + version: 1.4, + generator: static + } } /// Functions that are not necessarly always available pub mod glx_extra { - generate_gl_bindings!("glx", "core", "1.4", "struct", [ "GLX_ARB_create_context" ]) + generate_gl_bindings! { + api: glx, + profile: core, + version: 1.4, + generator: struct, + extensions: [ + GLX_ARB_create_context + ] + } } pub type Atom = libc::c_ulong; From 2ff393fe623d10f2ea89262013ba66e228cc0c94 Mon Sep 17 00:00:00 2001 From: Tomaka17 Date: Wed, 22 Oct 2014 08:04:13 +0200 Subject: [PATCH 2/2] Update for rustc and gl-rs --- examples/support/mod.rs | 14 ++++++++++++-- src/android/ffi.rs | 8 ++++---- src/win32/ffi.rs | 18 +++++++++--------- src/win32/init.rs | 2 +- src/win32/mod.rs | 10 +++++----- src/x11/ffi.rs | 18 +++++++++--------- src/x11/window/mod.rs | 6 +++--- tests/headless.rs | 7 ++++++- 8 files changed, 49 insertions(+), 34 deletions(-) diff --git a/examples/support/mod.rs b/examples/support/mod.rs index f27c4e73..12aa68c9 100644 --- a/examples/support/mod.rs +++ b/examples/support/mod.rs @@ -7,13 +7,23 @@ use glutin; #[cfg(not(target_os = "android"))] mod gl { - generate_gl_bindings!("gl", "core", "1.1", "struct") + generate_gl_bindings! { + api: "gl", + profile: "core", + version: "1.1", + generator: "struct" + } } #[cfg(target_os = "android")] mod gl { pub use self::Gles1 as Gl; - generate_gl_bindings!("gles1", "core", "1.1", "struct") + generate_gl_bindings! { + api: "gles1", + profile: "core", + version: "1.1", + generator: "struct" + } } pub struct Context { diff --git a/src/android/ffi.rs b/src/android/ffi.rs index 78ef0705..b65f44df 100644 --- a/src/android/ffi.rs +++ b/src/android/ffi.rs @@ -18,10 +18,10 @@ pub mod egl { pub type NativeWindowType = super::EGLNativeWindowType; generate_gl_bindings! { - api: egl, - profile: core, - version: 1.5, - generator: static + api: "egl", + profile: "core", + version: "1.5", + generator: "static" } } diff --git a/src/win32/ffi.rs b/src/win32/ffi.rs index 5662a988..317935d2 100644 --- a/src/win32/ffi.rs +++ b/src/win32/ffi.rs @@ -8,22 +8,22 @@ use libc; /// WGL bindings pub mod wgl { generate_gl_bindings! { - api: wgl, - profile: core, - version: 1.0, - generator: static + api: "wgl", + profile: "core", + version: "1.0", + generator: "static" } } /// Functions that are not necessarly always available pub mod wgl_extra { generate_gl_bindings! { - api: wgl, - profile: core, - version: 1.0, - generator: struct, + api: "wgl", + profile: "core", + version: "1.0", + generator: "struct", extensions: [ - WGL_ARB_create_context + "WGL_ARB_create_context" ] } } diff --git a/src/win32/init.rs b/src/win32/init.rs index bb3f53b7..36bf6397 100644 --- a/src/win32/init.rs +++ b/src/win32/init.rs @@ -2,7 +2,7 @@ extern crate native; use self::native::NativeTaskBuilder; use std::task::TaskBuilder; -use std::sync::atomics::AtomicBool; +use std::sync::atomic::AtomicBool; use std::ptr; use super::{event, ffi}; use super::Window; diff --git a/src/win32/mod.rs b/src/win32/mod.rs index 8be3fdb8..c3da891e 100644 --- a/src/win32/mod.rs +++ b/src/win32/mod.rs @@ -1,4 +1,4 @@ -use std::sync::atomics::AtomicBool; +use std::sync::atomic::AtomicBool; use std::ptr; use Event; @@ -75,7 +75,7 @@ impl Window { impl Window { /// See the docs in the crate root file. pub fn is_closed(&self) -> bool { - use std::sync::atomics::Relaxed; + use std::sync::atomic::Relaxed; self.is_closed.load(Relaxed) } @@ -170,7 +170,7 @@ impl Window { // if one of the received events is `Closed`, setting `is_closed` to true if events.iter().find(|e| match e { &&::Closed => true, _ => false }).is_some() { - use std::sync::atomics::Relaxed; + use std::sync::atomic::Relaxed; self.is_closed.store(true, Relaxed); } @@ -185,7 +185,7 @@ impl Window { // if the received event is `Closed`, setting `is_closed` to true match ev { ::Closed => { - use std::sync::atomics::Relaxed; + use std::sync::atomic::Relaxed; self.is_closed.store(true, Relaxed); }, _ => () @@ -198,7 +198,7 @@ impl Window { }, Err(_) => { - use std::sync::atomics::Relaxed; + use std::sync::atomic::Relaxed; self.is_closed.store(true, Relaxed); vec![] } diff --git a/src/x11/ffi.rs b/src/x11/ffi.rs index f6a0a3b2..822f7558 100644 --- a/src/x11/ffi.rs +++ b/src/x11/ffi.rs @@ -9,22 +9,22 @@ use libc; /// GLX bindings pub mod glx { generate_gl_bindings! { - api: glx, - profile: core, - version: 1.4, - generator: static + api: "glx", + profile: "core", + version: "1.4", + generator: "static" } } /// Functions that are not necessarly always available pub mod glx_extra { generate_gl_bindings! { - api: glx, - profile: core, - version: 1.4, - generator: struct, + api: "glx", + profile: "core", + version: "1.4", + generator: "struct", extensions: [ - GLX_ARB_create_context + "GLX_ARB_create_context" ] } } diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs index ad10e165..cb73958c 100644 --- a/src/x11/window/mod.rs +++ b/src/x11/window/mod.rs @@ -1,7 +1,7 @@ use {Event, WindowBuilder}; use libc; use std::{mem, ptr}; -use std::sync::atomics::AtomicBool; +use std::sync::atomic::AtomicBool; use super::ffi; pub use self::monitor::{MonitorID, get_available_monitors, get_primary_monitor}; @@ -260,7 +260,7 @@ impl Window { } pub fn is_closed(&self) -> bool { - use std::sync::atomics::Relaxed; + use std::sync::atomic::Relaxed; self.is_closed.load(Relaxed) } @@ -340,7 +340,7 @@ impl Window { ffi::ClientMessage => { use Closed; - use std::sync::atomics::Relaxed; + use std::sync::atomic::Relaxed; let client_msg: &ffi::XClientMessageEvent = unsafe { mem::transmute(&xev) }; diff --git a/tests/headless.rs b/tests/headless.rs index ffc74b3d..745cae89 100644 --- a/tests/headless.rs +++ b/tests/headless.rs @@ -7,7 +7,12 @@ extern crate glutin; extern crate libc; mod gl { - generate_gl_bindings!("gl", "core", "1.1", "struct") + generate_gl_bindings! { + api: "gl", + profile: "core", + version: "1.1", + generator: "struct" + } } #[cfg(feature = "headless")]