Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = [
"vk-parse",
"ci",
"khronos-registry-parse",
"ci"
]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

`vk-parse` is a Rust crate which parses the Vulkan API registry XML and converts it to a Rust representation. It can be used to simplify generation of Vulkan API bindings.

Crate itself resides in [vk-parse subdirectory](vk-parse), where you can also find more information about it.
Crate itself resides in [vk-parse subdirectory](khronos-registry-parse), where you can also find more information about it.
2 changes: 1 addition & 1 deletion ci/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ minreq = { version = "^2", features = ["https"] }
ron = "^0.4"
serde = "^1.0.75"
serde_derive = "^1.0.75"
vk-parse = { path = "../vk-parse", features = ["serialize", "vkxml-convert"] }
khronos-registry-parse = { path = "../khronos-registry-parse", features = ["serialize", "vkxml-convert", "vulkan", "opengl"] }
vkxml = "^0.3"
xml-rs = "^0.8"
48 changes: 34 additions & 14 deletions ci/tests/test.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#![deny(warnings)]
extern crate khronos_registry_parse;

extern crate minreq;
extern crate ron;
extern crate serde;
extern crate vk_parse;
extern crate vkxml;
extern crate xml;
use khronos_registry_parse::gl;
use khronos_registry_parse::vk;
use std::fs::File;
use std::io::BufReader;
use std::path::{Path, PathBuf};

const URL_REPO: &str = "https://raw.githubusercontent.com/KhronosGroup/Vulkan-Docs";
const URL_MAIN: &str = "https://raw.githubusercontent.com/KhronosGroup/Vulkan-Docs/main/xml/vk.xml";
const URL_MAIN_VK: &str =
"https://raw.githubusercontent.com/KhronosGroup/Vulkan-Docs/main/xml/vk.xml";
const URL_MAIN_GL: &str =
"https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/main/xml/gl.xml";

fn download<T: std::io::Write>(dst: &mut T, url: &str) {
let resp = minreq::get(url)
Expand Down Expand Up @@ -37,7 +39,7 @@ fn parsing_test(major: u32, minor: u32, patch: u32, url_suffix: &str) {
download(&mut buf, &src);
buf.set_position(0);

match vk_parse::parse_stream(buf.clone()) {
match vk::parse_stream(buf.clone()) {
Ok((_reg, errors)) => {
if !errors.is_empty() {
panic!("{:?}", errors);
Expand All @@ -46,7 +48,8 @@ fn parsing_test(major: u32, minor: u32, patch: u32, url_suffix: &str) {
Err(fatal_error) => panic!("{:?}", fatal_error),
}

match vk_parse::parse_stream_as_vkxml(buf) {
#[cfg(feature = "vkxml-convert")]
match vk::parse_stream_as_vkxml(buf) {
Ok(_) => (),
Err(fatal_error) => panic!("{:?}", fatal_error),
}
Expand All @@ -62,13 +65,30 @@ macro_rules! test_version {
}

#[test]
fn test_main() {
fn test_opengl_main() {
use std::io::Cursor;
let mut buf = Cursor::new(vec![0; 15]);
download(&mut buf, URL_MAIN);
download(&mut buf, URL_MAIN_GL);
buf.set_position(0);

match vk_parse::parse_stream(buf.clone()) {
match gl::parse_stream(buf.clone()) {
Ok((_reg, errors)) => {
if !errors.is_empty() {
panic!("{:?}", errors);
}
}
Err(fatal_error) => panic!("{:?}", fatal_error),
}
}

#[test]
fn test_vulkan_main() {
use std::io::Cursor;
let mut buf = Cursor::new(vec![0; 15]);
download(&mut buf, URL_MAIN_VK);
buf.set_position(0);

match vk::parse_stream(buf.clone()) {
Ok((_reg, errors)) => {
if !errors.is_empty() {
panic!("{:?}", errors);
Expand All @@ -77,7 +97,7 @@ fn test_main() {
Err(fatal_error) => panic!("{:?}", fatal_error),
}

match vk_parse::parse_stream_as_vkxml(buf) {
match vk::parse_stream_as_vkxml(buf) {
Ok(_) => (),
Err(fatal_error) => panic!("{:?}", fatal_error),
}
Expand Down
11 changes: 8 additions & 3 deletions vk-parse/Cargo.toml → khronos-registry-parse/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "vk-parse"
name = "khronos-registry-parse"
version = "0.7.0"
authors = ["Martin Krošlák <kroslakma@gmail.com>"]
description = "Vulkan specification parser"
Expand All @@ -12,13 +12,18 @@ categories = ["parser-implementations", "rendering::graphics-api"]

[features]
serialize = ["serde", "serde_derive"]
vkxml-convert = ["vkxml"]
vkxml-convert = ["vkxml", "vulkan"]
vulkan = []
opengl = []

[dependencies]
xml-rs = "^0.8"

vkxml = { optional = true, version = "^0.3" }
serde = { optional = true, version = "^1.0.75" }
serde_derive = { optional = true, version = "^1.0.75" }

[dev-dependencies]
minreq = { version = "^2", features = ["https"] }
ron = "^0.4"

[badges]
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions khronos-registry-parse/src/gl/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
mod parse;
mod types;

pub use gl::parse::parse_file;
pub use gl::parse::parse_stream;
pub use gl::types::*;
pub use types::*;
Loading