Parse the optional ABI version from a `// ABI-VERSION: N` comment at the top of a shader source. Returns 0 if absent. Used to fail pipeline creation early when a stale shader predates a header bump.
(source: &str)
| 48 | /// at the top of a shader source. Returns 0 if absent. Used to fail |
| 49 | /// pipeline creation early when a stale shader predates a header bump. |
| 50 | pub fn abi_version_of(source: &str) -> u32 { |
| 51 | for line in source.lines().take(20) { |
| 52 | let trimmed = line.trim_start(); |
| 53 | if let Some(rest) = trimmed.strip_prefix("// ABI-VERSION:") { |
| 54 | if let Ok(v) = rest.trim().parse::<u32>() { |
| 55 | return v; |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | 0 |
| 60 | } |
| 61 | |
| 62 | /// Recursively resolve `#include "..."` directives in `entry_path`'s |
| 63 | /// source, returning the fully-expanded WGSL. Each included file is |
no outgoing calls
no test coverage detected