Self-check: the ABI header parses to a known version. Called from Renderer::new so a bad merge is caught at startup, not at the first draw call.
(expected: u32)
| 34 | /// Renderer::new so a bad merge is caught at startup, not at the first |
| 35 | /// draw call. |
| 36 | pub fn verify_abi_version(expected: u32) -> Result<(), String> { |
| 37 | let src = library(); |
| 38 | let body = src.fetch("material_abi.wgsl") |
| 39 | .ok_or_else(|| "material_abi.wgsl missing from shader library".to_string())?; |
| 40 | let actual = super::shader_include::abi_version_of(body); |
| 41 | if actual != expected { |
| 42 | return Err(format!( |
| 43 | "shader ABI version mismatch: header declares {}, engine expects {}", |
| 44 | actual, expected |
| 45 | )); |
| 46 | } |
| 47 | Ok(()) |
| 48 | } |
| 49 | |
| 50 | /// The version the engine was built against. EN-012 bumped this to 2 |
| 51 | /// when MaterialFactors gained `shading_model` + `foliage_params` |