#![allow(unused_labels)]
#![allow(clippy::unused_label)]
#![allow(clippy::cognitive_complexity)]
#![allow(clippy::implicit_hasher)]
#![warn(missing_docs)]
#![allow(clippy::len_zero)]
use hashbrown::*;
pub mod xml;
pub use xml::*;
pub mod output;
pub use output::*;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ApiCategory {
Gl,
Gles1,
Gles2,
Glsc2,
}
impl ApiCategory {
pub fn from_name(name: &str) -> Self {
match name {
"GL_SC_VERSION_2_0" => Self::Glsc2,
"GL_ES_VERSION_3_2" => Self::Gles2,
"GL_ES_VERSION_3_1" => Self::Gles2,
"GL_ES_VERSION_3_0" => Self::Gles2,
"GL_ES_VERSION_2_0" => Self::Gles2,
"GL_VERSION_ES_CM_1_0" => Self::Gles1,
"GL_VERSION_4_6" => Self::Gl,
"GL_VERSION_4_5" => Self::Gl,
"GL_VERSION_4_4" => Self::Gl,
"GL_VERSION_4_3" => Self::Gl,
"GL_VERSION_4_2" => Self::Gl,
"GL_VERSION_4_1" => Self::Gl,
"GL_VERSION_4_0" => Self::Gl,
"GL_VERSION_3_3" => Self::Gl,
"GL_VERSION_3_2" => Self::Gl,
"GL_VERSION_3_1" => Self::Gl,
"GL_VERSION_3_0" => Self::Gl,
"GL_VERSION_2_1" => Self::Gl,
"GL_VERSION_2_0" => Self::Gl,
"GL_VERSION_1_5" => Self::Gl,
"GL_VERSION_1_4" => Self::Gl,
"GL_VERSION_1_3" => Self::Gl,
"GL_VERSION_1_2" => Self::Gl,
"GL_VERSION_1_1" => Self::Gl,
"GL_VERSION_1_0" => Self::Gl,
_ => panic!("Not an ApiCategory: {}", name),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Profile {
Core,
Compatibility,
}
impl core::fmt::Display for Profile {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
write!(f, "{:?}", self)
}
}
pub fn feature_name_for(
category: ApiCategory,
major: i32,
minor: i32,
) -> Option<&'static str> {
Some(match (category, major, minor) {
(ApiCategory::Glsc2, 2, 0) => "GL_SC_VERSION_2_0",
(ApiCategory::Gles2, 3, 2) => "GL_ES_VERSION_3_2",
(ApiCategory::Gles2, 3, 1) => "GL_ES_VERSION_3_1",
(ApiCategory::Gles2, 3, 0) => "GL_ES_VERSION_3_0",
(ApiCategory::Gles2, 2, 0) => "GL_ES_VERSION_2_0",
(ApiCategory::Gles1, 1, 0) => "GL_VERSION_ES_CM_1_0",
(ApiCategory::Gl, 4, 6) => "GL_VERSION_4_6",
(ApiCategory::Gl, 4, 5) => "GL_VERSION_4_5",
(ApiCategory::Gl, 4, 4) => "GL_VERSION_4_4",
(ApiCategory::Gl, 4, 3) => "GL_VERSION_4_3",
(ApiCategory::Gl, 4, 2) => "GL_VERSION_4_2",
(ApiCategory::Gl, 4, 1) => "GL_VERSION_4_1",
(ApiCategory::Gl, 4, 0) => "GL_VERSION_4_0",
(ApiCategory::Gl, 3, 3) => "GL_VERSION_3_3",
(ApiCategory::Gl, 3, 2) => "GL_VERSION_3_2",
(ApiCategory::Gl, 3, 1) => "GL_VERSION_3_1",
(ApiCategory::Gl, 3, 0) => "GL_VERSION_3_0",
(ApiCategory::Gl, 2, 1) => "GL_VERSION_2_1",
(ApiCategory::Gl, 2, 0) => "GL_VERSION_2_0",
(ApiCategory::Gl, 1, 5) => "GL_VERSION_1_5",
(ApiCategory::Gl, 1, 4) => "GL_VERSION_1_4",
(ApiCategory::Gl, 1, 3) => "GL_VERSION_1_3",
(ApiCategory::Gl, 1, 2) => "GL_VERSION_1_2",
(ApiCategory::Gl, 1, 1) => "GL_VERSION_1_1",
(ApiCategory::Gl, 1, 0) => "GL_VERSION_1_0",
_ => return None,
})
}