--- a/third_party/rust/gl_generator/.cargo-checksum.json
+++ b/third_party/rust/gl_generator/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"45aea41e3c3f3bf616649f9f826bfe25b3910c6f39906a9fe8803c62dc8e4c8f","README.md":"d1c8edfeedee664271d3b462513477aa098359ede91d24179451705ec99db7b6","generators/debug_struct_gen.rs":"2fdbee9077f560479e06269564bd7d7550600b2687a66273abc08d96afd41cf1","generators/global_gen.rs":"1bcddeb9e2a7cd32ce0fd0b8eb5435c78246165975b2a3ebd799c8f4f7095c58","generators/mod.rs":"62e090f77e146cb4b0f4bb898c4b4754f6733b3fa6f51b73e349cb1b66fbeb31","generators/static_gen.rs":"5758fb47c6f33d24f38248f2b504ce7174414b01b9f25f8c22503f5e9493e549","generators/static_struct_gen.rs":"7c8d6bc8916276b43c5bc84da313a317bf277f13c502e11763587a30add3591b","generators/struct_gen.rs":"2795f531122f794070cdf0bf0d11baf0472d2afd611656bbc44563ac513ec67a","generators/templates/types/egl.rs":"10d4a1b0444960e00bdb37de5eed54588119233177faed86662efe20407df660","generators/templates/types/gl.rs":"eefc1aef9ed4751b4ffa8cbf498347555bc8d4f2650c50e78c2864dad5eb64fc","generators/templates/types/glx.rs":"5bdd0b621d1aac0c8dda8ffa95ce9c7a7614146ff129f18b3a36cf51c3985a61","generators/templates/types/wgl.rs":"f4d21c7c793df4a8256f7f496d2940987bf38a1c3acab06b57dfad2e29d4f713","lib.rs":"4d68840c600a1025025438454d68d70e6da3891f2a5bb33406d4255cb257cda1","registry/mod.rs":"8b901725292a2c4dbb2c882a83b2c05ffd1148af36c7cb9c2c0339e1bb661d7c","registry/parse.rs":"362ce237b7b6e9a71649e597e585281fda7e26e2c0d3694af357438129c7d7ef"},"package":"f1d8edc81c5ae84605a62f5dac661a2313003b26d59839f81d47d46cf0f16a55"}
\ No newline at end of file
+{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"313b48b1cf4f84dafffe0ccfb10e8d98eada41a4b21bc239a25eb90acb57c82c","Cargo.toml.orig":"97cdad3767af6963180d989f333c14b0c2efa0f4715c1a4ecafc415bfc560edb","README.md":"e0ae9e1224f6ce5d6df8e30272a1a23044d2d33b0051bf32ccd74e559f8a9f6c","generators/debug_struct_gen.rs":"8bd1187f346aa927a30781bdf24ca6cb86324b42109bf52a018aae9ae947a46c","generators/global_gen.rs":"2aed997706c797a3b3e60adc91ecad67056ee824fad29e27349f6d37293b5a1e","generators/mod.rs":"58fab4bbfac335de7bd61a01063bea0547d311fec1aaee6946871902adc14072","generators/static_gen.rs":"9fb4ee9f056263611658234539977fb415f93435d290053b84b092e05de16924","generators/static_struct_gen.rs":"23b910c2b14936766036876b9915639058e0cf3bca468c317d4edc7f6498b471","generators/struct_gen.rs":"87d37c9f6f8b457f3de3578b15d552d36843ed62837a0b33cd674103185f43e0","generators/templates/types/egl.rs":"881506faddd220f5ccbd7fc21d74860233f2204ed3dee31d891ae273b1643a74","generators/templates/types/gl.rs":"f71f3a2200c0fa13f09687ef05e51c28c5b11c1bb841acd402c0097d8f9130bd","generators/templates/types/glx.rs":"a2d6a91fc1bf46fab6868b9a01f36fc47e9a9837bc9ed79eba4d08f31117d063","generators/templates/types/wgl.rs":"2270dcf994250a5905b7246ccdbf3770c494cac0642a720ccbb91ac1886490e2","lib.rs":"4d68840c600a1025025438454d68d70e6da3891f2a5bb33406d4255cb257cda1","registry/mod.rs":"7834029699b1bcfa9d395bf03b4b328f38a7d69e4a4c3d3e01e626919b00ed63","registry/parse.rs":"4498677f167fcd6fa5fd34241ae86a6a17b98fe8566fa48f38b3860a7f941f9b"},"package":"0940975a4ca12b088d32b5d5134826c47d2e73de4b0b459b05244c01503eccbb"}
\ No newline at end of file
--- a/third_party/rust/gl_generator/Cargo.toml
+++ b/third_party/rust/gl_generator/Cargo.toml
@@ -1,26 +1,36 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
[package]
-
name = "gl_generator"
-version = "0.5.2"
-authors = ["Brendan Zabarauskas <bjzaba@yahoo.com.au>",
- "Corey Richardson",
- "Arseny Kapoulkine"
-]
+version = "0.5.3"
+authors = ["Brendan Zabarauskas <bjzaba@yahoo.com.au>", "Corey Richardson", "Arseny Kapoulkine"]
description = "Code generators for creating bindings to the Khronos OpenGL APIs."
+homepage = "https://github.com/brendanzab/gl-rs/gl_generator/"
+documentation = "https://docs.rs/gl_generator"
+readme = "README.md"
license = "Apache-2.0"
-
-homepage = "https://github.com/bjz/gl-rs/gl_generator/"
-repository = "https://github.com/bjz/gl-rs/"
-readme = "README.md"
+repository = "https://github.com/brendanzab/gl-rs/"
[lib]
name = "gl_generator"
path = "lib.rs"
+[dependencies]
+log = "0.3.5"
+xml-rs = "0.3.0"
+
+[dependencies.khronos_api]
+version = "1.0.1"
+
[features]
unstable_generator_utils = []
-
-[dependencies]
-khronos_api = { version = "1.0.0", path = "../khronos_api" }
-log = "0.3.5"
-xml-rs = "0.3.0"
new file mode 100644
--- /dev/null
+++ b/third_party/rust/gl_generator/Cargo.toml.orig
@@ -0,0 +1,25 @@
+[package]
+name = "gl_generator"
+version = "0.5.3"
+authors = ["Brendan Zabarauskas <bjzaba@yahoo.com.au>",
+ "Corey Richardson",
+ "Arseny Kapoulkine"
+]
+description = "Code generators for creating bindings to the Khronos OpenGL APIs."
+license = "Apache-2.0"
+documentation = "https://docs.rs/gl_generator"
+homepage = "https://github.com/brendanzab/gl-rs/gl_generator/"
+repository = "https://github.com/brendanzab/gl-rs/"
+readme = "README.md"
+
+[lib]
+name = "gl_generator"
+path = "lib.rs"
+
+[features]
+unstable_generator_utils = []
+
+[dependencies]
+khronos_api = { version = "1.0.1", path = "../khronos_api" }
+log = "0.3.5"
+xml-rs = "0.3.0"
--- a/third_party/rust/gl_generator/README.md
+++ b/third_party/rust/gl_generator/README.md
@@ -1,12 +1,12 @@
# gl_generator
[![Version](https://img.shields.io/crates/v/gl_generator.svg)](https://crates.io/crates/gl_generator)
-[![License](https://img.shields.io/crates/l/gl_generator.svg)](https://github.com/bjz/gl-rs/blob/master/LICENSE)
+[![License](https://img.shields.io/crates/l/gl_generator.svg)](https://github.com/brendanzab/gl-rs/blob/master/LICENSE)
[![Downloads](https://img.shields.io/crates/d/gl_generator.svg)](https://crates.io/crates/gl_generator)
Code generators for creating bindings to the Khronos OpenGL APIs.
## Usage
If you need a specific version of OpenGL, or you need a different API
(OpenGL ES, EGL, WGL, GLX), or if you need certain extensions, you should use
--- a/third_party/rust/gl_generator/generators/debug_struct_gen.rs
+++ b/third_party/rust/gl_generator/generators/debug_struct_gen.rs
@@ -14,66 +14,79 @@
use registry::Registry;
use std::io;
#[allow(missing_copy_implementations)]
pub struct DebugStructGenerator;
impl super::Generator for DebugStructGenerator {
- fn write<W>(&self, registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+ fn write<W>(&self, registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+ {
try!(write_header(dest));
try!(write_type_aliases(registry, dest));
try!(write_enums(registry, dest));
try!(write_fnptr_struct_def(dest));
try!(write_panicking_fns(registry, dest));
try!(write_struct(registry, dest));
try!(write_impl(registry, dest));
Ok(())
}
}
/// Creates a `__gl_imports` module which contains all the external symbols that we need for the
/// bindings.
-fn write_header<W>(dest: &mut W) -> io::Result<()> where W: io::Write {
- writeln!(dest, r#"
+fn write_header<W>(dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ writeln!(dest,
+ r#"
mod __gl_imports {{
pub use std::mem;
pub use std::marker::Send;
pub use std::os::raw;
}}
"#)
}
/// Creates a `types` module which contains all the type aliases.
///
/// See also `generators::gen_types`.
-fn write_type_aliases<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
- try!(writeln!(dest, r#"
+fn write_type_aliases<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ try!(writeln!(dest,
+ r#"
pub mod types {{
#![allow(non_camel_case_types, non_snake_case, dead_code, missing_copy_implementations)]
"#));
try!(super::gen_types(registry.api, dest));
writeln!(dest, "}}")
}
/// Creates all the `<enum>` elements at the root of the bindings.
-fn write_enums<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+fn write_enums<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
for enm in ®istry.enums {
try!(super::gen_enum_item(enm, "types::", dest));
}
Ok(())
}
/// Creates a `FnPtr` structure which contains the store for a single binding.
-fn write_fnptr_struct_def<W>(dest: &mut W) -> io::Result<()> where W: io::Write {
- writeln!(dest, "
+fn write_fnptr_struct_def<W>(dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ writeln!(dest,
+ "
#[allow(dead_code, missing_copy_implementations)]
#[derive(Clone)]
pub struct FnPtr {{
/// The function pointer that will be used when calling the function.
f: *const __gl_imports::raw::c_void,
/// True if the pointer points to a real function, false if points to a `panic!` fn.
is_loaded: bool,
}}
@@ -101,51 +114,56 @@ fn write_fnptr_struct_def<W>(dest: &mut
}}
}}
")
}
/// Creates a `panicking` module which contains one function per GL command.
///
/// These functions are the mocks that are called if the real function could not be loaded.
-fn write_panicking_fns<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+fn write_panicking_fns<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
writeln!(dest,
- "#[inline(never)]
+ "#[inline(never)]
fn missing_fn_panic() -> ! {{
panic!(\"{api} function was not loaded\")
}}",
- api = registry.api
- )
+ api = registry.api)
}
/// Creates a structure which stores all the `FnPtr` of the bindings.
///
/// The name of the struct corresponds to the namespace.
-fn write_struct<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
- try!(writeln!(dest, "
+fn write_struct<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ try!(writeln!(dest,
+ "
#[allow(non_camel_case_types, non_snake_case, dead_code)]
#[derive(Clone)]
pub struct {api} {{",
- api = super::gen_struct_name(registry.api)
- ));
+ api = super::gen_struct_name(registry.api)));
for cmd in ®istry.cmds {
if let Some(v) = registry.aliases.get(&cmd.proto.ident) {
try!(writeln!(dest, "/// Fallbacks: {}", v.join(", ")));
}
try!(writeln!(dest, "pub {name}: FnPtr,", name = cmd.proto.ident));
}
writeln!(dest, "}}")
}
/// Creates the `impl` of the structure created by `write_struct`.
-fn write_impl<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+fn write_impl<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
try!(writeln!(dest,
- "impl {api} {{
+ "impl {api} {{
/// Load each OpenGL symbol using a custom load function. This allows for the
/// use of functions like `glfwGetProcAddress` or `SDL_GL_GetProcAddress`.
///
/// ~~~ignore
/// let gl = Gl::load_with(|s| glfw.get_proc_address(s));
/// ~~~
#[allow(dead_code, unused_variables)]
pub fn load_with<F>(mut loadfn: F) -> {api} where F: FnMut(&str) -> *const __gl_imports::raw::c_void {{
@@ -162,18 +180,17 @@ fn write_impl<W>(registry: &Registry, de
}}
}}
ptr
}}
let mut metaloadfn = |symbol: &str, symbols: &[&str]| {{
do_metaloadfn(&mut loadfn, symbol, symbols)
}};
{api} {{",
- api = super::gen_struct_name(registry.api)
- ));
+ api = super::gen_struct_name(registry.api)));
for cmd in ®istry.cmds {
try!(writeln!(dest,
"{name}: FnPtr::new(metaloadfn(\"{symbol}\", &[{fallbacks}])),",
name = cmd.proto.ident,
symbol = super::gen_symbol_name(registry.api, &cmd.proto.ident),
fallbacks = match registry.aliases.get(&cmd.proto.ident) {
Some(fbs) => {
@@ -182,58 +199,65 @@ fn write_impl<W>(registry: &Registry, de
.collect::<Vec<_>>().join(", ")
},
None => format!(""),
},
))
}
try!(writeln!(dest,
- "}}
- }}"
- ));
+ "}}
+ }}"));
for cmd in ®istry.cmds {
let idents = super::gen_parameters(cmd, true, false);
let typed_params = super::gen_parameters(cmd, false, true);
let println = format!("println!(\"[OpenGL] {}({})\" {});",
- cmd.proto.ident,
- (0 .. idents.len()).map(|_| "{:?}".to_string()).collect::<Vec<_>>().join(", "),
- idents.iter().zip(typed_params.iter())
- .map(|(name, ty)| {
- if ty.contains("GLDEBUGPROC") {
- format!(", \"<callback>\"")
- } else {
- format!(", {}", name)
- }
- }).collect::<Vec<_>>().concat());
+ cmd.proto.ident,
+ (0..idents.len())
+ .map(|_| "{:?}".to_string())
+ .collect::<Vec<_>>()
+ .join(", "),
+ idents
+ .iter()
+ .zip(typed_params.iter())
+ .map(|(name, ty)| if ty.contains("GLDEBUGPROC") {
+ format!(", \"<callback>\"")
+ } else {
+ format!(", {}", name)
+ })
+ .collect::<Vec<_>>()
+ .concat());
try!(writeln!(dest,
- "#[allow(non_snake_case, unused_variables, dead_code)]
+ "#[allow(non_snake_case, unused_variables, dead_code)]
#[inline] pub unsafe fn {name}(&self, {params}) -> {return_suffix} {{ \
{println}
let r = __gl_imports::mem::transmute::<_, extern \"system\" fn({typed_params}) -> {return_suffix}>\
(self.{name}.f)({idents});
{print_err}
r
}}",
- name = cmd.proto.ident,
- params = super::gen_parameters(cmd, true, true).join(", "),
- typed_params = typed_params.join(", "),
- return_suffix = cmd.proto.ty,
- idents = idents.join(", "),
- println = println,
- print_err = if cmd.proto.ident != "GetError" && registry.cmds.iter().find(|cmd| cmd.proto.ident == "GetError").is_some() {
- format!(r#"match __gl_imports::mem::transmute::<_, extern "system" fn() -> u32>
+ name = cmd.proto.ident,
+ params = super::gen_parameters(cmd, true, true).join(", "),
+ typed_params = typed_params.join(", "),
+ return_suffix = cmd.proto.ty,
+ idents = idents.join(", "),
+ println = println,
+ print_err = if cmd.proto.ident != "GetError" &&
+ registry
+ .cmds
+ .iter()
+ .find(|cmd| cmd.proto.ident == "GetError")
+ .is_some() {
+ format!(r#"match __gl_imports::mem::transmute::<_, extern "system" fn() -> u32>
(self.GetError.f)() {{ 0 => (), r => println!("[OpenGL] ^ GL error triggered: {{}}", r) }}"#)
- } else {
- format!("")
- }
- ))
+ } else {
+ format!("")
+ }))
}
writeln!(dest,
- "}}
+ "}}
unsafe impl __gl_imports::Send for {api} {{}}",
- api = super::gen_struct_name(registry.api)
- )
+ api = super::gen_struct_name(registry.api))
}
--- a/third_party/rust/gl_generator/generators/global_gen.rs
+++ b/third_party/rust/gl_generator/generators/global_gen.rs
@@ -14,45 +14,53 @@
use registry::Registry;
use std::io;
#[allow(missing_copy_implementations)]
pub struct GlobalGenerator;
impl super::Generator for GlobalGenerator {
- fn write<W>(&self, registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+ fn write<W>(&self, registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+ {
try!(write_header(dest));
try!(write_metaloadfn(dest));
try!(write_type_aliases(registry, dest));
try!(write_enums(registry, dest));
try!(write_fns(registry, dest));
try!(write_fnptr_struct_def(dest));
try!(write_ptrs(registry, dest));
try!(write_fn_mods(registry, dest));
try!(write_panicking_fns(registry, dest));
try!(write_load_fn(registry, dest));
Ok(())
}
}
/// Creates a `__gl_imports` module which contains all the external symbols that we need for the
/// bindings.
-fn write_header<W>(dest: &mut W) -> io::Result<()> where W: io::Write {
- writeln!(dest, r#"
+fn write_header<W>(dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ writeln!(dest,
+ r#"
mod __gl_imports {{
pub use std::mem;
pub use std::os::raw;
}}
"#)
}
/// Creates the metaloadfn function for fallbacks
-fn write_metaloadfn<W>(dest: &mut W) -> io::Result<()> where W: io::Write {
- writeln!(dest, r#"
+fn write_metaloadfn<W>(dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ writeln!(dest,
+ r#"
#[inline(never)]
fn metaloadfn(mut loadfn: &mut FnMut(&str) -> *const __gl_imports::raw::c_void,
symbol: &str,
fallbacks: &[&str]) -> *const __gl_imports::raw::c_void {{
let mut ptr = loadfn(symbol);
if ptr.is_null() {{
for &sym in fallbacks {{
ptr = loadfn(sym);
@@ -62,43 +70,51 @@ fn write_metaloadfn<W>(dest: &mut W) ->
ptr
}}
"#)
}
/// Creates a `types` module which contains all the type aliases.
///
/// See also `generators::gen_types`.
-fn write_type_aliases<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
- try!(writeln!(dest, r#"
+fn write_type_aliases<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ try!(writeln!(dest,
+ r#"
pub mod types {{
#![allow(non_camel_case_types, non_snake_case, dead_code, missing_copy_implementations)]
"#));
try!(super::gen_types(registry.api, dest));
- writeln!(dest, "
+ writeln!(dest,
+ "
}}
")
}
/// Creates all the `<enum>` elements at the root of the bindings.
-fn write_enums<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+fn write_enums<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
for enm in ®istry.enums {
try!(super::gen_enum_item(enm, "types::", dest));
}
Ok(())
}
/// Creates the functions corresponding to the GL commands.
///
/// The function calls the corresponding function pointer stored in the `storage` module created
/// by `write_ptrs`.
-fn write_fns<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+fn write_fns<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
for cmd in ®istry.cmds {
if let Some(v) = registry.aliases.get(&cmd.proto.ident) {
try!(writeln!(dest, "/// Fallbacks: {}", v.join(", ")));
}
try!(writeln!(dest,
"#[allow(non_snake_case, unused_variables, dead_code)] #[inline]
pub unsafe fn {name}({params}) -> {return_suffix} {{ \
@@ -112,18 +128,21 @@ fn write_fns<W>(registry: &Registry, des
idents = super::gen_parameters(cmd, true, false).join(", "),
));
}
Ok(())
}
/// Creates a `FnPtr` structure which contains the store for a single binding.
-fn write_fnptr_struct_def<W>(dest: &mut W) -> io::Result<()> where W: io::Write {
- writeln!(dest, "
+fn write_fnptr_struct_def<W>(dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ writeln!(dest,
+ "
#[allow(missing_copy_implementations)]
pub struct FnPtr {{
/// The function pointer that will be used when calling the function.
f: *const __gl_imports::raw::c_void,
/// True if the pointer points to a real function, false if points to a `panic!` fn.
is_loaded: bool,
}}
@@ -136,48 +155,55 @@ fn write_fnptr_struct_def<W>(dest: &mut
FnPtr {{ f: ptr, is_loaded: true }}
}}
}}
}}
")
}
/// Creates a `storage` module which contains a static `FnPtr` per GL command in the registry.
-fn write_ptrs<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+fn write_ptrs<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
try!(writeln!(dest,
- "mod storage {{
+ "mod storage {{
#![allow(non_snake_case)]
+ #![allow(non_upper_case_globals)]
use super::__gl_imports::raw;
use super::FnPtr;"));
for c in ®istry.cmds {
try!(writeln!(dest,
- "pub static mut {name}: FnPtr = FnPtr {{
+ "pub static mut {name}: FnPtr = FnPtr {{
f: super::missing_fn_panic as *const raw::c_void,
is_loaded: false
}};",
- name = c.proto.ident
- ));
+ name = c.proto.ident));
}
writeln!(dest, "}}")
}
/// Creates one module for each GL command.
///
/// Each module contains `is_loaded` and `load_with` which interact with the `storage` module
/// created by `write_ptrs`.
-fn write_fn_mods<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+fn write_fn_mods<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
for c in ®istry.cmds {
let fallbacks = match registry.aliases.get(&c.proto.ident) {
Some(v) => {
- let names = v.iter().map(|name| format!("\"{}\"", super::gen_symbol_name(registry.api, &name[..]))).collect::<Vec<_>>();
+ let names = v.iter()
+ .map(|name| format!("\"{}\"", super::gen_symbol_name(registry.api, &name[..])))
+ .collect::<Vec<_>>();
format!("&[{}]", names.join(", "))
- }, None => "&[]".to_string(),
+ }
+ None => "&[]".to_string(),
};
let fnname = &c.proto.ident[..];
let symbol = super::gen_symbol_name(registry.api, &c.proto.ident[..]);
let symbol = &symbol[..];
try!(writeln!(dest, r##"
#[allow(non_snake_case)]
pub mod {fnname} {{
@@ -202,40 +228,48 @@ fn write_fn_mods<W>(registry: &Registry,
}
Ok(())
}
/// Creates a `missing_fn_panic` function.
///
/// This function is the mock that is called if the real function could not be called.
-fn write_panicking_fns<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+fn write_panicking_fns<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
writeln!(dest,
- "#[inline(never)]
+ "#[inline(never)]
fn missing_fn_panic() -> ! {{
panic!(\"{api} function was not loaded\")
}}
- ", api = registry.api)
+ ",
+ api = registry.api)
}
/// Creates the `load_with` function.
///
/// The function calls `load_with` in each module created by `write_fn_mods`.
-fn write_load_fn<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
- try!(writeln!(dest, "
+fn write_load_fn<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ try!(writeln!(dest,
+ "
/// Load each OpenGL symbol using a custom load function. This allows for the
/// use of functions like `glfwGetProcAddress` or `SDL_GL_GetProcAddress`.
/// ~~~ignore
/// gl::load_with(|s| glfw.get_proc_address(s));
/// ~~~
#[allow(dead_code)]
pub fn load_with<F>(mut loadfn: F) where F: FnMut(&str) -> *const __gl_imports::raw::c_void {{
"));
for c in ®istry.cmds {
- try!(writeln!(dest, "{cmd_name}::load_with(|s| loadfn(s));",
+ try!(writeln!(dest,
+ "{cmd_name}::load_with(|s| loadfn(s));",
cmd_name = &c.proto.ident[..]));
}
- writeln!(dest, "
+ writeln!(dest,
+ "
}}
")
}
--- a/third_party/rust/gl_generator/generators/mod.rs
+++ b/third_party/rust/gl_generator/generators/mod.rs
@@ -25,28 +25,30 @@ pub mod static_struct_gen;
/// Trait for a bindings generator.
pub trait Generator {
/// Builds the GL bindings.
fn write<W>(&self, registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write;
}
pub fn gen_struct_name(api: Api) -> &'static str {
match api {
- Api::Gl => "Gl",
+ Api::Gl => "Gl",
Api::Glx => "Glx",
Api::Wgl => "Wgl",
Api::Egl => "Egl",
Api::GlCore => "GlCore",
Api::Gles1 => "Gles1",
Api::Gles2 => "Gles2",
}
}
/// This function generates a `const name: type = value;` item.
-pub fn gen_enum_item<W>(enm: &Enum, types_prefix: &str, dest: &mut W) -> io::Result<()> where W: io::Write {
+pub fn gen_enum_item<W>(enm: &Enum, types_prefix: &str, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
writeln!(dest,
"#[allow(dead_code, non_upper_case_globals)] pub const {ident}: {types_prefix}{ty} = {value}{cast_suffix};",
ident = enm.ident,
types_prefix = if enm.ty == "&'static str" { "" } else { types_prefix },
ty = enm.ty,
value = enm.value,
cast_suffix = match enm.cast {
true => format!(" as {}{}", types_prefix, enm.ty),
@@ -54,32 +56,35 @@ pub fn gen_enum_item<W>(enm: &Enum, type
},
)
}
/// Generates all the type aliases for a namespace.
///
/// Aliases are either `pub type = ...` or `#[repr(C)] pub struct ... { ... }` and contain all the
/// things that we can't obtain from the XML files.
-pub fn gen_types<W>(api: Api, dest: &mut W) -> io::Result<()> where W: io::Write {
+pub fn gen_types<W>(api: Api, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
try!(writeln!(dest, "{}", include_str!("templates/types/gl.rs")));
match api {
Api::Glx => try!(writeln!(dest, "{}", include_str!("templates/types/glx.rs"))),
Api::Wgl => try!(writeln!(dest, "{}", include_str!("templates/types/wgl.rs"))),
Api::Egl => try!(writeln!(dest, "{}", include_str!("templates/types/egl.rs"))),
- _ => {},
+ _ => {}
}
Ok(())
}
/// Generates the list of Rust `Arg`s that a `Cmd` requires.
pub fn gen_parameters(cmd: &Cmd, with_idents: bool, with_types: bool) -> Vec<String> {
- cmd.params.iter()
+ cmd.params
+ .iter()
.map(|binding| {
// returning
if with_idents && with_types {
format!("{}: {}", binding.ident, binding.ty)
} else if with_types {
format!("{}", binding.ty)
} else if with_idents {
format!("{}", binding.ident)
--- a/third_party/rust/gl_generator/generators/static_gen.rs
+++ b/third_party/rust/gl_generator/generators/static_gen.rs
@@ -14,66 +14,80 @@
use registry::Registry;
use std::io;
#[allow(missing_copy_implementations)]
pub struct StaticGenerator;
impl super::Generator for StaticGenerator {
- fn write<W>(&self, registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+ fn write<W>(&self, registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+ {
try!(write_header(dest));
try!(write_type_aliases(registry, dest));
try!(write_enums(registry, dest));
try!(write_fns(registry, dest));
Ok(())
}
}
/// Creates a `__gl_imports` module which contains all the external symbols that we need for the
/// bindings.
-fn write_header<W>(dest: &mut W) -> io::Result<()> where W: io::Write {
- writeln!(dest, r#"
+fn write_header<W>(dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ writeln!(dest,
+ r#"
mod __gl_imports {{
pub use std::mem;
pub use std::os::raw;
}}
"#)
}
/// Creates a `types` module which contains all the type aliases.
///
/// See also `generators::gen_types`.
-fn write_type_aliases<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
- try!(writeln!(dest, r#"
+fn write_type_aliases<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ try!(writeln!(dest,
+ r#"
pub mod types {{
#![allow(non_camel_case_types, non_snake_case, dead_code, missing_copy_implementations)]
"#));
try!(super::gen_types(registry.api, dest));
- writeln!(dest, "
+ writeln!(dest,
+ "
}}
")
}
/// Creates all the `<enum>` elements at the root of the bindings.
-fn write_enums<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+fn write_enums<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
for enm in ®istry.enums {
try!(super::gen_enum_item(enm, "types::", dest));
}
Ok(())
}
/// io::Writes all functions corresponding to the GL bindings.
///
/// These are foreign functions, they don't have any content.
-fn write_fns<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
- try!(writeln!(dest, "
+fn write_fns<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ try!(writeln!(dest,
+ "
#[allow(non_snake_case, unused_variables, dead_code)]
extern \"system\" {{"));
for cmd in ®istry.cmds {
try!(writeln!(dest,
"#[link_name=\"{symbol}\"]
pub fn {name}({params}) -> {return_suffix};",
symbol = super::gen_symbol_name(registry.api, &cmd.proto.ident),
--- a/third_party/rust/gl_generator/generators/static_struct_gen.rs
+++ b/third_party/rust/gl_generator/generators/static_struct_gen.rs
@@ -14,75 +14,89 @@
use registry::Registry;
use std::io;
#[allow(missing_copy_implementations)]
pub struct StaticStructGenerator;
impl super::Generator for StaticStructGenerator {
- fn write<W>(&self, registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+ fn write<W>(&self, registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+ {
try!(write_header(dest));
try!(write_type_aliases(registry, dest));
try!(write_enums(registry, dest));
try!(write_struct(registry, dest));
try!(write_impl(registry, dest));
try!(write_fns(registry, dest));
Ok(())
}
}
/// Creates a `__gl_imports` module which contains all the external symbols that we need for the
/// bindings.
-fn write_header<W>(dest: &mut W) -> io::Result<()> where W: io::Write {
- writeln!(dest, r#"
+fn write_header<W>(dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ writeln!(dest,
+ r#"
mod __gl_imports {{
pub use std::mem;
pub use std::os::raw;
}}
"#)
}
/// Creates a `types` module which contains all the type aliases.
///
/// See also `generators::gen_types`.
-fn write_type_aliases<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
- try!(writeln!(dest, r#"
+fn write_type_aliases<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ try!(writeln!(dest,
+ r#"
pub mod types {{
#![allow(non_camel_case_types, non_snake_case, dead_code, missing_copy_implementations)]
"#));
try!(super::gen_types(registry.api, dest));
writeln!(dest, "}}")
}
/// Creates all the `<enum>` elements at the root of the bindings.
-fn write_enums<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+fn write_enums<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
for enm in ®istry.enums {
try!(super::gen_enum_item(enm, "types::", dest));
}
Ok(())
}
/// Creates a stub structure.
///
/// The name of the struct corresponds to the namespace.
-fn write_struct<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+fn write_struct<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
writeln!(dest, "
#[allow(non_camel_case_types, non_snake_case, dead_code)]
#[derive(Copy, Clone)]
pub struct {api};",
api = super::gen_struct_name(registry.api),
)
}
/// Creates the `impl` of the structure created by `write_struct`.
-fn write_impl<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+fn write_impl<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
try!(writeln!(dest,
"impl {api} {{
/// Stub function.
#[allow(dead_code)]
pub fn load_with<F>(mut _loadfn: F) -> {api} where F: FnMut(&str) -> *const __gl_imports::raw::c_void {{
{api}
}}",
api = super::gen_struct_name(registry.api),
@@ -105,19 +119,22 @@ fn write_impl<W>(registry: &Registry, de
}
writeln!(dest, "}}")
}
/// io::Writes all functions corresponding to the GL bindings.
///
/// These are foreign functions, they don't have any content.
-fn write_fns<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+fn write_fns<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
- try!(writeln!(dest, "
+ try!(writeln!(dest,
+ "
#[allow(non_snake_case)]
#[allow(unused_variables)]
#[allow(dead_code)]
extern \"system\" {{"));
for cmd in ®istry.cmds {
try!(writeln!(dest,
"#[link_name=\"{symbol}\"] fn {name}({params}) -> {return_suffix};",
--- a/third_party/rust/gl_generator/generators/struct_gen.rs
+++ b/third_party/rust/gl_generator/generators/struct_gen.rs
@@ -14,66 +14,79 @@
use registry::Registry;
use std::io;
#[allow(missing_copy_implementations)]
pub struct StructGenerator;
impl super::Generator for StructGenerator {
- fn write<W>(&self, registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+ fn write<W>(&self, registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+ {
try!(write_header(dest));
try!(write_type_aliases(registry, dest));
try!(write_enums(registry, dest));
try!(write_fnptr_struct_def(dest));
try!(write_panicking_fns(registry, dest));
try!(write_struct(registry, dest));
try!(write_impl(registry, dest));
Ok(())
}
}
/// Creates a `__gl_imports` module which contains all the external symbols that we need for the
/// bindings.
-fn write_header<W>(dest: &mut W) -> io::Result<()> where W: io::Write {
- writeln!(dest, r#"
+fn write_header<W>(dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ writeln!(dest,
+ r#"
mod __gl_imports {{
pub use std::mem;
pub use std::marker::Send;
pub use std::os::raw;
}}
"#)
}
/// Creates a `types` module which contains all the type aliases.
///
/// See also `generators::gen_types`.
-fn write_type_aliases<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
- try!(writeln!(dest, r#"
+fn write_type_aliases<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ try!(writeln!(dest,
+ r#"
pub mod types {{
#![allow(non_camel_case_types, non_snake_case, dead_code, missing_copy_implementations)]
"#));
try!(super::gen_types(registry.api, dest));
writeln!(dest, "}}")
}
/// Creates all the `<enum>` elements at the root of the bindings.
-fn write_enums<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+fn write_enums<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
for enm in ®istry.enums {
try!(super::gen_enum_item(enm, "types::", dest));
}
Ok(())
}
/// Creates a `FnPtr` structure which contains the store for a single binding.
-fn write_fnptr_struct_def<W>(dest: &mut W) -> io::Result<()> where W: io::Write {
- writeln!(dest, "
+fn write_fnptr_struct_def<W>(dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ writeln!(dest,
+ "
#[allow(dead_code, missing_copy_implementations)]
#[derive(Clone)]
pub struct FnPtr {{
/// The function pointer that will be used when calling the function.
f: *const __gl_imports::raw::c_void,
/// True if the pointer points to a real function, false if points to a `panic!` fn.
is_loaded: bool,
}}
@@ -101,51 +114,56 @@ fn write_fnptr_struct_def<W>(dest: &mut
}}
}}
")
}
/// Creates a `panicking` module which contains one function per GL command.
///
/// These functions are the mocks that are called if the real function could not be loaded.
-fn write_panicking_fns<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+fn write_panicking_fns<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
writeln!(dest,
- "#[inline(never)]
+ "#[inline(never)]
fn missing_fn_panic() -> ! {{
panic!(\"{api} function was not loaded\")
}}",
- api = registry.api
- )
+ api = registry.api)
}
/// Creates a structure which stores all the `FnPtr` of the bindings.
///
/// The name of the struct corresponds to the namespace.
-fn write_struct<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
- try!(writeln!(dest, "
+fn write_struct<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
+ try!(writeln!(dest,
+ "
#[allow(non_camel_case_types, non_snake_case, dead_code)]
#[derive(Clone)]
pub struct {api} {{",
- api = super::gen_struct_name(registry.api)
- ));
+ api = super::gen_struct_name(registry.api)));
for cmd in ®istry.cmds {
if let Some(v) = registry.aliases.get(&cmd.proto.ident) {
try!(writeln!(dest, "/// Fallbacks: {}", v.join(", ")));
}
try!(writeln!(dest, "pub {name}: FnPtr,", name = cmd.proto.ident));
}
writeln!(dest, "}}")
}
/// Creates the `impl` of the structure created by `write_struct`.
-fn write_impl<W>(registry: &Registry, dest: &mut W) -> io::Result<()> where W: io::Write {
+fn write_impl<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
+ where W: io::Write
+{
try!(writeln!(dest,
- "impl {api} {{
+ "impl {api} {{
/// Load each OpenGL symbol using a custom load function. This allows for the
/// use of functions like `glfwGetProcAddress` or `SDL_GL_GetProcAddress`.
///
/// ~~~ignore
/// let gl = Gl::load_with(|s| glfw.get_proc_address(s));
/// ~~~
#[allow(dead_code, unused_variables)]
pub fn load_with<F>(mut loadfn: F) -> {api} where F: FnMut(&str) -> *const __gl_imports::raw::c_void {{
@@ -162,18 +180,17 @@ fn write_impl<W>(registry: &Registry, de
}}
}}
ptr
}}
let mut metaloadfn = |symbol: &str, symbols: &[&str]| {{
do_metaloadfn(&mut loadfn, symbol, symbols)
}};
{api} {{",
- api = super::gen_struct_name(registry.api)
- ));
+ api = super::gen_struct_name(registry.api)));
for cmd in ®istry.cmds {
try!(writeln!(dest,
"{name}: FnPtr::new(metaloadfn(\"{symbol}\", &[{fallbacks}])),",
name = cmd.proto.ident,
symbol = super::gen_symbol_name(registry.api, &cmd.proto.ident),
fallbacks = match registry.aliases.get(&cmd.proto.ident) {
Some(fbs) => {
@@ -182,19 +199,18 @@ fn write_impl<W>(registry: &Registry, de
.collect::<Vec<_>>().join(", ")
},
None => format!(""),
},
))
}
try!(writeln!(dest,
- "}}
- }}"
- ));
+ "}}
+ }}"));
for cmd in ®istry.cmds {
try!(writeln!(dest,
"#[allow(non_snake_case, unused_variables, dead_code)]
#[inline] pub unsafe fn {name}(&self, {params}) -> {return_suffix} {{ \
__gl_imports::mem::transmute::<_, extern \"system\" fn({typed_params}) -> {return_suffix}>\
(self.{name}.f)({idents}) \
}}",
@@ -202,14 +218,13 @@ fn write_impl<W>(registry: &Registry, de
params = super::gen_parameters(cmd, true, true).join(", "),
typed_params = super::gen_parameters(cmd, false, true).join(", "),
return_suffix = cmd.proto.ty,
idents = super::gen_parameters(cmd, true, false).join(", "),
))
}
writeln!(dest,
- "}}
+ "}}
unsafe impl __gl_imports::Send for {api} {{}}",
- api = super::gen_struct_name(registry.api)
- )
+ api = super::gen_struct_name(registry.api))
}
--- a/third_party/rust/gl_generator/generators/templates/types/egl.rs
+++ b/third_party/rust/gl_generator/generators/templates/types/egl.rs
@@ -1,24 +1,32 @@
// platform-specific aliases are unknown
// IMPORTANT: these are alises to the same level of the bindings
// the values must be defined by the user
+#[allow(dead_code)]
pub type khronos_utime_nanoseconds_t = super::khronos_utime_nanoseconds_t;
+#[allow(dead_code)]
pub type khronos_uint64_t = super::khronos_uint64_t;
+#[allow(dead_code)]
pub type khronos_ssize_t = super::khronos_ssize_t;
pub type EGLNativeDisplayType = super::EGLNativeDisplayType;
+#[allow(dead_code)]
pub type EGLNativePixmapType = super::EGLNativePixmapType;
+#[allow(dead_code)]
pub type EGLNativeWindowType = super::EGLNativeWindowType;
pub type EGLint = super::EGLint;
+#[allow(dead_code)]
pub type NativeDisplayType = super::NativeDisplayType;
+#[allow(dead_code)]
pub type NativePixmapType = super::NativePixmapType;
+#[allow(dead_code)]
pub type NativeWindowType = super::NativeWindowType;
// EGL alises
-pub type Bool = EGLBoolean; // TODO: not sure
+pub type Bool = EGLBoolean; // TODO: not sure
pub type EGLBoolean = super::__gl_imports::raw::c_uint;
pub type EGLenum = super::__gl_imports::raw::c_uint;
pub type EGLAttribKHR = isize;
pub type EGLAttrib = isize;
pub type EGLConfig = *const super::__gl_imports::raw::c_void;
pub type EGLContext = *const super::__gl_imports::raw::c_void;
pub type EGLDeviceEXT = *const super::__gl_imports::raw::c_void;
pub type EGLDisplay = *const super::__gl_imports::raw::c_void;
@@ -35,18 +43,26 @@ pub type EGLTimeKHR = khronos_utime_nano
pub type EGLTime = khronos_utime_nanoseconds_t;
pub type EGLSyncNV = *const super::__gl_imports::raw::c_void;
pub type EGLTimeNV = khronos_utime_nanoseconds_t;
pub type EGLuint64NV = khronos_utime_nanoseconds_t;
pub type EGLStreamKHR = *const super::__gl_imports::raw::c_void;
pub type EGLuint64KHR = khronos_uint64_t;
pub type EGLNativeFileDescriptorKHR = super::__gl_imports::raw::c_int;
pub type EGLsizeiANDROID = khronos_ssize_t;
-pub type EGLSetBlobFuncANDROID = extern "system" fn(*const super::__gl_imports::raw::c_void, EGLsizeiANDROID, *const super::__gl_imports::raw::c_void, EGLsizeiANDROID) -> ();
-pub type EGLGetBlobFuncANDROID = extern "system" fn(*const super::__gl_imports::raw::c_void, EGLsizeiANDROID, *mut super::__gl_imports::raw::c_void, EGLsizeiANDROID) -> EGLsizeiANDROID;
+pub type EGLSetBlobFuncANDROID = extern "system" fn(*const super::__gl_imports::raw::c_void,
+ EGLsizeiANDROID,
+ *const super::__gl_imports::raw::c_void,
+ EGLsizeiANDROID)
+ -> ();
+pub type EGLGetBlobFuncANDROID = extern "system" fn(*const super::__gl_imports::raw::c_void,
+ EGLsizeiANDROID,
+ *mut super::__gl_imports::raw::c_void,
+ EGLsizeiANDROID)
+ -> EGLsizeiANDROID;
#[repr(C)]
pub struct EGLClientPixmapHI {
pData: *const super::__gl_imports::raw::c_void,
iWidth: EGLint,
iHeight: EGLint,
iStride: EGLint,
}
--- a/third_party/rust/gl_generator/generators/templates/types/gl.rs
+++ b/third_party/rust/gl_generator/generators/templates/types/gl.rs
@@ -14,18 +14,20 @@ pub type GLsizei = super::__gl_imports::
pub type GLfloat = super::__gl_imports::raw::c_float;
pub type GLclampf = super::__gl_imports::raw::c_float;
pub type GLdouble = super::__gl_imports::raw::c_double;
pub type GLclampd = super::__gl_imports::raw::c_double;
pub type GLeglImageOES = *const super::__gl_imports::raw::c_void;
pub type GLchar = super::__gl_imports::raw::c_char;
pub type GLcharARB = super::__gl_imports::raw::c_char;
-#[cfg(target_os = "macos")] pub type GLhandleARB = *const super::__gl_imports::raw::c_void;
-#[cfg(not(target_os = "macos"))] pub type GLhandleARB = super::__gl_imports::raw::c_uint;
+#[cfg(target_os = "macos")]
+pub type GLhandleARB = *const super::__gl_imports::raw::c_void;
+#[cfg(not(target_os = "macos"))]
+pub type GLhandleARB = super::__gl_imports::raw::c_uint;
pub type GLhalfARB = super::__gl_imports::raw::c_ushort;
pub type GLhalf = super::__gl_imports::raw::c_ushort;
// Must be 32 bits
pub type GLfixed = GLint;
pub type GLintptr = isize;
@@ -35,23 +37,41 @@ pub type GLuint64 = u64;
pub type GLintptrARB = isize;
pub type GLsizeiptrARB = isize;
pub type GLint64EXT = i64;
pub type GLuint64EXT = u64;
pub enum __GLsync {}
pub type GLsync = *const __GLsync;
- // compatible with OpenCL cl_context
+// compatible with OpenCL cl_context
pub enum _cl_context {}
pub enum _cl_event {}
-pub type GLDEBUGPROC = extern "system" fn(source: GLenum, gltype: GLenum, id: GLuint, severity: GLenum, length: GLsizei, message: *const GLchar, userParam: *mut super::__gl_imports::raw::c_void);
-pub type GLDEBUGPROCARB = extern "system" fn(source: GLenum, gltype: GLenum, id: GLuint, severity: GLenum, length: GLsizei, message: *const GLchar, userParam: *mut super::__gl_imports::raw::c_void);
-pub type GLDEBUGPROCKHR = extern "system" fn(source: GLenum, gltype: GLenum, id: GLuint, severity: GLenum, length: GLsizei, message: *const GLchar, userParam: *mut super::__gl_imports::raw::c_void);
+pub type GLDEBUGPROC = extern "system" fn(source: GLenum,
+ gltype: GLenum,
+ id: GLuint,
+ severity: GLenum,
+ length: GLsizei,
+ message: *const GLchar,
+ userParam: *mut super::__gl_imports::raw::c_void);
+pub type GLDEBUGPROCARB = extern "system" fn(source: GLenum,
+ gltype: GLenum,
+ id: GLuint,
+ severity: GLenum,
+ length: GLsizei,
+ message: *const GLchar,
+ userParam: *mut super::__gl_imports::raw::c_void);
+pub type GLDEBUGPROCKHR = extern "system" fn(source: GLenum,
+ gltype: GLenum,
+ id: GLuint,
+ severity: GLenum,
+ length: GLsizei,
+ message: *const GLchar,
+ userParam: *mut super::__gl_imports::raw::c_void);
// GLES 1 types
// "pub type GLclampx = i32;",
// GLES 1/2 types (tagged for GLES 1)
// "pub type GLbyte = i8;",
// "pub type GLubyte = u8;",
// "pub type GLfloat = GLfloat;",
@@ -73,11 +93,16 @@ pub type GLDEBUGPROCKHR = extern "system
// "pub type GLint64EXT = i64;",
// "pub type GLuint64EXT = u64;",
// "pub type GLintptr = intptr_t;",
// "pub type GLsizeiptr = ssize_t;",
// GLES 2 types (none currently)
// Vendor extension types
-pub type GLDEBUGPROCAMD = extern "system" fn(id: GLuint, category: GLenum, severity: GLenum, length: GLsizei, message: *const GLchar, userParam: *mut super::__gl_imports::raw::c_void);
+pub type GLDEBUGPROCAMD = extern "system" fn(id: GLuint,
+ category: GLenum,
+ severity: GLenum,
+ length: GLsizei,
+ message: *const GLchar,
+ userParam: *mut super::__gl_imports::raw::c_void);
pub type GLhalfNV = super::__gl_imports::raw::c_ushort;
pub type GLvdpauSurfaceNV = GLintptr;
--- a/third_party/rust/gl_generator/generators/templates/types/glx.rs
+++ b/third_party/rust/gl_generator/generators/templates/types/glx.rs
@@ -34,94 +34,94 @@ pub struct XVisualInfo {
pub green_mask: super::__gl_imports::raw::c_ulong,
pub blue_mask: super::__gl_imports::raw::c_ulong,
pub colormap_size: super::__gl_imports::raw::c_int,
pub bits_per_rgb: super::__gl_imports::raw::c_int,
}
#[repr(C)]
pub struct GLXPbufferClobberEvent {
- pub event_type: super::__gl_imports::raw::c_int, // GLX_DAMAGED or GLX_SAVED
- pub draw_type: super::__gl_imports::raw::c_int, // GLX_WINDOW or GLX_PBUFFER
- pub serial: super::__gl_imports::raw::c_ulong, // # of last request processed by server
- pub send_event: Bool, // true if this came for SendEvent request
- pub display: *const Display, // display the event was read from
- pub drawable: GLXDrawable, // XID of Drawable
- pub buffer_mask: super::__gl_imports::raw::c_uint, // mask indicating which buffers are affected
- pub aux_buffer: super::__gl_imports::raw::c_uint, // which aux buffer was affected
+ pub event_type: super::__gl_imports::raw::c_int, // GLX_DAMAGED or GLX_SAVED
+ pub draw_type: super::__gl_imports::raw::c_int, // GLX_WINDOW or GLX_PBUFFER
+ pub serial: super::__gl_imports::raw::c_ulong, // # of last request processed by server
+ pub send_event: Bool, // true if this came for SendEvent request
+ pub display: *const Display, // display the event was read from
+ pub drawable: GLXDrawable, // XID of Drawable
+ pub buffer_mask: super::__gl_imports::raw::c_uint, // mask indicating which buffers are affected
+ pub aux_buffer: super::__gl_imports::raw::c_uint, // which aux buffer was affected
pub x: super::__gl_imports::raw::c_int,
pub y: super::__gl_imports::raw::c_int,
pub width: super::__gl_imports::raw::c_int,
pub height: super::__gl_imports::raw::c_int,
- pub count: super::__gl_imports::raw::c_int, // if nonzero, at least this many more
+ pub count: super::__gl_imports::raw::c_int, // if nonzero, at least this many more
}
#[repr(C)]
pub struct GLXBufferSwapComplete {
pub type_: super::__gl_imports::raw::c_int,
- pub serial: super::__gl_imports::raw::c_ulong, // # of last request processed by server
- pub send_event: Bool, // true if this came from a SendEvent request
- pub display: *const Display, // Display the event was read from
- pub drawable: GLXDrawable, // drawable on which event was requested in event mask
+ pub serial: super::__gl_imports::raw::c_ulong, // # of last request processed by server
+ pub send_event: Bool, // true if this came from a SendEvent request
+ pub display: *const Display, // Display the event was read from
+ pub drawable: GLXDrawable, // drawable on which event was requested in event mask
pub event_type: super::__gl_imports::raw::c_int,
pub ust: i64,
pub msc: i64,
pub sbc: i64,
}
// typedef union __GLXEvent {
// GLXPbufferClobberEvent glxpbufferclobber;
// GLXBufferSwapComplete glxbufferswapcomplete;
// long pad[24];
// }
#[repr(C)]
pub struct GLXBufferClobberEventSGIX {
pub type_: super::__gl_imports::raw::c_int,
- pub serial: super::__gl_imports::raw::c_ulong, // # of last request processed by server
- pub send_event: Bool, // true if this came for SendEvent request
- pub display: *const Display, // display the event was read from
- pub drawable: GLXDrawable, // i.d. of Drawable
- pub event_type: super::__gl_imports::raw::c_int, // GLX_DAMAGED_SGIX or GLX_SAVED_SGIX
- pub draw_type: super::__gl_imports::raw::c_int, // GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX
- pub mask: super::__gl_imports::raw::c_uint, // mask indicating which buffers are affected
+ pub serial: super::__gl_imports::raw::c_ulong, // # of last request processed by server
+ pub send_event: Bool, // true if this came for SendEvent request
+ pub display: *const Display, // display the event was read from
+ pub drawable: GLXDrawable, // i.d. of Drawable
+ pub event_type: super::__gl_imports::raw::c_int, // GLX_DAMAGED_SGIX or GLX_SAVED_SGIX
+ pub draw_type: super::__gl_imports::raw::c_int, // GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX
+ pub mask: super::__gl_imports::raw::c_uint, // mask indicating which buffers are affected
pub x: super::__gl_imports::raw::c_int,
pub y: super::__gl_imports::raw::c_int,
pub width: super::__gl_imports::raw::c_int,
pub height: super::__gl_imports::raw::c_int,
- pub count: super::__gl_imports::raw::c_int, // if nonzero, at least this many more
+ pub count: super::__gl_imports::raw::c_int, // if nonzero, at least this many more
}
#[repr(C)]
pub struct GLXHyperpipeNetworkSGIX {
- pub pipeName: [super::__gl_imports::raw::c_char; 80], // Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]
+ pub pipeName: [super::__gl_imports::raw::c_char; 80], // Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]
pub networkId: super::__gl_imports::raw::c_int,
}
#[repr(C)]
pub struct GLXHyperpipeConfigSGIX {
- pub pipeName: [super::__gl_imports::raw::c_char; 80], // Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]
+ pub pipeName: [super::__gl_imports::raw::c_char; 80], // Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]
pub channel: super::__gl_imports::raw::c_int,
pub participationType: super::__gl_imports::raw::c_uint,
pub timeSlice: super::__gl_imports::raw::c_int,
}
#[repr(C)]
pub struct GLXPipeRect {
- pub pipeName: [super::__gl_imports::raw::c_char; 80], // Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]
+ pub pipeName: [super::__gl_imports::raw::c_char; 80], // Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]
pub srcXOrigin: super::__gl_imports::raw::c_int,
pub srcYOrigin: super::__gl_imports::raw::c_int,
pub srcWidth: super::__gl_imports::raw::c_int,
pub srcHeight: super::__gl_imports::raw::c_int,
pub destXOrigin: super::__gl_imports::raw::c_int,
pub destYOrigin: super::__gl_imports::raw::c_int,
pub destWidth: super::__gl_imports::raw::c_int,
pub destHeight: super::__gl_imports::raw::c_int,
}
#[repr(C)]
pub struct GLXPipeRectLimits {
- pub pipeName: [super::__gl_imports::raw::c_char; 80], // Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]
+ pub pipeName: [super::__gl_imports::raw::c_char; 80], // Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]
pub XOrigin: super::__gl_imports::raw::c_int,
pub YOrigin: super::__gl_imports::raw::c_int,
pub maxHeight: super::__gl_imports::raw::c_int,
pub maxWidth: super::__gl_imports::raw::c_int,
}
--- a/third_party/rust/gl_generator/generators/templates/types/wgl.rs
+++ b/third_party/rust/gl_generator/generators/templates/types/wgl.rs
@@ -21,17 +21,17 @@ pub type BYTE = super::__gl_imports::raw
pub type COLORREF = DWORD;
pub type FLOAT = super::__gl_imports::raw::c_float;
pub type HDC = HANDLE;
pub type HENHMETAFILE = HANDLE;
pub type HGLRC = *const super::__gl_imports::raw::c_void;
pub type INT = super::__gl_imports::raw::c_int;
pub type PVOID = *const super::__gl_imports::raw::c_void;
pub type LPVOID = *const super::__gl_imports::raw::c_void;
-pub type PROC = extern "system" fn(); // Not sure about this one :/
+pub type PROC = extern "system" fn(); // Not sure about this one :/
#[repr(C)]
pub struct RECT {
left: LONG,
top: LONG,
right: LONG,
bottom: LONG,
}
--- a/third_party/rust/gl_generator/registry/mod.rs
+++ b/third_party/rust/gl_generator/registry/mod.rs
@@ -10,105 +10,126 @@
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
extern crate khronos_api;
use std::borrow::Cow;
-use std::collections::{BTreeSet, HashMap, HashSet};
+use std::collections::{BTreeMap, BTreeSet};
use std::fmt;
use std::hash::{Hash, Hasher};
use std::io;
use std::ops::Add;
use Generator;
mod parse;
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
-pub enum Api { Gl, Glx, Wgl, Egl, GlCore, Gles1, Gles2 }
+pub enum Api {
+ Gl,
+ Glx,
+ Wgl,
+ Egl,
+ GlCore,
+ Gles1,
+ Gles2,
+}
impl fmt::Display for Api {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
match *self {
- Api::Gl => write!(fmt, "gl"),
+ Api::Gl => write!(fmt, "gl"),
Api::Glx => write!(fmt, "glx"),
Api::Wgl => write!(fmt, "wgl"),
Api::Egl => write!(fmt, "egl"),
Api::GlCore => write!(fmt, "glcore"),
Api::Gles1 => write!(fmt, "gles1"),
Api::Gles2 => write!(fmt, "gles2"),
}
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
-pub enum Fallbacks { All, None }
+pub enum Fallbacks {
+ All,
+ None,
+}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
-pub enum Profile { Core, Compatibility }
+pub enum Profile {
+ Core,
+ Compatibility,
+}
-#[derive(Clone, Debug, PartialEq, Eq)]
+#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct Enum {
pub ident: String,
pub value: String,
pub cast: bool,
pub alias: Option<String>,
pub ty: Cow<'static, str>,
}
impl Hash for Enum {
fn hash<H: Hasher>(&self, state: &mut H) {
self.ident.hash(state);
}
}
-#[derive(Clone, Debug, PartialEq, Eq)]
+#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct Binding {
pub ident: String,
pub ty: Cow<'static, str>,
}
-#[derive(Clone, Debug, PartialEq, Eq)]
+#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct Cmd {
pub proto: Binding,
pub params: Vec<Binding>,
pub alias: Option<String>,
pub vecequiv: Option<String>,
pub glx: Option<GlxOpcode>,
}
impl Hash for Cmd {
fn hash<H: Hasher>(&self, state: &mut H) {
self.proto.ident.hash(state);
}
}
-#[derive(Clone, Debug, PartialEq, Eq)]
+#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct GlxOpcode {
pub opcode: String,
pub name: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Registry {
pub api: Api,
- pub enums: HashSet<Enum>,
- pub cmds: HashSet<Cmd>,
- pub aliases: HashMap<String, Vec<String>>,
+ pub enums: BTreeSet<Enum>,
+ pub cmds: BTreeSet<Cmd>,
+ pub aliases: BTreeMap<String, Vec<String>>,
}
impl Registry {
- pub fn new<'a, Exts>(api: Api, version: (u8, u8), profile: Profile, fallbacks: Fallbacks, extensions: Exts) -> Registry where
- Exts: AsRef<[&'a str]>,
+ pub fn new<'a, Exts>(api: Api,
+ version: (u8, u8),
+ profile: Profile,
+ fallbacks: Fallbacks,
+ extensions: Exts)
+ -> Registry
+ where Exts: AsRef<[&'a str]>
{
let (major, minor) = version;
- let extensions = extensions.as_ref().iter()
+ let extensions = extensions
+ .as_ref()
+ .iter()
.map(<&str>::to_string)
.collect();
let filter = parse::Filter {
api: api,
fallbacks: fallbacks,
extensions: extensions,
version: format!("{}.{}", major, minor),
@@ -120,19 +141,19 @@ impl Registry {
Api::Glx => khronos_api::GLX_XML,
Api::Wgl => khronos_api::WGL_XML,
Api::Egl => khronos_api::EGL_XML,
};
parse::from_xml(src, filter)
}
- pub fn write_bindings<W, G>(&self, generator: G, output: &mut W) -> io::Result<()> where
- G: Generator,
- W: io::Write,
+ pub fn write_bindings<W, G>(&self, generator: G, output: &mut W) -> io::Result<()>
+ where G: Generator,
+ W: io::Write
{
generator.write(&self, output)
}
/// Returns a set of all the types used in the supplied registry. This is useful
/// for working out what conversions are needed for the specific registry.
pub fn get_tys(&self) -> BTreeSet<&str> {
let mut tys = BTreeSet::new();
--- a/third_party/rust/gl_generator/registry/parse.rs
+++ b/third_party/rust/gl_generator/registry/parse.rs
@@ -10,45 +10,44 @@
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
extern crate khronos_api;
use std::borrow::Cow;
-use std::collections::hash_map::Entry;
-use std::collections::BTreeSet;
-use std::collections::HashSet;
-use std::collections::HashMap;
+use std::collections::btree_map::Entry;
+use std::collections::{BTreeMap, BTreeSet};
use std::io;
use xml::attribute::OwnedAttribute;
use xml::EventReader as XmlEventReader;
use xml::reader::XmlEvent;
use {Fallbacks, Api, Profile};
use registry::{Binding, Cmd, Enum, GlxOpcode, Registry};
pub fn from_xml<R: io::Read>(src: R, filter: Filter) -> Registry {
- XmlEventReader::new(src).into_iter()
+ XmlEventReader::new(src)
+ .into_iter()
.map(Result::unwrap)
.filter_map(ParseEvent::from_xml)
.parse(filter)
}
#[derive(Debug, PartialEq, Eq)]
struct Attribute {
key: String,
value: String,
}
impl Attribute {
- fn new<Key, Value>(key: Key, value: Value) -> Attribute where
- Key: ToString,
- Value: ToString,
+ fn new<Key, Value>(key: Key, value: Value) -> Attribute
+ where Key: ToString,
+ Value: ToString
{
Attribute {
key: key.to_string(),
value: value.to_string(),
}
}
}
@@ -66,21 +65,19 @@ enum ParseEvent {
}
impl ParseEvent {
fn from_xml(event: XmlEvent) -> Option<ParseEvent> {
match event {
XmlEvent::StartDocument { .. } => None,
XmlEvent::EndDocument => None,
XmlEvent::StartElement { name, attributes, .. } => {
- let attributes = attributes.into_iter()
- .map(Attribute::from)
- .collect();
+ let attributes = attributes.into_iter().map(Attribute::from).collect();
Some(ParseEvent::Start(name.local_name, attributes))
- },
+ }
XmlEvent::EndElement { name } => Some(ParseEvent::End(name.local_name)),
XmlEvent::Characters(chars) => Some(ParseEvent::Text(chars)),
XmlEvent::ProcessingInstruction { .. } => None,
XmlEvent::CData(_) => None,
XmlEvent::Comment(_) => None,
XmlEvent::Whitespace(_) => None,
}
}
@@ -90,17 +87,17 @@ fn api_from_str(src: &str) -> Result<Api
match src {
"gl" => Ok(Api::Gl),
"glx" => Ok(Api::Glx),
"wgl" => Ok(Api::Wgl),
"egl" => Ok(Api::Egl),
"glcore" => Ok(Api::GlCore),
"gles1" => Ok(Api::Gles1),
"gles2" => Ok(Api::Gles2),
- _ => Err(()),
+ _ => Err(()),
}
}
fn profile_from_str(src: &str) -> Result<Profile, ()> {
match src {
"core" => Ok(Profile::Core),
"compatibility" => Ok(Profile::Compatibility),
_ => Err(()),
@@ -119,40 +116,44 @@ fn underscore_keyword(ident: String) ->
"in" => "in_".to_string(),
"ref" => "ref_".to_string(),
"type" => "type_".to_string(),
_ => ident,
}
}
fn trim_str<'a>(s: &'a str, trim: &str) -> &'a str {
- if s.starts_with(trim) { &s[trim.len()..] } else { s }
+ if s.starts_with(trim) {
+ &s[trim.len()..]
+ } else {
+ s
+ }
}
fn trim_enum_prefix(ident: &str, api: Api) -> String {
let ident = match api {
Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 => trim_str(ident, "GL_"),
Api::Glx => trim_str(ident, "GLX_"),
- Api::Wgl => trim_str(ident, "WGL_"),
- Api::Egl => trim_str(ident, "EGL_"),
+ Api::Wgl => trim_str(ident, "WGL_"),
+ Api::Egl => trim_str(ident, "EGL_"),
};
underscore_numeric_prefix(ident)
}
fn make_enum(ident: String, ty: Option<String>, value: String, alias: Option<String>) -> Enum {
let (ty, value, cast) = {
if value.starts_with("((") && value.ends_with(")") {
// Some enums have a value of the form `'((' type ')' expr ')'`.
// nothing to see here....
// just brute forcing some paren matching... (ノ ◕ ◡ ◕)ノ *:・゚✧
- let working = &value[2 .. value.len() - 1];
+ let working = &value[2..value.len() - 1];
if let Some((i, _)) = working.match_indices(")").next() {
- let ty = working[.. i].to_string();
- let value = working[i + 1 ..].to_string();
+ let ty = working[..i].to_string();
+ let value = working[i + 1..].to_string();
(Cow::Owned(ty), value, true)
} else {
panic!("Unexpected value format: {}", value)
}
} else {
let ty = match ty {
Some(ref ty) if ty == "u" => "GLuint",
@@ -174,26 +175,30 @@ fn make_enum(ident: String, ty: Option<S
ty: ty,
}
}
fn trim_cmd_prefix(ident: &str, api: Api) -> &str {
match api {
Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 => trim_str(ident, "gl"),
Api::Glx => trim_str(ident, "glX"),
- Api::Wgl => trim_str(ident, "wgl"),
- Api::Egl => trim_str(ident, "egl"),
+ Api::Wgl => trim_str(ident, "wgl"),
+ Api::Egl => trim_str(ident, "egl"),
}
}
-fn merge_map(a: &mut HashMap<String, Vec<String>>, b: HashMap<String, Vec<String>>) {
+fn merge_map(a: &mut BTreeMap<String, Vec<String>>, b: BTreeMap<String, Vec<String>>) {
for (k, v) in b {
match a.entry(k) {
- Entry::Occupied(mut ent) => { ent.get_mut().extend(v); },
- Entry::Vacant(ent) => { ent.insert(v); }
+ Entry::Occupied(mut ent) => {
+ ent.get_mut().extend(v);
+ }
+ Entry::Vacant(ent) => {
+ ent.insert(v);
+ }
}
}
}
#[derive(Clone)]
struct Feature {
pub api: Api,
pub name: String,
@@ -239,17 +244,17 @@ pub struct Filter {
trait Parse: Sized + Iterator<Item = ParseEvent> {
fn parse(mut self, filter: Filter) -> Registry {
self.consume_start_element("registry");
let mut enums = Vec::new();
let mut cmds = Vec::new();
let mut features = Vec::new();
let mut extensions = Vec::new();
- let mut aliases = HashMap::new();
+ let mut aliases = BTreeMap::new();
while let Some(event) = self.next() {
match event {
// ignores
ParseEvent::Text(_) => (),
ParseEvent::Start(ref name, _) if name == "comment" => self.skip_to_end("comment"),
ParseEvent::Start(ref name, _) if name == "types" => self.skip_to_end("types"),
ParseEvent::Start(ref name, _) if name == "groups" => self.skip_to_end("groups"),
@@ -286,18 +291,18 @@ trait Parse: Sized + Iterator<Item = Par
// finished building the registry
ParseEvent::End(ref name) if name == "registry" => break,
// error handling
event => panic!("Expected </registry>, found: {:?}", event),
}
}
- let mut desired_enums = HashSet::new();
- let mut desired_cmds = HashSet::new();
+ let mut desired_enums = BTreeSet::new();
+ let mut desired_cmds = BTreeSet::new();
// find the features we want
let mut found_feature = false;
for feature in &features {
// XXX: verify that the string comparison with <= actually works as desired
if feature.api == filter.api && feature.number <= filter.version {
for require in &feature.requires {
desired_enums.extend(require.enums.iter().map(|x| x.clone()));
@@ -324,17 +329,19 @@ trait Parse: Sized + Iterator<Item = Par
if !found_feature {
panic!("Did not find version {} in the registry", filter.version);
}
for extension in &extensions {
if filter.extensions.contains(&extension.name) {
if !extension.supported.contains(&filter.api) {
- panic!("Requested {}, which doesn't support the {} API", extension.name, filter.api);
+ panic!("Requested {}, which doesn't support the {} API",
+ extension.name,
+ filter.api);
}
for require in &extension.requires {
desired_enums.extend(require.enums.iter().map(|x| x.clone()));
desired_cmds.extend(require.commands.iter().map(|x| x.clone()));
}
}
}
@@ -351,31 +358,37 @@ trait Parse: Sized + Iterator<Item = Par
desired_cmds.contains(&("glX".to_string() + &c.proto.ident)) ||
desired_cmds.contains(&("egl".to_string() + &c.proto.ident))
};
Registry {
api: filter.api,
enums: enums.into_iter().filter(is_desired_enum).collect(),
cmds: cmds.into_iter().filter(is_desired_cmd).collect(),
- aliases: if filter.fallbacks == Fallbacks::None { HashMap::new() } else { aliases },
+ aliases: if filter.fallbacks == Fallbacks::None {
+ BTreeMap::new()
+ } else {
+ aliases
+ },
}
}
fn consume_characters(&mut self) -> String {
match self.next().unwrap() {
ParseEvent::Text(ch) => ch,
event => panic!("Expected characters, found: {:?}", event),
}
}
fn consume_start_element(&mut self, expected_name: &str) -> Vec<Attribute> {
match self.next().unwrap() {
ParseEvent::Start(name, attributes) => {
- if expected_name == name { attributes } else {
+ if expected_name == name {
+ attributes
+ } else {
panic!("Expected <{}>, found: <{}>", expected_name, name)
}
}
event => panic!("Expected <{}>, found: {:?}", expected_name, event),
}
}
fn consume_end_element(&mut self, expected_name: &str) {
@@ -384,22 +397,26 @@ trait Parse: Sized + Iterator<Item = Par
event => panic!("Expected </{}>, found: {:?}", expected_name, event),
}
}
fn skip_to_end(&mut self, expected_name: &str) {
loop {
match self.next().unwrap() {
ParseEvent::End(ref name) if expected_name == name => break,
- _ => {},
+ _ => {}
}
}
}
- fn consume_two<'a, T: FromXml, U: FromXml>(&mut self, one: &'a str, two: &'a str, end: &'a str) -> (Vec<T>, Vec<U>) {
+ fn consume_two<'a, T: FromXml, U: FromXml>(&mut self,
+ one: &'a str,
+ two: &'a str,
+ end: &'a str)
+ -> (Vec<T>, Vec<U>) {
debug!("consume_two: looking for {} and {} until {}", one, two, end);
let mut ones = Vec::new();
let mut twos = Vec::new();
loop {
match self.next().unwrap() {
ParseEvent::Start(ref name, ref attributes) => {
@@ -416,50 +433,51 @@ trait Parse: Sized + Iterator<Item = Par
// care about type.
warn!("Ignoring type!");
continue;
} else if two == n {
twos.push(FromXml::convert(self, &attributes));
} else {
panic!("Unexpected element: <{:?} {:?}>", n, &attributes);
}
- },
+ }
ParseEvent::End(ref name) => {
debug!("Found end element </{:?}>", name);
if one == name || two == name {
continue;
} else if "type" == name {
// XXX: GL1.1 contains types, which we never care about anyway.
// Make sure consume_two doesn't get used for things which *do*
// care about type.
warn!("Ignoring type!");
continue;
} else if end == name {
return (ones, twos);
} else {
panic!("Unexpected end element {:?}", name);
}
- },
- event => panic!("Unexpected message {:?}", event) }
+ }
+ event => panic!("Unexpected message {:?}", event),
+ }
}
}
fn consume_enums(&mut self, api: Api) -> Vec<Enum> {
let mut enums = Vec::new();
loop {
match self.next().unwrap() {
// ignores
- ParseEvent::Text(_) => {},
+ ParseEvent::Text(_) => {}
ParseEvent::Start(ref name, _) if name == "unused" => self.skip_to_end("unused"),
// add enum definition
ParseEvent::Start(ref name, ref attributes) if name == "enum" => {
enums.push(self.consume_enum(api, attributes));
- },
+ }
// finished building the namespace
ParseEvent::End(ref name) if name == "enums" => break,
// error handling
event => panic!("Expected </enums>, found: {:?}", event),
}
}
enums
@@ -470,28 +488,32 @@ trait Parse: Sized + Iterator<Item = Par
let value = get_attribute(&attributes, "value").unwrap();
let alias = get_attribute(&attributes, "alias");
let ty = get_attribute(&attributes, "type");
self.consume_end_element("enum");
make_enum(ident, ty, value, alias)
}
- fn consume_cmds(&mut self, api: Api) -> (Vec<Cmd>, HashMap<String, Vec<String>>) {
+ fn consume_cmds(&mut self, api: Api) -> (Vec<Cmd>, BTreeMap<String, Vec<String>>) {
let mut cmds = Vec::new();
- let mut aliases: HashMap<String, Vec<String>> = HashMap::new();
+ let mut aliases: BTreeMap<String, Vec<String>> = BTreeMap::new();
loop {
match self.next().unwrap() {
// add command definition
ParseEvent::Start(ref name, _) if name == "command" => {
let new = self.consume_cmd(api);
if let Some(ref v) = new.alias {
match aliases.entry(v.clone()) {
- Entry::Occupied(mut ent) => { ent.get_mut().push(new.proto.ident.clone()); },
- Entry::Vacant(ent) => { ent.insert(vec![new.proto.ident.clone()]); }
+ Entry::Occupied(mut ent) => {
+ ent.get_mut().push(new.proto.ident.clone());
+ }
+ Entry::Vacant(ent) => {
+ ent.insert(vec![new.proto.ident.clone()]);
+ }
}
}
cmds.push(new);
}
// finished building the namespace
ParseEvent::End(ref name) if name == "commands" => break,
// error handling
event => panic!("Expected </commands>, found: {:?}", event),
@@ -521,19 +543,19 @@ trait Parse: Sized + Iterator<Item = Par
self.consume_end_element("alias");
}
ParseEvent::Start(ref name, ref attributes) if name == "vecequiv" => {
vecequiv = get_attribute(&attributes, "vecequiv");
self.consume_end_element("vecequiv");
}
ParseEvent::Start(ref name, ref attributes) if name == "glx" => {
glx = Some(GlxOpcode {
- opcode: get_attribute(&attributes, "opcode").unwrap(),
- name: get_attribute(&attributes, "name"),
- });
+ opcode: get_attribute(&attributes, "opcode").unwrap(),
+ name: get_attribute(&attributes, "name"),
+ });
self.consume_end_element("glx");
}
ParseEvent::End(ref name) if name == "command" => break,
event => panic!("Expected </command>, found: {:?}", event),
}
}
Cmd {
@@ -573,52 +595,51 @@ trait Parse: Sized + Iterator<Item = Par
Binding {
ident: ident,
ty: to_rust_ty(ty),
}
}
}
-impl<T> Parse for T where
- T: Sized + Iterator<Item = ParseEvent>,
-{}
+impl<T> Parse for T where T: Sized + Iterator<Item = ParseEvent> {}
fn get_attribute(attribs: &[Attribute], key: &str) -> Option<String> {
- attribs.iter()
+ attribs
+ .iter()
.find(|attrib| attrib.key == key)
.map(|attrib| attrib.value.clone())
}
trait FromXml {
fn convert<P: Parse>(parser: &mut P, a: &[Attribute]) -> Self;
}
impl FromXml for Require {
fn convert<P: Parse>(parser: &mut P, _: &[Attribute]) -> Require {
debug!("Doing a FromXml on Require");
let (enums, commands) = parser.consume_two("enum", "command", "require");
Require {
enums: enums,
- commands: commands
+ commands: commands,
}
}
}
impl FromXml for Remove {
fn convert<P: Parse>(parser: &mut P, a: &[Attribute]) -> Remove {
debug!("Doing a FromXml on Remove");
let profile = get_attribute(a, "profile").unwrap();
let profile = profile_from_str(&profile).unwrap();
let (enums, commands) = parser.consume_two("enum", "command", "remove");
Remove {
profile: profile,
enums: enums,
- commands: commands
+ commands: commands,
}
}
}
impl FromXml for Feature {
fn convert<P: Parse>(parser: &mut P, a: &[Attribute]) -> Feature {
debug!("Doing a FromXml on Feature");
let api = get_attribute(a, "api").unwrap();
@@ -630,333 +651,334 @@ impl FromXml for Feature {
let (require, remove) = parser.consume_two("require", "remove", "feature");
Feature {
api: api,
name: name,
number: number,
requires: require,
- removes: remove
+ removes: remove,
}
}
}
impl FromXml for Extension {
fn convert<P: Parse>(parser: &mut P, a: &[Attribute]) -> Extension {
debug!("Doing a FromXml on Extension");
let name = get_attribute(a, "name").unwrap();
- let supported = get_attribute(a, "supported").unwrap()
+ let supported = get_attribute(a, "supported")
+ .unwrap()
.split('|')
.map(api_from_str)
.map(Result::unwrap)
.collect::<Vec<_>>();
let mut require = Vec::new();
loop {
match parser.next().unwrap() {
ParseEvent::Start(ref name, ref attributes) if name == "require" => {
require.push(FromXml::convert(parser, &attributes));
}
ParseEvent::End(ref name) if name == "extension" => break,
- event => panic!("Unexpected message {:?}", event)
+ event => panic!("Unexpected message {:?}", event),
}
}
Extension {
name: name,
supported: supported,
- requires: require
+ requires: require,
}
}
}
impl FromXml for String {
fn convert<P: Parse>(_: &mut P, a: &[Attribute]) -> String {
get_attribute(a, "name").unwrap()
}
}
/// Converts a C style type definition to the Rust equivalent
pub fn to_rust_ty<T: AsRef<str>>(ty: T) -> Cow<'static, str> {
let ty = match ty.as_ref() {
// gl.xml types
- "GLDEBUGPROC" => "types::GLDEBUGPROC",
- "GLDEBUGPROCAMD" => "types::GLDEBUGPROCAMD",
- "GLDEBUGPROCARB" => "types::GLDEBUGPROCARB",
- "GLDEBUGPROCKHR" => "types::GLDEBUGPROCKHR",
- "GLbitfield" => "types::GLbitfield",
- "GLboolean" => "types::GLboolean",
- "GLbyte" => "types::GLbyte",
- "GLclampd" => "types::GLclampd",
- "GLclampf" => "types::GLclampf",
- "GLclampx" => "types::GLclampx",
- "GLdouble" => "types::GLdouble",
- "GLeglImageOES" => "types::GLeglImageOES",
- "GLenum" => "types::GLenum",
- "GLfixed" => "types::GLfixed",
- "GLfloat" => "types::GLfloat",
- "GLhalfNV" => "types::GLhalfNV",
- "GLhandleARB" => "types::GLhandleARB",
- "GLint" => "types::GLint",
- "GLint64" => "types::GLint64",
- "GLint64EXT" => "types::GLint64EXT",
- "GLintptr" => "types::GLintptr",
- "GLintptrARB" => "types::GLintptrARB",
- "GLshort" => "types::GLshort",
- "GLsizei" => "types::GLsizei",
- "GLsizeiptr" => "types::GLsizeiptr",
- "GLsizeiptrARB" => "types::GLsizeiptrARB",
- "GLsync" => "types::GLsync",
- "GLubyte" => "types::GLubyte",
- "GLuint" => "types::GLuint",
- "GLuint64" => "types::GLuint64",
- "GLuint64EXT" => "types::GLuint64EXT",
- "GLushort" => "types::GLushort",
- "GLvdpauSurfaceNV" => "types::GLvdpauSurfaceNV",
- "void " => "()",
- "GLboolean *" => "*mut types::GLboolean",
- "GLchar *" => "*mut types::GLchar",
- "GLcharARB *" => "*mut types::GLcharARB",
- "GLdouble *" => "*mut types::GLdouble",
- "GLenum *" => "*mut types::GLenum",
- "GLfixed *" => "*mut types::GLfixed",
- "GLfloat *" => "*mut types::GLfloat",
- "GLhandleARB *" => "*mut types::GLhandleARB",
- "GLint *" => "*mut types::GLint",
- "GLint64 *" => "*mut types::GLint64",
- "GLint64EXT *" => "*mut types::GLint64EXT",
- "GLsizei *" => "*mut types::GLsizei",
- "GLubyte *" => "*mut types::GLubyte",
- "GLuint *" => "*mut types::GLuint",
- "GLuint [2]" => "*mut [types::GLuint; 2]",
- "GLuint64 *" => "*mut types::GLuint64",
- "GLuint64EXT *" => "*mut types::GLuint64EXT",
- "GLushort *" => "*mut types::GLushort",
- "GLvoid *" => "*mut types::GLvoid",
- "GLvoid **" => "*const *mut types::GLvoid",
- "void *" => "*mut __gl_imports::raw::c_void",
- "void **" => "*const *mut __gl_imports::raw::c_void",
- "const GLboolean *" => "*const types::GLboolean",
- "const GLbyte *" => "*const types::GLbyte",
- "const GLchar *" => "*const types::GLchar",
- "const GLcharARB *" => "*const types::GLcharARB",
- "const GLclampf *" => "*const types::GLclampf",
- "const GLdouble *" => "*const types::GLdouble",
- "const GLenum *" => "*const types::GLenum",
- "const GLfixed *" => "*const types::GLfixed",
- "const GLfloat" => "types::GLfloat",
- "const GLfloat *" => "*const types::GLfloat",
- "const GLhalfNV *" => "*const types::GLhalfNV",
- "const GLint *" => "*const types::GLint",
- "const GLint64 *" => "*const types::GLint64",
- "const GLint64EXT *" => "*const types::GLint64EXT",
- "const GLintptr *" => "*const types::GLintptr",
- "const GLshort *" => "*const types::GLshort",
- "const GLsizei *" => "*const types::GLsizei",
- "const GLsizeiptr *" => "*const types::GLsizeiptr",
- "const GLubyte *" => "*const types::GLubyte",
- "const GLuint *" => "*const types::GLuint",
- "const GLuint64 *" => "*const types::GLuint64",
- "const GLuint64EXT *" => "*const types::GLuint64EXT",
- "const GLushort *" => "*const types::GLushort",
- "const GLvdpauSurfaceNV *" => "*const types::GLvdpauSurfaceNV",
- "const GLvoid *" => "*const types::GLvoid",
- "const void *" => "*const __gl_imports::raw::c_void",
- "const void **" => "*const *const __gl_imports::raw::c_void",
- "const void *const*" => "*const *const __gl_imports::raw::c_void",
- "const GLboolean **" => "*const *const types::GLboolean",
- "const GLchar **" => "*const *const types::GLchar",
- "const GLcharARB **" => "*const *const types::GLcharARB",
- "const GLvoid **" => "*const *const types::GLvoid",
- "const GLchar *const*" => "*const *const types::GLchar",
- "const GLvoid *const*" => "*const *const types::GLvoid",
- "struct _cl_context *" => "*const types::_cl_context",
- "struct _cl_event *" => "*const types::_cl_event",
- "GLuint[2]" => "[Gluint; 2]",
+ "GLDEBUGPROC" => "types::GLDEBUGPROC",
+ "GLDEBUGPROCAMD" => "types::GLDEBUGPROCAMD",
+ "GLDEBUGPROCARB" => "types::GLDEBUGPROCARB",
+ "GLDEBUGPROCKHR" => "types::GLDEBUGPROCKHR",
+ "GLbitfield" => "types::GLbitfield",
+ "GLboolean" => "types::GLboolean",
+ "GLbyte" => "types::GLbyte",
+ "GLclampd" => "types::GLclampd",
+ "GLclampf" => "types::GLclampf",
+ "GLclampx" => "types::GLclampx",
+ "GLdouble" => "types::GLdouble",
+ "GLeglImageOES" => "types::GLeglImageOES",
+ "GLenum" => "types::GLenum",
+ "GLfixed" => "types::GLfixed",
+ "GLfloat" => "types::GLfloat",
+ "GLhalfNV" => "types::GLhalfNV",
+ "GLhandleARB" => "types::GLhandleARB",
+ "GLint" => "types::GLint",
+ "GLint64" => "types::GLint64",
+ "GLint64EXT" => "types::GLint64EXT",
+ "GLintptr" => "types::GLintptr",
+ "GLintptrARB" => "types::GLintptrARB",
+ "GLshort" => "types::GLshort",
+ "GLsizei" => "types::GLsizei",
+ "GLsizeiptr" => "types::GLsizeiptr",
+ "GLsizeiptrARB" => "types::GLsizeiptrARB",
+ "GLsync" => "types::GLsync",
+ "GLubyte" => "types::GLubyte",
+ "GLuint" => "types::GLuint",
+ "GLuint64" => "types::GLuint64",
+ "GLuint64EXT" => "types::GLuint64EXT",
+ "GLushort" => "types::GLushort",
+ "GLvdpauSurfaceNV" => "types::GLvdpauSurfaceNV",
+ "void " => "()",
+ "GLboolean *" => "*mut types::GLboolean",
+ "GLchar *" => "*mut types::GLchar",
+ "GLcharARB *" => "*mut types::GLcharARB",
+ "GLdouble *" => "*mut types::GLdouble",
+ "GLenum *" => "*mut types::GLenum",
+ "GLfixed *" => "*mut types::GLfixed",
+ "GLfloat *" => "*mut types::GLfloat",
+ "GLhandleARB *" => "*mut types::GLhandleARB",
+ "GLint *" => "*mut types::GLint",
+ "GLint64 *" => "*mut types::GLint64",
+ "GLint64EXT *" => "*mut types::GLint64EXT",
+ "GLsizei *" => "*mut types::GLsizei",
+ "GLubyte *" => "*mut types::GLubyte",
+ "GLuint *" => "*mut types::GLuint",
+ "GLuint [2]" => "*mut [types::GLuint; 2]",
+ "GLuint64 *" => "*mut types::GLuint64",
+ "GLuint64EXT *" => "*mut types::GLuint64EXT",
+ "GLushort *" => "*mut types::GLushort",
+ "GLvoid *" => "*mut types::GLvoid",
+ "GLvoid **" => "*const *mut types::GLvoid",
+ "void *" => "*mut __gl_imports::raw::c_void",
+ "void **" => "*const *mut __gl_imports::raw::c_void",
+ "const GLboolean *" => "*const types::GLboolean",
+ "const GLbyte *" => "*const types::GLbyte",
+ "const GLchar *" => "*const types::GLchar",
+ "const GLcharARB *" => "*const types::GLcharARB",
+ "const GLclampf *" => "*const types::GLclampf",
+ "const GLdouble *" => "*const types::GLdouble",
+ "const GLenum *" => "*const types::GLenum",
+ "const GLfixed *" => "*const types::GLfixed",
+ "const GLfloat" => "types::GLfloat",
+ "const GLfloat *" => "*const types::GLfloat",
+ "const GLhalfNV *" => "*const types::GLhalfNV",
+ "const GLint *" => "*const types::GLint",
+ "const GLint64 *" => "*const types::GLint64",
+ "const GLint64EXT *" => "*const types::GLint64EXT",
+ "const GLintptr *" => "*const types::GLintptr",
+ "const GLshort *" => "*const types::GLshort",
+ "const GLsizei *" => "*const types::GLsizei",
+ "const GLsizeiptr *" => "*const types::GLsizeiptr",
+ "const GLubyte *" => "*const types::GLubyte",
+ "const GLuint *" => "*const types::GLuint",
+ "const GLuint64 *" => "*const types::GLuint64",
+ "const GLuint64EXT *" => "*const types::GLuint64EXT",
+ "const GLushort *" => "*const types::GLushort",
+ "const GLvdpauSurfaceNV *" => "*const types::GLvdpauSurfaceNV",
+ "const GLvoid *" => "*const types::GLvoid",
+ "const void *" => "*const __gl_imports::raw::c_void",
+ "const void **" => "*const *const __gl_imports::raw::c_void",
+ "const void *const*" => "*const *const __gl_imports::raw::c_void",
+ "const GLboolean **" => "*const *const types::GLboolean",
+ "const GLchar **" => "*const *const types::GLchar",
+ "const GLcharARB **" => "*const *const types::GLcharARB",
+ "const GLvoid **" => "*const *const types::GLvoid",
+ "const GLchar *const*" => "*const *const types::GLchar",
+ "const GLvoid *const*" => "*const *const types::GLvoid",
+ "struct _cl_context *" => "*const types::_cl_context",
+ "struct _cl_event *" => "*const types::_cl_event",
+ "GLuint[2]" => "[Gluint; 2]",
// glx.xml types
- "Bool" => "types::Bool",
- "Colormap" => "types::Colormap",
- "DMbuffer" => "types::DMbuffer",
- "Font" => "types::Font",
- "GLXContext" => "types::GLXContext",
- "GLXContextID" => "types::GLXContextID",
- "GLXDrawable" => "types::GLXDrawable",
- "GLXFBConfig" => "types::GLXFBConfig",
- "GLXFBConfigSGIX" => "types::GLXFBConfigSGIX",
- "GLXPbuffer" => "types::GLXPbuffer",
- "GLXPbufferSGIX" => "types::GLXPbufferSGIX",
- "GLXPixmap" => "types::GLXPixmap",
- "GLXVideoCaptureDeviceNV" => "types::GLXVideoCaptureDeviceNV",
- "GLXVideoDeviceNV" => "types::GLXVideoDeviceNV",
- "GLXVideoSourceSGIX" => "types::GLXVideoSourceSGIX",
- "GLXWindow" => "types::GLXWindow",
+ "Bool" => "types::Bool",
+ "Colormap" => "types::Colormap",
+ "DMbuffer" => "types::DMbuffer",
+ "Font" => "types::Font",
+ "GLXContext" => "types::GLXContext",
+ "GLXContextID" => "types::GLXContextID",
+ "GLXDrawable" => "types::GLXDrawable",
+ "GLXFBConfig" => "types::GLXFBConfig",
+ "GLXFBConfigSGIX" => "types::GLXFBConfigSGIX",
+ "GLXPbuffer" => "types::GLXPbuffer",
+ "GLXPbufferSGIX" => "types::GLXPbufferSGIX",
+ "GLXPixmap" => "types::GLXPixmap",
+ "GLXVideoCaptureDeviceNV" => "types::GLXVideoCaptureDeviceNV",
+ "GLXVideoDeviceNV" => "types::GLXVideoDeviceNV",
+ "GLXVideoSourceSGIX" => "types::GLXVideoSourceSGIX",
+ "GLXWindow" => "types::GLXWindow",
// "GLboolean" => "types::GLboolean",
// "GLenum" => "types::GLenum",
// "GLint" => "types::GLint",
// "GLsizei" => "types::GLsizei",
// "GLuint" => "types::GLuint",
- "Pixmap" => "types::Pixmap",
- "Status" => "types::Status",
- "VLNode" => "types::VLNode",
- "VLPath" => "types::VLPath",
- "VLServer" => "types::VLServer",
- "Window" => "types::Window",
- "__GLXextFuncPtr" => "types::__GLXextFuncPtr",
- "const GLXContext" => "const types::GLXContext",
- "float " => "__gl_imports::raw::c_float",
- "int " => "__gl_imports::raw::c_int",
- "int64_t" => "i64",
- "unsigned int " => "__gl_imports::raw::c_uint",
- "unsigned long " => "__gl_imports::raw::c_ulong",
+ "Pixmap" => "types::Pixmap",
+ "Status" => "types::Status",
+ "VLNode" => "types::VLNode",
+ "VLPath" => "types::VLPath",
+ "VLServer" => "types::VLServer",
+ "Window" => "types::Window",
+ "__GLXextFuncPtr" => "types::__GLXextFuncPtr",
+ "const GLXContext" => "const types::GLXContext",
+ "float " => "__gl_imports::raw::c_float",
+ "int " => "__gl_imports::raw::c_int",
+ "int64_t" => "i64",
+ "unsigned int " => "__gl_imports::raw::c_uint",
+ "unsigned long " => "__gl_imports::raw::c_ulong",
// "void " => "()",
- "DMparams *" => "*mut types::DMparams",
- "Display *" => "*mut types::Display",
- "GLXFBConfig *" => "*mut types::GLXFBConfig",
- "GLXFBConfigSGIX *" => "*mut types::GLXFBConfigSGIX",
- "GLXHyperpipeConfigSGIX *" => "*mut types::GLXHyperpipeConfigSGIX",
+ "DMparams *" => "*mut types::DMparams",
+ "Display *" => "*mut types::Display",
+ "GLXFBConfig *" => "*mut types::GLXFBConfig",
+ "GLXFBConfigSGIX *" => "*mut types::GLXFBConfigSGIX",
+ "GLXHyperpipeConfigSGIX *" => "*mut types::GLXHyperpipeConfigSGIX",
"GLXHyperpipeNetworkSGIX *" => "*mut types::GLXHyperpipeNetworkSGIX",
"GLXVideoCaptureDeviceNV *" => "*mut types::GLXVideoCaptureDeviceNV",
- "GLXVideoDeviceNV *" => "*mut types::GLXVideoDeviceNV",
+ "GLXVideoDeviceNV *" => "*mut types::GLXVideoDeviceNV",
// "GLuint *" => "*mut types::GLuint",
- "XVisualInfo *" => "*mut types::XVisualInfo",
+ "XVisualInfo *" => "*mut types::XVisualInfo",
// "const GLubyte *" => "*GLubyte",
- "const char *" => "*const __gl_imports::raw::c_char",
- "const int *" => "*const __gl_imports::raw::c_int",
+ "const char *" => "*const __gl_imports::raw::c_char",
+ "const int *" => "*const __gl_imports::raw::c_int",
// "const void *" => "*const __gl_imports::raw::c_void",
- "int *" => "*mut __gl_imports::raw::c_int",
- "int32_t *" => "*mut i32",
- "int64_t *" => "*mut i64",
- "long *" => "*mut __gl_imports::raw::c_long",
- "unsigned int *" => "*mut __gl_imports::raw::c_uint",
- "unsigned long *" => "*mut __gl_imports::raw::c_ulong",
+ "int *" => "*mut __gl_imports::raw::c_int",
+ "int32_t *" => "*mut i32",
+ "int64_t *" => "*mut i64",
+ "long *" => "*mut __gl_imports::raw::c_long",
+ "unsigned int *" => "*mut __gl_imports::raw::c_uint",
+ "unsigned long *" => "*mut __gl_imports::raw::c_ulong",
// "void *" => "*mut __gl_imports::raw::c_void",
// wgl.xml types
- "BOOL" => "types::BOOL",
- "DWORD" => "types::DWORD",
- "FLOAT" => "types::FLOAT",
+ "BOOL" => "types::BOOL",
+ "DWORD" => "types::DWORD",
+ "FLOAT" => "types::FLOAT",
// "GLbitfield" => "types::GLbitfield",
// "GLboolean" => "types::GLboolean",
// "GLenum" => "types::GLenum",
// "GLfloat" => "types::GLfloat",
// "GLint" => "types::GLint",
// "GLsizei" => "types::GLsizei",
// "GLuint" => "types::GLuint",
// "GLushort" => "types::GLushort",
- "HANDLE" => "types::HANDLE",
- "HDC" => "types::HDC",
- "HENHMETAFILE" => "types::HENHMETAFILE",
- "HGLRC" => "types::HGLRC",
- "HGPUNV" => "types::HGPUNV",
- "HPBUFFERARB" => "types::HPBUFFERARB",
- "HPBUFFEREXT" => "types::HPBUFFEREXT",
- "HPVIDEODEV" => "types::HPVIDEODEV",
- "HVIDEOINPUTDEVICENV" => "types::HVIDEOINPUTDEVICENV",
- "HVIDEOOUTPUTDEVICENV" => "types::HVIDEOOUTPUTDEVICENV",
- "INT" => "types::INT",
- "INT64" => "types::INT64",
- "LPCSTR" => "types::LPCSTR",
- "LPGLYPHMETRICSFLOAT" => "types::LPGLYPHMETRICSFLOAT",
- "LPVOID" => "types::LPVOID",
- "PGPU_DEVICE" => "types::PGPU_DEVICE",
- "PROC" => "types::PROC",
- "UINT" => "types::UINT",
- "VOID" => "types::VOID",
+ "HANDLE" => "types::HANDLE",
+ "HDC" => "types::HDC",
+ "HENHMETAFILE" => "types::HENHMETAFILE",
+ "HGLRC" => "types::HGLRC",
+ "HGPUNV" => "types::HGPUNV",
+ "HPBUFFERARB" => "types::HPBUFFERARB",
+ "HPBUFFEREXT" => "types::HPBUFFEREXT",
+ "HPVIDEODEV" => "types::HPVIDEODEV",
+ "HVIDEOINPUTDEVICENV" => "types::HVIDEOINPUTDEVICENV",
+ "HVIDEOOUTPUTDEVICENV" => "types::HVIDEOOUTPUTDEVICENV",
+ "INT" => "types::INT",
+ "INT64" => "types::INT64",
+ "LPCSTR" => "types::LPCSTR",
+ "LPGLYPHMETRICSFLOAT" => "types::LPGLYPHMETRICSFLOAT",
+ "LPVOID" => "types::LPVOID",
+ "PGPU_DEVICE" => "types::PGPU_DEVICE",
+ "PROC" => "types::PROC",
+ "UINT" => "types::UINT",
+ "VOID" => "types::VOID",
// "int " => "__gl_imports::raw::c_int",
// "unsigned int " => "__gl_imports::raw::c_uint",
// "void " => "()",
- "BOOL *" => "*mut types::BOOL",
- "DWORD *" => "*mut types::DWORD",
- "FLOAT *" => "*mut types::FLOAT",
+ "BOOL *" => "*mut types::BOOL",
+ "DWORD *" => "*mut types::DWORD",
+ "FLOAT *" => "*mut types::FLOAT",
// "GLuint *" => "*mut types::GLuint",
- "HANDLE *" => "*mut types::HANDLE",
- "HGPUNV *" => "*mut types::HGPUNV",
- "HPVIDEODEV *" => "*mut types::HPVIDEODEV",
- "HVIDEOINPUTDEVICENV *" => "*mut types::HVIDEOINPUTDEVICENV",
- "HVIDEOOUTPUTDEVICENV *" => "*mut types::HVIDEOOUTPUTDEVICENV",
- "INT32 *" => "*mut types::INT32",
- "INT64 *" => "*mut types::INT64",
- "UINT *" => "*mut types::UINT",
- "USHORT *" => "*mut types::USHORT",
- "const COLORREF *" => "*const types::COLORREF",
- "const DWORD *" => "*const types::DWORD",
- "const FLOAT *" => "*const types::FLOAT",
+ "HANDLE *" => "*mut types::HANDLE",
+ "HGPUNV *" => "*mut types::HGPUNV",
+ "HPVIDEODEV *" => "*mut types::HPVIDEODEV",
+ "HVIDEOINPUTDEVICENV *" => "*mut types::HVIDEOINPUTDEVICENV",
+ "HVIDEOOUTPUTDEVICENV *" => "*mut types::HVIDEOOUTPUTDEVICENV",
+ "INT32 *" => "*mut types::INT32",
+ "INT64 *" => "*mut types::INT64",
+ "UINT *" => "*mut types::UINT",
+ "USHORT *" => "*mut types::USHORT",
+ "const COLORREF *" => "*const types::COLORREF",
+ "const DWORD *" => "*const types::DWORD",
+ "const FLOAT *" => "*const types::FLOAT",
// "const GLushort *" => "*const types::GLushort",
- "const HANDLE *" => "*const types::HANDLE",
- "const HGPUNV *" => "*const types::HGPUNV",
- "const LAYERPLANEDESCRIPTOR *" => "*const types::LAYERPLANEDESCRIPTOR",
- "const LPVOID *" => "*const types::LPVOID",
+ "const HANDLE *" => "*const types::HANDLE",
+ "const HGPUNV *" => "*const types::HGPUNV",
+ "const LAYERPLANEDESCRIPTOR *" => "*const types::LAYERPLANEDESCRIPTOR",
+ "const LPVOID *" => "*const types::LPVOID",
"const PIXELFORMATDESCRIPTOR *" => "*const types::IXELFORMATDESCRIPTOR",
- "const USHORT *" => "*const types::USHORT",
+ "const USHORT *" => "*const types::USHORT",
// "const char *" => "*const __gl_imports::raw::c_char",
// "const int *" => "*const __gl_imports::raw::c_int",
- "float *" => "*mut __gl_imports::raw::c_float",
+ "float *" => "*mut __gl_imports::raw::c_float",
// "int *" => "*mut __gl_imports::raw::c_int",
// "unsigned long *" => "*mut __gl_imports::raw::c_ulong",
// "void *" => "*mut __gl_imports::raw::c_void",
// elx.xml types
- "khronos_utime_nanoseconds_t" => "types::khronos_utime_nanoseconds_t",
- "khronos_uint64_t" => "types::khronos_uint64_t",
- "khronos_ssize_t" => "types::khronos_ssize_t",
- "EGLNativeDisplayType" => "types::EGLNativeDisplayType",
- "EGLNativePixmapType" => "types::EGLNativePixmapType",
- "EGLNativeWindowType" => "types::EGLNativeWindowType",
- "EGLint" => "types::EGLint",
- "EGLint *" => "*mut types::EGLint",
- "const EGLint *" => "*const types::EGLint",
- "NativeDisplayType" => "types::NativeDisplayType",
- "NativePixmapType" => "types::NativePixmapType",
- "NativeWindowType" => "types::NativeWindowType",
+ "khronos_utime_nanoseconds_t" => "types::khronos_utime_nanoseconds_t",
+ "khronos_uint64_t" => "types::khronos_uint64_t",
+ "khronos_ssize_t" => "types::khronos_ssize_t",
+ "EGLNativeDisplayType" => "types::EGLNativeDisplayType",
+ "EGLNativePixmapType" => "types::EGLNativePixmapType",
+ "EGLNativeWindowType" => "types::EGLNativeWindowType",
+ "EGLint" => "types::EGLint",
+ "EGLint *" => "*mut types::EGLint",
+ "const EGLint *" => "*const types::EGLint",
+ "NativeDisplayType" => "types::NativeDisplayType",
+ "NativePixmapType" => "types::NativePixmapType",
+ "NativeWindowType" => "types::NativeWindowType",
//"Bool" => "types::Bool",
- "EGLBoolean" => "types::EGLBoolean",
- "EGLenum" => "types::EGLenum",
- "EGLAttribKHR" => "types::EGLAttribKHR",
- "EGLAttrib" => "types::EGLAttrib",
- "EGLAttrib *" => "*mut types::EGLAttrib",
- "const EGLAttrib *" => "*const types::EGLAttrib",
- "EGLConfig" => "types::EGLConfig",
- "EGLConfig *" => "*mut types::EGLConfig",
- "EGLContext" => "types::EGLContext",
- "EGLDeviceEXT" => "types::EGLDeviceEXT",
- "EGLDisplay" => "types::EGLDisplay",
- "EGLSurface" => "types::EGLSurface",
- "EGLClientBuffer" => "types::EGLClientBuffer",
+ "EGLBoolean" => "types::EGLBoolean",
+ "EGLenum" => "types::EGLenum",
+ "EGLAttribKHR" => "types::EGLAttribKHR",
+ "EGLAttrib" => "types::EGLAttrib",
+ "EGLAttrib *" => "*mut types::EGLAttrib",
+ "const EGLAttrib *" => "*const types::EGLAttrib",
+ "EGLConfig" => "types::EGLConfig",
+ "EGLConfig *" => "*mut types::EGLConfig",
+ "EGLContext" => "types::EGLContext",
+ "EGLDeviceEXT" => "types::EGLDeviceEXT",
+ "EGLDisplay" => "types::EGLDisplay",
+ "EGLSurface" => "types::EGLSurface",
+ "EGLClientBuffer" => "types::EGLClientBuffer",
"__eglMustCastToProperFunctionPointerType" => "types::__eglMustCastToProperFunctionPointerType",
- "EGLImageKHR" => "types::EGLImageKHR",
- "EGLImage" => "types::EGLImage",
- "EGLOutputLayerEXT" => "types::EGLOutputLayerEXT",
- "EGLOutputPortEXT" => "types::EGLOutputPortEXT",
- "EGLSyncKHR" => "types::EGLSyncKHR",
- "EGLSync" => "types::EGLSync",
- "EGLTimeKHR" => "types::EGLTimeKHR",
- "EGLTime" => "types::EGLTime",
- "EGLSyncNV" => "types::EGLSyncNV",
- "EGLTimeNV" => "types::EGLTimeNV",
- "EGLuint64NV" => "types::EGLuint64NV",
- "EGLStreamKHR" => "types::EGLStreamKHR",
- "EGLuint64KHR" => "types::EGLuint64KHR",
+ "EGLImageKHR" => "types::EGLImageKHR",
+ "EGLImage" => "types::EGLImage",
+ "EGLOutputLayerEXT" => "types::EGLOutputLayerEXT",
+ "EGLOutputPortEXT" => "types::EGLOutputPortEXT",
+ "EGLSyncKHR" => "types::EGLSyncKHR",
+ "EGLSync" => "types::EGLSync",
+ "EGLTimeKHR" => "types::EGLTimeKHR",
+ "EGLTime" => "types::EGLTime",
+ "EGLSyncNV" => "types::EGLSyncNV",
+ "EGLTimeNV" => "types::EGLTimeNV",
+ "EGLuint64NV" => "types::EGLuint64NV",
+ "EGLStreamKHR" => "types::EGLStreamKHR",
+ "EGLuint64KHR" => "types::EGLuint64KHR",
"EGLNativeFileDescriptorKHR" => "types::EGLNativeFileDescriptorKHR",
- "EGLsizeiANDROID" => "types::EGLsizeiANDROID",
- "EGLSetBlobFuncANDROID" => "types::EGLSetBlobFuncANDROID",
- "EGLGetBlobFuncANDROID" => "types::EGLGetBlobFuncANDROID",
- "EGLClientPixmapHI" => "types::EGLClientPixmapHI",
+ "EGLsizeiANDROID" => "types::EGLsizeiANDROID",
+ "EGLSetBlobFuncANDROID" => "types::EGLSetBlobFuncANDROID",
+ "EGLGetBlobFuncANDROID" => "types::EGLGetBlobFuncANDROID",
+ "EGLClientPixmapHI" => "types::EGLClientPixmapHI",
"struct EGLClientPixmapHI *" => "*const types::EGLClientPixmapHI",
- "const EGLAttribKHR *" => "*const types::EGLAttribKHR",
- "const EGLuint64KHR *" => "*const types::EGLuint64KHR",
- "EGLAttribKHR *" => "*mut types::EGLAttribKHR",
- "EGLDeviceEXT *" => "*mut types::EGLDeviceEXT",
- "EGLNativeDisplayType *" => "*mut types::EGLNativeDisplayType",
- "EGLNativePixmapType *" => "*mut types::EGLNativePixmapType",
- "EGLNativeWindowType *" => "*mut types::EGLNativeWindowType",
- "EGLOutputLayerEXT *" => "*mut types::EGLOutputLayerEXT",
- "EGLTimeKHR *" => "*mut types::EGLTimeKHR",
- "EGLOutputPortEXT *" => "*mut types::EGLOutputPortEXT",
- "EGLuint64KHR *" => "*mut types::EGLuint64KHR",
+ "const EGLAttribKHR *" => "*const types::EGLAttribKHR",
+ "const EGLuint64KHR *" => "*const types::EGLuint64KHR",
+ "EGLAttribKHR *" => "*mut types::EGLAttribKHR",
+ "EGLDeviceEXT *" => "*mut types::EGLDeviceEXT",
+ "EGLNativeDisplayType *" => "*mut types::EGLNativeDisplayType",
+ "EGLNativePixmapType *" => "*mut types::EGLNativePixmapType",
+ "EGLNativeWindowType *" => "*mut types::EGLNativeWindowType",
+ "EGLOutputLayerEXT *" => "*mut types::EGLOutputLayerEXT",
+ "EGLTimeKHR *" => "*mut types::EGLTimeKHR",
+ "EGLOutputPortEXT *" => "*mut types::EGLOutputPortEXT",
+ "EGLuint64KHR *" => "*mut types::EGLuint64KHR",
// failure
_ => panic!("Type conversion not implemented for `{}`", ty.as_ref()),
};
Cow::Borrowed(ty)
}
@@ -995,56 +1017,74 @@ mod tests {
assert_eq!(parse::underscore_keyword("bar".to_string()), "bar");
}
}
mod make_enum {
use registry::parse;
#[test]
fn test_cast_0() {
- let e = parse::make_enum("FOO".to_string(), None, "((EGLint)-1)".to_string(), Some("BAR".to_string()));
+ let e = parse::make_enum("FOO".to_string(),
+ None,
+ "((EGLint)-1)".to_string(),
+ Some("BAR".to_string()));
assert_eq!(e.ident, "FOO");
assert_eq!((&*e.ty, &*e.value), ("EGLint", "-1"));
assert_eq!(e.alias, Some("BAR".to_string()));
}
#[test]
fn test_cast_1() {
- let e = parse::make_enum("FOO".to_string(), None, "((EGLint)(-1))".to_string(), Some("BAR".to_string()));
+ let e = parse::make_enum("FOO".to_string(),
+ None,
+ "((EGLint)(-1))".to_string(),
+ Some("BAR".to_string()));
assert_eq!(e.ident, "FOO");
assert_eq!((&*e.ty, &*e.value), ("EGLint", "(-1)"));
assert_eq!(e.alias, Some("BAR".to_string()));
}
#[test]
fn test_no_type() {
- let e = parse::make_enum("FOO".to_string(), None, "value".to_string(), Some("BAR".to_string()));
+ let e = parse::make_enum("FOO".to_string(),
+ None,
+ "value".to_string(),
+ Some("BAR".to_string()));
assert_eq!(e.ident, "FOO");
assert_eq!(e.value, "value");
assert_eq!(e.alias, Some("BAR".to_string()));
assert_eq!(e.ty, "GLenum");
assert_eq!(e.cast, false);
}
#[test]
fn test_u() {
- let e = parse::make_enum("FOO".to_string(), Some("u".to_string()), String::new(), None);
+ let e = parse::make_enum("FOO".to_string(),
+ Some("u".to_string()),
+ String::new(),
+ None);
assert_eq!(e.ty, "GLuint");
}
#[test]
fn test_ull() {
- let e = parse::make_enum("FOO".to_string(), Some("ull".to_string()), String::new(), None);
+ let e = parse::make_enum("FOO".to_string(),
+ Some("ull".to_string()),
+ String::new(),
+ None);
assert_eq!(e.ty, "GLuint64");
}
#[test]
#[should_panic]
fn test_unknown_type() {
- parse::make_enum("FOO".to_string(), Some("blargh".to_string()), String::new(), None);
+ parse::make_enum("FOO".to_string(),
+ Some("blargh".to_string()),
+ String::new(),
+ None);
}
#[test]
fn test_value_str() {
let e = parse::make_enum("FOO".to_string(), None, "\"hi\"".to_string(), None);
assert_eq!(e.ty, "&'static str");
}
@@ -1070,37 +1110,29 @@ mod tests {
use xml::reader::XmlEvent;
use registry::parse::{Attribute, ParseEvent};
#[test]
fn test_start_event() {
let given = XmlEvent::StartElement {
name: OwnedName::local("element"),
- attributes: vec![
- OwnedAttribute::new(OwnedName::local("attr1"), "val1"),
- OwnedAttribute::new(OwnedName::local("attr2"), "val2"),
- ],
+ attributes: vec![OwnedAttribute::new(OwnedName::local("attr1"), "val1"),
+ OwnedAttribute::new(OwnedName::local("attr2"), "val2")],
namespace: Namespace::empty(),
};
- let expected = ParseEvent::Start(
- "element".to_string(),
- vec![
- Attribute::new("attr1", "val1"),
- Attribute::new("attr2", "val2"),
- ],
- );
+ let expected = ParseEvent::Start("element".to_string(),
+ vec![Attribute::new("attr1", "val1"),
+ Attribute::new("attr2", "val2")]);
assert_eq!(ParseEvent::from_xml(given), Some(expected));
}
#[test]
fn test_end_element() {
- let given = XmlEvent::EndElement {
- name: OwnedName::local("element"),
- };
+ let given = XmlEvent::EndElement { name: OwnedName::local("element") };
let expected = ParseEvent::End("element".to_string());
assert_eq!(ParseEvent::from_xml(given), Some(expected));
}
#[test]
fn test_characters() {
let given = XmlEvent::Characters("text".to_string());
let expected = ParseEvent::Text("text".to_string());
--- a/third_party/rust/khronos_api/.cargo-checksum.json
+++ b/third_party/rust/khronos_api/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"201ece82276abe0662d235dcfe1736ca1306da4e54dba43b07301939c21a03c9","README.md":"4584b28d97d885822adc66e1eae8a329bd5e3b13a5dd887006c08bc5adc0a917","api/GL/glcorearb.h":"d411f59f28484725f6a2927d8f283ef10bf8e14d3b685e76de30c3871ca176e6","api/GL/glext.h":"fd30a350477613fb9a0b3cdaa5b22b18fed56cdbd369c587058c71ea83c8935b","api/GL/glxext.h":"0024c262e896dd3bfcd8c458e809bd2910d8eeae1316998a0654cdb75e5f2019","api/GL/wglext.h":"2fdace6ceefaf6bee7a5d821bcd599774689da354c7670839df4f4a836fd8386","api/Makefile":"fa42b2bf27a450c5be83f3178ca08f9bd24f611786dd503033b84c98ae67d37f","api/README.txt":"8c0b31285b1ce7d661ebdbf2f884264c9a588f7721221a2ad5fba7cafdf5b76f","api/egl.xml":"2590ce135d8b5364f11ae4ca04a0abe1fa781cde99a2b4ade8a2f0fdac09d5e4","api/genheaders.py":"3ddf420a48450c0d74b5c95d956ac09f4aceff2e225b148f0d1415a14f182a11","api/gl.xml":"5cf25ca370fd8c13407192533d5aa6febc4c16b7038882ae75d106f555e8f0e1","api/glx.xml":"9653c70d281fbac1c28292ef6532f41a9aee3c6998260d186b860f7cc2cc7ecd","api/readme.pdf":"26b9a42b4bc0803ee4854d5aa908b76bf08cafb478fd2e772a3b6cf6820daa2f","api/readme.tex":"542e27bcbd975f5c24e19fc2b89d62e8a4af8657f5f0ecebfac1c2640e23a5b6","api/reg.py":"469c294591df494d727bf13333b7080f04ba7c4938baeff14a5ead95b0cbd7c8","api/registry.rnc":"e76be90498a47ab63f9f0eb10b6a63d795a9e4b5a0bde2c89f1709ed8ebf937e","api/wgl.xml":"38b53bc1bc2c16dce1cc627feebcda4fb666c2d23ab0baf09bdecf6cb85bb005","src/lib.rs":"59d07cea8beca750b13ac49d4b1e37e23e753640517ee644bcddf50d431166eb"},"package":"09c9d3760673c427d46f91a0350f0a84a52e6bc5a84adf26dc610b6c52436630"}
\ No newline at end of file
+{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"d5b14cfc2a6504e54c9ceca859378c92d1a4a4cb59d67d3af944d91c2f6bef12","Cargo.toml.orig":"ece4f30db56195f5010330b514af06207e5d32a9d8a909e77baa5f2842133cb5","README.md":"dff09e27dcecc37f1e477d62ea89aa49b4dc743514ea6990c7c83b8b0fc602e4","api/.htaccess":"e600e7ce93361e8de3e32f588f9cc8f472243af676d078a7393acaf142245918","api/GL/glcorearb.h":"d411f59f28484725f6a2927d8f283ef10bf8e14d3b685e76de30c3871ca176e6","api/GL/glext.h":"fd30a350477613fb9a0b3cdaa5b22b18fed56cdbd369c587058c71ea83c8935b","api/GL/glxext.h":"0024c262e896dd3bfcd8c458e809bd2910d8eeae1316998a0654cdb75e5f2019","api/GL/wglext.h":"2fdace6ceefaf6bee7a5d821bcd599774689da354c7670839df4f4a836fd8386","api/Makefile":"fa42b2bf27a450c5be83f3178ca08f9bd24f611786dd503033b84c98ae67d37f","api/README.txt":"8c0b31285b1ce7d661ebdbf2f884264c9a588f7721221a2ad5fba7cafdf5b76f","api/egl.xml":"2590ce135d8b5364f11ae4ca04a0abe1fa781cde99a2b4ade8a2f0fdac09d5e4","api/genheaders.py":"3ddf420a48450c0d74b5c95d956ac09f4aceff2e225b148f0d1415a14f182a11","api/gl.xml":"5cf25ca370fd8c13407192533d5aa6febc4c16b7038882ae75d106f555e8f0e1","api/glx.xml":"9653c70d281fbac1c28292ef6532f41a9aee3c6998260d186b860f7cc2cc7ecd","api/readme.pdf":"26b9a42b4bc0803ee4854d5aa908b76bf08cafb478fd2e772a3b6cf6820daa2f","api/readme.tex":"542e27bcbd975f5c24e19fc2b89d62e8a4af8657f5f0ecebfac1c2640e23a5b6","api/reg.py":"469c294591df494d727bf13333b7080f04ba7c4938baeff14a5ead95b0cbd7c8","api/registry.rnc":"e76be90498a47ab63f9f0eb10b6a63d795a9e4b5a0bde2c89f1709ed8ebf937e","api/wgl.xml":"38b53bc1bc2c16dce1cc627feebcda4fb666c2d23ab0baf09bdecf6cb85bb005","src/lib.rs":"6773dcdb7458a9bebcbefcd28add5f6aa4720bf69c10f348f94615e127f51a2d"},"package":"d5a08e2a31d665af8f1ca437eab6d00a93c9d62a549f73f9ed8fc2e55b5a91a7"}
\ No newline at end of file
--- a/third_party/rust/khronos_api/Cargo.toml
+++ b/third_party/rust/khronos_api/Cargo.toml
@@ -1,18 +1,23 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g. crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
[package]
-
name = "khronos_api"
-version = "1.0.0"
-authors = [
- "Brendan Zabarauskas <bjzaba@yahoo.com.au>",
- "Corey Richardson",
- "Arseny Kapoulkine",
- "Pierre Krieger <pierre.krieger1708@gmail.com>"
-]
+version = "1.0.1"
+authors = ["Brendan Zabarauskas <bjzaba@yahoo.com.au>", "Corey Richardson", "Arseny Kapoulkine", "Pierre Krieger <pierre.krieger1708@gmail.com>"]
description = "The Khronos XML API Registry, exposed as byte string constants."
+homepage = "https://github.com/brendanzab/gl-rs/khronos_api/"
+documentation = "https://docs.rs/khronos_api"
+readme = "README.md"
+keywords = ["opengl", "khronos"]
license = "Apache-2.0"
-
-homepage = "https://github.com/bjz/gl-rs/khronos_api/"
-repository = "https://github.com/bjz/gl-rs/"
-readme = "README.md"
-
-keywords = ["opengl", "khronos"]
+repository = "https://github.com/brendanzab/gl-rs/"
new file mode 100644
--- /dev/null
+++ b/third_party/rust/khronos_api/Cargo.toml.orig
@@ -0,0 +1,17 @@
+[package]
+name = "khronos_api"
+version = "1.0.1"
+authors = [
+ "Brendan Zabarauskas <bjzaba@yahoo.com.au>",
+ "Corey Richardson",
+ "Arseny Kapoulkine",
+ "Pierre Krieger <pierre.krieger1708@gmail.com>"
+]
+description = "The Khronos XML API Registry, exposed as byte string constants."
+license = "Apache-2.0"
+documentation = "https://docs.rs/khronos_api"
+homepage = "https://github.com/brendanzab/gl-rs/khronos_api/"
+repository = "https://github.com/brendanzab/gl-rs/"
+readme = "README.md"
+
+keywords = ["opengl", "khronos"]
--- a/third_party/rust/khronos_api/README.md
+++ b/third_party/rust/khronos_api/README.md
@@ -1,14 +1,26 @@
# khronos_api
[![Version](https://img.shields.io/crates/v/khronos_api.svg)](https://crates.io/crates/khronos_api)
-[![License](https://img.shields.io/crates/l/khronos_api.svg)](https://github.com/bjz/gl-rs/blob/master/LICENSE)
+[![License](https://img.shields.io/crates/l/khronos_api.svg)](https://github.com/brendanzab/gl-rs/blob/master/LICENSE)
[![Downloads](https://img.shields.io/crates/d/khronos_api.svg)](https://crates.io/crates/khronos_api)
The Khronos XML API Registry, exposed as byte string constants.
+```toml
+[build-dependencies]
+khronos_api = "1.0.0"
+```
+
The following constants are provided:
- `GL_XML`: the contents of [`gl.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/gl.xml)
- `EGL_XML`: the contents of [`egl.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/egl.xml)
- `WGL_XML`: the contents of [`wgl.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/wgl.xml)
- `GLX_XML`: the contents of [`glx.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/glx.xml)
+
+## Changelog
+
+### v1.0.0
+
+- Initial release
+- Documentation improvements
new file mode 100644
--- /dev/null
+++ b/third_party/rust/khronos_api/api/.htaccess
@@ -0,0 +1,23 @@
+# Redirect old .spec file URLs to the cached locations
+
+redirect 301 /registry/api/enum.spec http://www.opengl.org/registry/oldspecs/enum.spec
+redirect 301 /registry/api/enumext.spec http://www.opengl.org/registry/oldspecs//enumext.spec
+redirect 301 /registry/api/gl.spec http://www.opengl.org/registry/oldspecs//gl.spec
+redirect 301 /registry/api/gl.tm http://www.opengl.org/registry/oldspecs//gl.tm
+redirect 301 /registry/api/gl3.h http://www.opengl.org/registry/oldspecs//gl3.h
+redirect 301 /registry/api/glcorearb.h http://www.opengl.org/registry/oldspecs//glcorearb.h
+redirect 301 /registry/api/glcorearbrelease.txt http://www.opengl.org/registry/oldspecs//glcorearbrelease.txt
+redirect 301 /registry/api/glext.h http://www.opengl.org/registry/oldspecs//glext.h
+redirect 301 /registry/api/glextrelease.txt http://www.opengl.org/registry/oldspecs//glextrelease.txt
+redirect 301 /registry/api/glx.spec http://www.opengl.org/registry/oldspecs//glx.spec
+redirect 301 /registry/api/glx.tm http://www.opengl.org/registry/oldspecs//glx.tm
+redirect 301 /registry/api/glxenum.spec http://www.opengl.org/registry/oldspecs//glxenum.spec
+redirect 301 /registry/api/glxenumext.spec http://www.opengl.org/registry/oldspecs//glxenumext.spec
+redirect 301 /registry/api/glxext.h http://www.opengl.org/registry/oldspecs//glxext.h
+redirect 301 /registry/api/glxext.spec http://www.opengl.org/registry/oldspecs//glxext.spec
+redirect 301 /registry/api/wgl.spec http://www.opengl.org/registry/oldspecs//wgl.spec
+redirect 301 /registry/api/wgl.tm http://www.opengl.org/registry/oldspecs//wgl.tm
+redirect 301 /registry/api/wglenum.spec http://www.opengl.org/registry/oldspecs//wglenum.spec
+redirect 301 /registry/api/wglenumext.spec http://www.opengl.org/registry/oldspecs//wglenumext.spec
+redirect 301 /registry/api/wglext.h http://www.opengl.org/registry/oldspecs//wglext.h
+redirect 301 /registry/api/wglext.spec http://www.opengl.org/registry/oldspecs//wglext.spec
--- a/third_party/rust/khronos_api/src/lib.rs
+++ b/third_party/rust/khronos_api/src/lib.rs
@@ -1,9 +1,9 @@
-// Copyright 2015 Brendan Zabarauskas
+// Copyright 2015 Brendan Zabarauskas and the gl-rs developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
--- a/toolkit/library/gtest/rust/Cargo.lock
+++ b/toolkit/library/gtest/rust/Cargo.lock
@@ -360,30 +360,30 @@ dependencies = [
"nserror 0.1.0",
"nsstring 0.1.0",
"rust_url_capi 0.0.1",
"webrender_bindings 0.1.0",
]
[[package]]
name = "gl_generator"
-version = "0.5.2"
+version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "khronos_api 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"xml-rs 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gleam"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gl_generator 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "glob"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -424,17 +424,17 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "khronos_api"
-version = "1.0.0"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "lazy_static"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -1209,25 +1209,25 @@ dependencies = [
"checksum dwrote 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "74114b6b49d6731835da7a28a3642651451e315f7f9b9d04e907e65a45681796"
"checksum env_logger 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ed39959122ea027670b704fb70539f4286ddf4a49eefede23bf0b4b2a069ec03"
"checksum euclid 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6083f113c422ff9cd855a1cf6cc8ec0903606c0eb43a0c6a0ced3bdc9731e4c1"
"checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344"
"checksum freetype 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fde23272c687e4570aefec06cb71174ec0f5284b725deac4e77ba2665d635faf"
"checksum futures 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "55f0008e13fc853f79ea8fc86e931486860d4c4c156cdffb59fa5f7fa833660a"
"checksum gamma-lut 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41f72af1e933f296b827361eb9e70d0267abf8ad0de9ec7fa667bbe67177b297"
"checksum gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518"
-"checksum gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1d8edc81c5ae84605a62f5dac661a2313003b26d59839f81d47d46cf0f16a55"
+"checksum gl_generator 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0940975a4ca12b088d32b5d5134826c47d2e73de4b0b459b05244c01503eccbb"
"checksum gleam 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86944a6a4d7f54507f8ee930192d971f18a7b1da526ff529b7a0d4043935380"
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
"checksum heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "5a376f7402b85be6e0ba504243ecbc0709c48019ecc6286d0540c2e359050c88"
"checksum heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4c7593b1522161003928c959c20a2ca421c68e940d63d75573316a009e48a6d4"
"checksum idna 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2233d4940b1f19f0418c158509cd7396b8d70a5db5705ce410914dc8fa603b37"
"checksum itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb2f404fbc66fd9aac13e998248505e7ecb2ad8e44ab6388684c5fb11c6c251c"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
-"checksum khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "09c9d3760673c427d46f91a0350f0a84a52e6bc5a84adf26dc610b6c52436630"
+"checksum khronos_api 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d5a08e2a31d665af8f1ca437eab6d00a93c9d62a549f73f9ed8fc2e55b5a91a7"
"checksum lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6abe0ee2e758cd6bc8a2cd56726359007748fbf4128da998b65d0b70f881e19b"
"checksum libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "684f330624d8c3784fb9558ca46c4ce488073a8d22450415c5eb4f4cfb0d11b5"
"checksum libloading 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "be99f814beb3e9503a786a592c909692bb6d4fc5a695f6ed7987223acfbd5194"
"checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054"
"checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1"
"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4"
"checksum nodrop 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "52cd74cd09beba596430cc6e3091b74007169a56246e1262f0ba451ea95117b2"
"checksum nom 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b8c256fd9471521bcb84c3cdba98921497f1a331cbc15b8030fc63b82050ce"
--- a/toolkit/library/rust/Cargo.lock
+++ b/toolkit/library/rust/Cargo.lock
@@ -358,30 +358,30 @@ dependencies = [
"nserror 0.1.0",
"nsstring 0.1.0",
"rust_url_capi 0.0.1",
"webrender_bindings 0.1.0",
]
[[package]]
name = "gl_generator"
-version = "0.5.2"
+version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "khronos_api 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"xml-rs 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gleam"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gl_generator 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "glob"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -422,17 +422,17 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "khronos_api"
-version = "1.0.0"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "lazy_static"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -1196,25 +1196,25 @@ dependencies = [
"checksum dwrote 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "74114b6b49d6731835da7a28a3642651451e315f7f9b9d04e907e65a45681796"
"checksum env_logger 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ed39959122ea027670b704fb70539f4286ddf4a49eefede23bf0b4b2a069ec03"
"checksum euclid 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6083f113c422ff9cd855a1cf6cc8ec0903606c0eb43a0c6a0ced3bdc9731e4c1"
"checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344"
"checksum freetype 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fde23272c687e4570aefec06cb71174ec0f5284b725deac4e77ba2665d635faf"
"checksum futures 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "55f0008e13fc853f79ea8fc86e931486860d4c4c156cdffb59fa5f7fa833660a"
"checksum gamma-lut 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41f72af1e933f296b827361eb9e70d0267abf8ad0de9ec7fa667bbe67177b297"
"checksum gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518"
-"checksum gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1d8edc81c5ae84605a62f5dac661a2313003b26d59839f81d47d46cf0f16a55"
+"checksum gl_generator 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0940975a4ca12b088d32b5d5134826c47d2e73de4b0b459b05244c01503eccbb"
"checksum gleam 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86944a6a4d7f54507f8ee930192d971f18a7b1da526ff529b7a0d4043935380"
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
"checksum heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "5a376f7402b85be6e0ba504243ecbc0709c48019ecc6286d0540c2e359050c88"
"checksum heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4c7593b1522161003928c959c20a2ca421c68e940d63d75573316a009e48a6d4"
"checksum idna 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2233d4940b1f19f0418c158509cd7396b8d70a5db5705ce410914dc8fa603b37"
"checksum itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb2f404fbc66fd9aac13e998248505e7ecb2ad8e44ab6388684c5fb11c6c251c"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
-"checksum khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "09c9d3760673c427d46f91a0350f0a84a52e6bc5a84adf26dc610b6c52436630"
+"checksum khronos_api 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d5a08e2a31d665af8f1ca437eab6d00a93c9d62a549f73f9ed8fc2e55b5a91a7"
"checksum lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6abe0ee2e758cd6bc8a2cd56726359007748fbf4128da998b65d0b70f881e19b"
"checksum libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "684f330624d8c3784fb9558ca46c4ce488073a8d22450415c5eb4f4cfb0d11b5"
"checksum libloading 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "be99f814beb3e9503a786a592c909692bb6d4fc5a695f6ed7987223acfbd5194"
"checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054"
"checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1"
"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4"
"checksum nodrop 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "52cd74cd09beba596430cc6e3091b74007169a56246e1262f0ba451ea95117b2"
"checksum nom 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b8c256fd9471521bcb84c3cdba98921497f1a331cbc15b8030fc63b82050ce"