|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
use compiler::{backend::spirv_meta, meta_compile};
|
|
|
|
|
use error::print_error;
|
|
|
|
|
use std::{env, fs, path::PathBuf};
|
|
|
|
|
use std::{env, fs, path::PathBuf, process::ExitCode};
|
|
|
|
|
|
|
|
|
|
use parser::parse_string;
|
|
|
|
|
pub mod compiler;
|
|
|
|
@ -17,7 +17,7 @@ struct CompilerArgs {
|
|
|
|
|
|
|
|
|
|
const SPIRV_VERSION: &'static str = "1.0";
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
fn main() -> ExitCode {
|
|
|
|
|
let args = parse_args();
|
|
|
|
|
if args.print_version || args.print_help {
|
|
|
|
|
if args.print_help {
|
|
|
|
@ -26,12 +26,12 @@ fn main() {
|
|
|
|
|
if args.print_version {
|
|
|
|
|
print_version();
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
return ExitCode::FAILURE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let Some(input) = args.input else {
|
|
|
|
|
eprintln!("No input specified");
|
|
|
|
|
return;
|
|
|
|
|
return ExitCode::FAILURE;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let output = args.output.unwrap_or(PathBuf::from("./out.spv"));
|
|
|
|
@ -40,7 +40,7 @@ fn main() {
|
|
|
|
|
Ok(i) => i,
|
|
|
|
|
Err(e) => {
|
|
|
|
|
eprintln!("{e}");
|
|
|
|
|
return;
|
|
|
|
|
return ExitCode::FAILURE;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -48,7 +48,7 @@ fn main() {
|
|
|
|
|
Ok(i) => i,
|
|
|
|
|
Err(e) => {
|
|
|
|
|
print_error(e, Some(&src));
|
|
|
|
|
return;
|
|
|
|
|
return ExitCode::FAILURE;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -56,13 +56,15 @@ fn main() {
|
|
|
|
|
Ok(m) => m,
|
|
|
|
|
Err(e) => {
|
|
|
|
|
print_error(e, Some(&src));
|
|
|
|
|
return;
|
|
|
|
|
return ExitCode::FAILURE;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let res = spirv_meta(module);
|
|
|
|
|
|
|
|
|
|
fs::write(output, res).unwrap();
|
|
|
|
|
|
|
|
|
|
ExitCode::SUCCESS
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn parse_args() -> CompilerArgs {
|
|
|
|
|