[][src]Crate phosphorus

A crate that can generate GL bindings.

Example Usage:

let gl_xml = std::fs::read_to_string("gl.xml").unwrap();
let registry = GlRegistry::from_gl_xml_str(&gl_xml);
let selection = GlApiSelection::new_from_registry_api_extensions(
  &registry,
  ApiGroup::Gl,
  (4, 6),
  GlProfile::Core,
  &["GL_EXT_texture_filter_anisotropic"],
);
println!("{}", selection);

If you cargo install phosphorus you'll get a binary that will do approximately this if you give it some CLI args.

Note that the generated output is very ugly (run rustfmt on it) and also relatively large for a single source file (~2mb). The output is primarily intended to be put as its own crate data, though you could easily edit a few parts and have it work as a single module within a larger crate if you like.

You are highly encouraged to not run this as part of your build.rs process. You should run this once, put the output into your project or whatever, and then just use that. You don't need to build it fresh every build. That's insane, stop doing that. Stop having build.rs files at all. Yes, you, whoever you are. All of you. Just stop.

Structs

GlApiSelection

A particular selection of GL items.

GlCommand

A GL function we have to bind to.

GlCommandParam

An argument to a GL function.

GlEnum

A constant we need to declare.

GlEnumDisplayer

Tags a GlEnum we're about to print as being for an ApiGroup.

GlExtension

A vendor-specific API extension you might want to use.

GlFeature

A given GL API you can target.

GlRegistry

Holds all the info accumulated from gl.xml.

GlRemoval

Something to remove compared to the previous API level.

GlRequirement

Something that's new to a given API level.

Enums

ApiGroup

The broad API groups.

GlProfile

The two GL profile styles.

GlType

Some sort of additional type we need to declare.

ReqRem

Tags a requirement or removal as being a Type / Enum / Command.