mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-22 06:45:13 +00:00
Enable spirv-val by default
This commit is contained in:
parent
8d3101e81e
commit
69ecc92ba4
@ -125,8 +125,8 @@ fn link_exe(
|
|||||||
let _timer = sess.timer("link_spirv_opt");
|
let _timer = sess.timer("link_spirv_opt");
|
||||||
do_spirv_opt(sess, out_filename);
|
do_spirv_opt(sess, out_filename);
|
||||||
}
|
}
|
||||||
if let Ok(dump_path) = env::var("SPIRV_VAL") {
|
if env::var("NO_SPIRV_VAL").is_err() {
|
||||||
do_spirv_val(sess, out_filename, dump_path);
|
do_spirv_val(sess, out_filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,23 +153,18 @@ fn do_spirv_opt(sess: &Session, filename: &Path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn do_spirv_val(sess: &Session, filename: &Path, dump_path: String) {
|
fn do_spirv_val(sess: &Session, filename: &Path) {
|
||||||
let output = Command::new("spirv-val").arg(&filename).output();
|
let output = Command::new("spirv-val").arg(&filename).output();
|
||||||
let output = output.expect("spirv-val failed to execute");
|
let output = output.expect("spirv-val failed to execute");
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
let dump_path = Path::new(&dump_path);
|
|
||||||
let mut err = sess.struct_err(&format!("spirv-val failed with {}", output.status));
|
let mut err = sess.struct_err(&format!("spirv-val failed with {}", output.status));
|
||||||
|
err.note(&format!("module {:?}", filename));
|
||||||
if !output.stdout.is_empty() {
|
if !output.stdout.is_empty() {
|
||||||
err.note(&String::from_utf8(output.stdout).unwrap());
|
err.note(&String::from_utf8(output.stdout).unwrap());
|
||||||
}
|
}
|
||||||
if !output.stderr.is_empty() {
|
if !output.stderr.is_empty() {
|
||||||
err.note(&String::from_utf8(output.stderr).unwrap());
|
err.note(&String::from_utf8(output.stderr).unwrap());
|
||||||
}
|
}
|
||||||
if dump_path.is_absolute() {
|
|
||||||
err.note(&format!("dumping module to {:?}", dump_path));
|
|
||||||
std::fs::create_dir_all(dump_path.parent().unwrap()).unwrap();
|
|
||||||
std::fs::copy(&filename, dump_path).unwrap();
|
|
||||||
}
|
|
||||||
err.emit();
|
err.emit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,6 @@ fn invoke_rustc(path_to_crate: &Path) -> Result<String, SpirvBuilderError> {
|
|||||||
.stderr(Stdio::inherit())
|
.stderr(Stdio::inherit())
|
||||||
.current_dir(path_to_crate)
|
.current_dir(path_to_crate)
|
||||||
.env("RUSTFLAGS", rustflags)
|
.env("RUSTFLAGS", rustflags)
|
||||||
.env("SPIRV_VAL", "1")
|
|
||||||
.output()
|
.output()
|
||||||
.expect("failed to execute cargo build");
|
.expect("failed to execute cargo build");
|
||||||
if build.status.success() {
|
if build.status.success() {
|
||||||
|
Loading…
Reference in New Issue
Block a user