use std::path::Path;
pub struct CompiledSlangShader {
pub(crate) label: String,
args: String,
pub source: Vec<u8>,
}
impl CompiledSlangShader {
pub(crate) fn new(label: String, args: String, source: Vec<u8>) -> Self {
Self {
args,
source,
label,
}
}
pub fn args(&self) -> String {
self.args.clone()
}
pub fn from_bytes(label: &str, source: &[u8]) -> Self {
Self {
label: label.to_string(),
args: String::new(),
source: source.to_vec(),
}
}
pub fn label(&self) -> String {
self.label.clone()
}
pub fn output(&self, path: impl AsRef<Path>) -> std::io::Result<()> {
let path = path.as_ref();
std::fs::write(path, &self.source)
}
}