diff --git a/gl/build.rs b/gl/build.rs index acf019d3..7ebfef80 100644 --- a/gl/build.rs +++ b/gl/build.rs @@ -14,7 +14,7 @@ extern crate gl_generator; -use gl_generator::{Fallbacks, GlobalGenerator, Api, Profile}; +use gl_generator::{Registry, Fallbacks, GlobalGenerator, Api, Profile}; use std::env; use std::fs::File; use std::path::Path; @@ -23,6 +23,7 @@ fn main() { let out_dir = env::var("OUT_DIR").unwrap(); let mut file = File::create(&Path::new(&out_dir).join("bindings.rs")).unwrap(); - gl_generator::generate_bindings(GlobalGenerator, Api::Gl, Fallbacks::All, - vec![], "4.5", Profile::Core, &mut file).unwrap(); + Registry::new(Api::Gl, (4, 5), Profile::Core, Fallbacks::All, []) + .write_bindings(GlobalGenerator, &mut file) + .unwrap(); } diff --git a/gl_generator/README.md b/gl_generator/README.md index a2fe95b6..53c2aa9e 100644 --- a/gl_generator/README.md +++ b/gl_generator/README.md @@ -33,33 +33,34 @@ Create a `build.rs` to pull your specific version/API: ```rust extern crate gl_generator; -use gl_generator::{Fallbacks, GlobalGenerator, Api, Profile}; +use gl_generator::{Registry, Api, Profile, Fallbacks, GlobalGenerator}; use std::env; use std::fs::File; use std::path::Path; fn main() { let dest = env::var("OUT_DIR").unwrap(); - let mut file = File::create(&Path::new(&dest).join("bindings.rs")).unwrap(); + let mut file = File::create(&Path::new(&dest).join("gl_bindings.rs")).unwrap(); - gl_generator::generate_bindings(GlobalGenerator, Api::Gl, Fallbacks::All, - vec![], "4.5", Profile::Core, &mut file).unwrap(); + Registry::new(Api::Gl, (4, 5), Profile::Core, Fallbacks::All, []) + .write_bindings(GlobalGenerator, &mut file) + .unwrap(); } ``` Then use it like this: ```rust -mod gles { +mod gl { include!(concat!(env!("OUT_DIR"), "/bindings.rs")); } -/* - * Simple loading example - */ +/// Simple loading example fn main() { - // Assuming window is GLFW, initialized, and made current - gles::load_with(|s| window.get_proc_address(s)); + let window = ...; + + // Assuming `window` is GLFW: initialize, and made current + gl::load_with(|s| window.get_proc_address(s)); } ``` @@ -105,11 +106,8 @@ OpenGL 1.1 on Windows, you will need to add ### Custom Generators The `gl_generator` crate is extensible. This is a niche feature useful only in -very rare cases. To create a custom generator, [create a new plugin -crate](http://doc.rust-lang.org/guide-plugin.html#syntax-extensions) which -depends on `gl_generator`. Then, implement the `gl_generator::Generator` trait -and in your plugin registrar, register a function which calls -`gl_generator::generate_bindings` with your custom generator and its name. +very rare cases. To create a custom generator, implement the +`gl_generator::generators::Generator` trait. ## Extra features @@ -122,14 +120,16 @@ also attempt to load `glGenFramebuffersEXT` as a fallback. ### vX.X.X - Rename `Ns` to `API`, and expose at the top level -- Use `Api` for `Extension::supported` and `Filter::api` fields -- Remove `source` argument from `generate_bindings`, removing the need for - clients to depend on the `khronos_api` crate -- Add `Profile` enum for specifying the API profile, and change the `source` - argument to use it instead of a string -- Remove `features` and `extensions` fields from `Registry` -- Hide `registry::{Feature, Filter, Require, Remove, Extension}` from the public API -- Move `registry::{Fallbacks, Api, Profile}` to top level module +- Remove the need for clients to depend on the `khronos_api` crate by + determining the XML source based on the requested `API` +- Use a `(u8, u8)` instead of a string for the target version number +- Use a `Profile` enum instead of a string for the profile +- Remove unused fields from `Registry` +- Accept types satisfying `AsRef<[&str]>` for extension lists +- Separate parsing and generation stages in API +- Hide `registry::{Feature, Filter, Require, Remove, Extension}` types from the + public API +- Move `registry::{Fallbacks, Api, Profile}` types to top level module ### v0.4.2 diff --git a/gl_generator/lib.rs b/gl_generator/lib.rs index df2d11bb..2963e4ea 100644 --- a/gl_generator/lib.rs +++ b/gl_generator/lib.rs @@ -23,7 +23,7 @@ //! ```no_run //! extern crate gl_generator; //! -//! use gl_generator::{Fallbacks, GlobalGenerator, Api, Profile}; +//! use gl_generator::{Registry, Api, Profile, Fallbacks, GlobalGenerator}; //! use std::env; //! use std::fs::File; //! use std::path::Path; @@ -32,8 +32,9 @@ //! let dest = env::var("OUT_DIR").unwrap(); //! let mut file = File::create(&Path::new(&dest).join("gl_bindings.rs")).unwrap(); //! -//! gl_generator::generate_bindings(GlobalGenerator, Api::Gl, Fallbacks::All, -//! vec![], "4.5", Profile::Core, &mut file).unwrap(); +//! Registry::new(Api::Gl, (4, 5), Profile::Core, Fallbacks::All, []) +//! .write_bindings(GlobalGenerator, &mut file) +//! .unwrap(); //! } //! ``` //! @@ -64,11 +65,11 @@ extern crate log; use generators::Generator; -use registry::Registry; use std::fmt; use std::io; +pub use registry::Registry; pub use generators::debug_struct_gen::DebugStructGenerator; pub use generators::global_gen::GlobalGenerator; pub use generators::static_gen::StaticGenerator; @@ -102,23 +103,11 @@ pub enum Fallbacks { All, None } #[derive(Copy, Clone, PartialEq, Eq)] pub enum Profile { Core, Compatibility } -/// Generate OpenGL bindings using the specified generator -/// -/// # Arguments -/// -/// - `generator`: The type of loader to generate. -/// - `api`: The API to generate. -/// - `profile`: `Profile::Core` will only include all functions supported by the requested API -/// version, while `Profile::Compatibility` will include all the functions from previous versions -/// of the API as well. -/// - `version`: The requested API version. This is usually in the form `"major.minor"`. -/// - `extensions`: A list of extra extensions to include in the bindings. -/// - `dest`: Where to write the generated rust source code to -/// -pub fn generate_bindings(generator: G, api: Api, fallbacks: Fallbacks, - extensions: Vec, version: &str, profile: Profile, - dest: &mut W) -> io::Result<()> where G: Generator, W: io::Write -{ - let registry = Registry::new(api, fallbacks, extensions, version, profile); - generator.write(®istry, dest) +impl Registry { + pub fn write_bindings(&self, generator: G, output: &mut W) -> io::Result<()> where + G: Generator, + W: io::Write, + { + generator.write(&self, output) + } } diff --git a/gl_generator/registry.rs b/gl_generator/registry.rs index a4d4eefa..08162796 100644 --- a/gl_generator/registry.rs +++ b/gl_generator/registry.rs @@ -98,12 +98,15 @@ pub struct Registry { } impl Registry { - /// Generate a registry from the supplied XML string - pub fn new(api: Api, fallbacks: Fallbacks, extensions: Vec, version: &str, profile: Profile) -> Registry { + 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 filter = Filter { fallbacks: fallbacks, extensions: extensions, - version: version.to_string(), + version: format!("{}.{}", major, minor), profile: profile, }; @@ -262,9 +265,9 @@ struct RegistryParser { reader: XmlEventReader, } -struct Filter { +struct Filter { fallbacks: Fallbacks, - extensions: Vec, + extensions: Extensions, profile: Profile, version: String, } @@ -319,7 +322,9 @@ impl RegistryParser { } } - fn parse(src: R, api: Api, filter: Filter) -> Registry { + fn parse<'a, Exts>(src: R, api: Api, filter: Filter) -> Registry where + Exts: AsRef<[&'a str]>, + { let mut parser = RegistryParser { api: api, reader: XmlEventReader::new(src), @@ -420,7 +425,7 @@ impl RegistryParser { } for extension in extensions.iter() { - if filter.extensions.iter().any(|x| x == &extension.name) { + if filter.extensions.as_ref().iter().any(|x| x == &extension.name) { if !extension.supported.iter().any(|x| x == &api) { panic!("Requested {}, which doesn't support the {} API", extension.name, api); } diff --git a/gl_tests/test_gen_symbols/build.rs b/gl_tests/test_gen_symbols/build.rs index 49ff81d4..c8cc74cc 100644 --- a/gl_tests/test_gen_symbols/build.rs +++ b/gl_tests/test_gen_symbols/build.rs @@ -25,28 +25,33 @@ fn main() { let mut file = File::create(&Path::new(&dest).join("test_gen_symbols.rs")).unwrap(); writeln!(&mut file, "mod gl {{").unwrap(); - gl_generator::generate_bindings(GlobalGenerator, Api::Gl, Fallbacks::All, - vec![], "4.5", Profile::Core, &mut file).unwrap(); + Registry::new(Api::Gl, (4, 5), Profile::Core, Fallbacks::All, []) + .write_bindings(GlobalGenerator, &mut file) + .unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod gles {{").unwrap(); - gl_generator::generate_bindings(GlobalGenerator, Api::Gles2, Fallbacks::All, - vec![], "3.1", Profile::Core, &mut file).unwrap(); + Registry::new(Api::Gles2, (3, 1), Profile::Core, Fallbacks::All, []) + .write_bindings(GlobalGenerator, &mut file) + .unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod glx {{").unwrap(); - gl_generator::generate_bindings(GlobalGenerator, Api::Glx, Fallbacks::All, - vec![], "1.4", Profile::Core, &mut file).unwrap(); + Registry::new(Api::Glx, (1, 4), Profile::Core, Fallbacks::All, []) + .write_bindings(GlobalGenerator, &mut file) + .unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod wgl {{").unwrap(); - gl_generator::generate_bindings(GlobalGenerator, Api::Wgl, Fallbacks::All, - vec![], "1.0", Profile::Core, &mut file).unwrap(); + Registry::new(Api::Wgl, (1, 0), Profile::Core, Fallbacks::All, []) + .write_bindings(GlobalGenerator, &mut file) + .unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod egl {{ {}", build_egl_symbols()).unwrap(); - gl_generator::generate_bindings(GlobalGenerator, Api::Egl, Fallbacks::All, - vec![], "1.5", Profile::Core, &mut file).unwrap(); + Registry::new(Api::Egl, (1, 5), Profile::Core, Fallbacks::All, []) + .write_bindings(GlobalGenerator, &mut file) + .unwrap(); writeln!(&mut file, "}}").unwrap(); } diff --git a/gl_tests/test_no_warnings/build.rs b/gl_tests/test_no_warnings/build.rs index 0b0b9b53..f371cfb7 100644 --- a/gl_tests/test_no_warnings/build.rs +++ b/gl_tests/test_no_warnings/build.rs @@ -15,8 +15,6 @@ extern crate gl_generator; use gl_generator::*; -use gl_generator::generators::Generator; -use gl_generator::registry::Registry; use std::env; use std::fs::File; use std::io::prelude::*; @@ -28,146 +26,146 @@ fn main() { // Gl - let gl_registry = Registry::new(Api::Gl, Fallbacks::All, vec![], "4.5", Profile::Core); + let gl_registry = Registry::new(Api::Gl, (4, 5), Profile::Core, Fallbacks::All, []); writeln!(&mut file, "mod gl_global {{").unwrap(); - GlobalGenerator.write(&gl_registry, &mut file).unwrap(); + gl_registry.write_bindings(GlobalGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod gl_static {{").unwrap(); - StaticGenerator.write(&gl_registry, &mut file).unwrap(); + gl_registry.write_bindings(StaticGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod gl_struct {{").unwrap(); - StructGenerator.write(&gl_registry, &mut file).unwrap(); + gl_registry.write_bindings(StructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod gl_static_struct {{").unwrap(); - StaticStructGenerator.write(&gl_registry, &mut file).unwrap(); + gl_registry.write_bindings(StaticStructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod gl_debug_struct {{").unwrap(); - DebugStructGenerator.write(&gl_registry, &mut file).unwrap(); + gl_registry.write_bindings(DebugStructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); // Glx - let glx_registry = Registry::new(Api::Glx, Fallbacks::All, vec![], "1.4", Profile::Core); + let glx_registry = Registry::new(Api::Glx, (1, 4), Profile::Core, Fallbacks::All, []); writeln!(&mut file, "mod glx_global {{").unwrap(); - GlobalGenerator.write(&glx_registry, &mut file).unwrap(); + glx_registry.write_bindings(GlobalGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod glx_static {{").unwrap(); - StaticGenerator.write(&glx_registry, &mut file).unwrap(); + glx_registry.write_bindings(StaticGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod glx_struct {{").unwrap(); - StructGenerator.write(&glx_registry, &mut file).unwrap(); + glx_registry.write_bindings(StructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod glx_static_struct {{").unwrap(); - StaticStructGenerator.write(&glx_registry, &mut file).unwrap(); + glx_registry.write_bindings(StaticStructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod glx_debug_struct {{").unwrap(); - DebugStructGenerator.write(&glx_registry, &mut file).unwrap(); + glx_registry.write_bindings(DebugStructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); // Wgl - let wgl_registry = Registry::new(Api::Wgl, Fallbacks::All, vec![], "1.0", Profile::Core); + let wgl_registry = Registry::new(Api::Wgl, (1, 0), Profile::Core, Fallbacks::All, []); writeln!(&mut file, "mod wgl_global {{").unwrap(); - GlobalGenerator.write(&wgl_registry, &mut file).unwrap(); + wgl_registry.write_bindings(GlobalGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod wgl_static {{").unwrap(); - StaticGenerator.write(&wgl_registry, &mut file).unwrap(); + wgl_registry.write_bindings(StaticGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod wgl_struct {{").unwrap(); - StructGenerator.write(&wgl_registry, &mut file).unwrap(); + wgl_registry.write_bindings(StructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod wgl_static_struct {{").unwrap(); - StaticStructGenerator.write(&wgl_registry, &mut file).unwrap(); + wgl_registry.write_bindings(StaticStructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod wgl_debug_struct {{").unwrap(); - DebugStructGenerator.write(&wgl_registry, &mut file).unwrap(); + wgl_registry.write_bindings(DebugStructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); // Gles1 - let gles1_registry = Registry::new(Api::Gles1, Fallbacks::All, vec![], "1.1", Profile::Core); + let gles1_registry = Registry::new(Api::Gles1, (1, 1), Profile::Core, Fallbacks::All, []); writeln!(&mut file, "mod gles1_global {{").unwrap(); - GlobalGenerator.write(&gles1_registry, &mut file).unwrap(); + gles1_registry.write_bindings(GlobalGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod gles1_static {{").unwrap(); - StaticGenerator.write(&gles1_registry, &mut file).unwrap(); + gles1_registry.write_bindings(StaticGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod gles1_struct {{").unwrap(); - StructGenerator.write(&gles1_registry, &mut file).unwrap(); + gles1_registry.write_bindings(StructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod gles1_static_struct {{").unwrap(); - StaticStructGenerator.write(&gles1_registry, &mut file).unwrap(); + gles1_registry.write_bindings(StaticStructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod gles1_debug_struct {{").unwrap(); - DebugStructGenerator.write(&gles1_registry, &mut file).unwrap(); + gles1_registry.write_bindings(DebugStructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); // Gles2 - let gles2_registry = Registry::new(Api::Gles2, Fallbacks::All, vec![], "3.1", Profile::Core); + let gles2_registry = Registry::new(Api::Gles2, (3, 1), Profile::Core, Fallbacks::All, []); writeln!(&mut file, "mod gles2_global {{").unwrap(); - GlobalGenerator.write(&gles2_registry, &mut file).unwrap(); + gles2_registry.write_bindings(GlobalGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod gles2_static {{").unwrap(); - StaticGenerator.write(&gles2_registry, &mut file).unwrap(); + gles2_registry.write_bindings(StaticGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod gles2_struct {{").unwrap(); - StructGenerator.write(&gles2_registry, &mut file).unwrap(); + gles2_registry.write_bindings(StructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod gles2_static_struct {{").unwrap(); - StaticStructGenerator.write(&gles2_registry, &mut file).unwrap(); + gles2_registry.write_bindings(StaticStructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod gles2_debug_struct {{").unwrap(); - DebugStructGenerator.write(&gles2_registry, &mut file).unwrap(); + gles2_registry.write_bindings(DebugStructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); // Egl - let egl_registry = Registry::new(Api::Egl, Fallbacks::All, vec![], "1.5", Profile::Core); + let egl_registry = Registry::new(Api::Egl, (1, 5), Profile::Core, Fallbacks::All, []); writeln!(&mut file, "mod egl_global {{ {}", build_egl_symbols()).unwrap(); - GlobalGenerator.write(&egl_registry, &mut file).unwrap(); + egl_registry.write_bindings(GlobalGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod egl_static {{ {}", build_egl_symbols()).unwrap(); - StaticGenerator.write(&egl_registry, &mut file).unwrap(); + egl_registry.write_bindings(StaticGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod egl_struct {{ {}", build_egl_symbols()).unwrap(); - StructGenerator.write(&egl_registry, &mut file).unwrap(); + egl_registry.write_bindings(StructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod egl_static_struct {{ {}", build_egl_symbols()).unwrap(); - StaticStructGenerator.write(&egl_registry, &mut file).unwrap(); + egl_registry.write_bindings(StaticStructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); writeln!(&mut file, "mod egl_debug_struct {{ {}", build_egl_symbols()).unwrap(); - DebugStructGenerator.write(&egl_registry, &mut file).unwrap(); + egl_registry.write_bindings(DebugStructGenerator, &mut file).unwrap(); writeln!(&mut file, "}}").unwrap(); } diff --git a/gl_tests/test_symbols/build.rs b/gl_tests/test_symbols/build.rs index 0ad91be3..fcbc62c0 100644 --- a/gl_tests/test_symbols/build.rs +++ b/gl_tests/test_symbols/build.rs @@ -23,6 +23,7 @@ fn main() { let dest = env::var("OUT_DIR").unwrap(); let mut file = File::create(&Path::new(&dest).join("test_symbols.rs")).unwrap(); - gl_generator::generate_bindings(GlobalGenerator, Api::Gl, Fallbacks::All, - vec![], "4.5", Profile::Core, &mut file).unwrap(); + Registry::new(Api::Gl, (4, 5), Profile::Core, Fallbacks::All, []) + .write_bindings(GlobalGenerator, &mut file) + .unwrap(); } diff --git a/gl_tests/test_with_extensions/Cargo.toml b/gl_tests/test_with_extensions/Cargo.toml new file mode 100644 index 00000000..960f2d0b --- /dev/null +++ b/gl_tests/test_with_extensions/Cargo.toml @@ -0,0 +1,11 @@ +[package] +# we don't include some metadata to avoid accidental publishes +name = "test_with_extensions" +version = "0.0.0" +build = "build.rs" + +[lib] +path = "lib.rs" + +[build-dependencies] +gl_generator = { path = "../../gl_generator" } diff --git a/gl_tests/test_with_extensions/build.rs b/gl_tests/test_with_extensions/build.rs new file mode 100644 index 00000000..4b4ae4ab --- /dev/null +++ b/gl_tests/test_with_extensions/build.rs @@ -0,0 +1,29 @@ +// 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 +// 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 gl_generator; + +use gl_generator::*; +use std::env; +use std::fs::File; +use std::path::*; + +fn main() { + let dest = env::var("OUT_DIR").unwrap(); + let mut file = File::create(&Path::new(&dest).join("test_symbols.rs")).unwrap(); + + Registry::new(Api::Gl, (4, 5), Profile::Core, Fallbacks::All, ["GL_ARB_debug_output"]) + .write_bindings(GlobalGenerator, &mut file) + .unwrap(); +} diff --git a/gl_tests/test_with_extensions/lib.rs b/gl_tests/test_with_extensions/lib.rs new file mode 100644 index 00000000..249abbc9 --- /dev/null +++ b/gl_tests/test_with_extensions/lib.rs @@ -0,0 +1,47 @@ +// 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 +// 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. + +pub mod gl { + include!(concat!(env!("OUT_DIR"), "/test_symbols.rs")); +} + +pub fn compile_test_symbols_exist() { + let _ = gl::DebugMessageControlARB; + let _ = gl::DebugMessageInsertARB; + let _ = gl::DebugMessageCallbackARB; + let _ = gl::GetDebugMessageLogARB; + + assert_eq!(gl::DEBUG_OUTPUT_SYNCHRONOUS_ARB, 0x8242); + assert_eq!(gl::MAX_DEBUG_MESSAGE_LENGTH_ARB, 0x9143); + assert_eq!(gl::MAX_DEBUG_LOGGED_MESSAGES_ARB, 0x9144); + assert_eq!(gl::DEBUG_LOGGED_MESSAGES_ARB, 0x9145); + assert_eq!(gl::DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB, 0x8243); + assert_eq!(gl::DEBUG_CALLBACK_FUNCTION_ARB, 0x8244); + assert_eq!(gl::DEBUG_CALLBACK_USER_PARAM_ARB, 0x8245); + assert_eq!(gl::DEBUG_SOURCE_API_ARB, 0x8246); + assert_eq!(gl::DEBUG_SOURCE_WINDOW_SYSTEM_ARB, 0x8247); + assert_eq!(gl::DEBUG_SOURCE_SHADER_COMPILER_ARB, 0x8248); + assert_eq!(gl::DEBUG_SOURCE_THIRD_PARTY_ARB, 0x8249); + assert_eq!(gl::DEBUG_SOURCE_APPLICATION_ARB, 0x824A); + assert_eq!(gl::DEBUG_SOURCE_OTHER_ARB, 0x824B); + assert_eq!(gl::DEBUG_TYPE_ERROR_ARB, 0x824C); + assert_eq!(gl::DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB, 0x824D); + assert_eq!(gl::DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB, 0x824E); + assert_eq!(gl::DEBUG_TYPE_PORTABILITY_ARB, 0x824F); + assert_eq!(gl::DEBUG_TYPE_PERFORMANCE_ARB, 0x8250); + assert_eq!(gl::DEBUG_TYPE_OTHER_ARB, 0x8251); + assert_eq!(gl::DEBUG_SEVERITY_HIGH_ARB, 0x9146); + assert_eq!(gl::DEBUG_SEVERITY_MEDIUM_ARB, 0x9147); + assert_eq!(gl::DEBUG_SEVERITY_LOW_ARB, 0x9148); +}