1#![warn(missing_docs)]
2
3pub struct MslGenerator;
4
5impl MslGenerator {
6 pub fn name(&self) -> &'static str {
7 "msl"
8 }
9
10 pub fn generate(&self, _program: &serde_json::Value) -> gaia_types::Result<std::collections::HashMap<String, Vec<u8>>> {
11 let mut files = std::collections::HashMap::new();
12
13 let mut module_source = self.msl_header();
14 module_source.push_str("\n");
15
16 files.insert("module.metal".to_string(), Vec::from(module_source.as_bytes()));
17 files.insert("default.metallib".to_string(), vec![0x4d, 0x54, 0x4c, 0x42]); Ok(files)
21 }
22
23 fn msl_header(&self) -> String {
24 "#include <metal_stdlib>\nusing namespace metal;".to_string()
25 }
26}