alex/beta-minecraft-rust
Minecraft Beta 1.7.3 Rewrite
BRANCH main
SNAPSHOT Draw terrain GPU-driven from packed per-section buffers with GPU occlusion culling, add a render distance slider (2-128) with a quad/disk shape, cut chunk bookkeeping at high render distances, and fix a light underflow at y=0
DOWNLOAD
root crates client build.rs
//! Compiles every `shaders/*.slang` file to SPIR-V with `slangc`.
use std::path::Path;
use std::process::Command;
fn main() {
let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR is set by cargo");
let slangc = std::env::var("SLANGC").unwrap_or_else(|_| "slangc".into());
println!("cargo:rerun-if-env-changed=SLANGC");
println!("cargo:rerun-if-changed=shaders");
for entry in std::fs::read_dir("shaders").expect("shaders directory exists") {
let path = entry.expect("readable shaders directory").path();
if path.extension().is_none_or(|ext| ext != "slang") {
continue;
}
let output =
Path::new(&out_dir).join(path.with_extension("spv").file_name().expect("file name"));
let status = Command::new(&slangc)
.arg(&path)
.args(["-target", "spirv", "-profile", "spirv_1_6"])
.args([
"-matrix-layout-column-major",
"-fvk-use-entrypoint-name",
"-O2",
"-o",
])
.arg(&output)
.status()
.unwrap_or_else(|error| {
panic!("failed to run {slangc} (install shader-slang or set SLANGC): {error}")
});
assert!(status.success(), "slangc failed for {}", path.display());
}
}