//use crate::error::CompileError; //use shaderc::{IncludeType, ResolvedInclude}; //use shaderc::{ShaderKind, CompileOptions}; //use std::fs::File; //use std::io::Read; //use std::path::{Path, PathBuf}; // // // //pub fn compile(path: T, shader_kind: ShaderKind) -> Result, CompileError> // where // T: AsRef, //{ // // TODO Probably shouldn't create this every time. // let mut compiler = shaderc::Compiler::new().ok_or(CompileError::CreateCompiler)?; // let mut options = CompileOptions::new().ok_or(CompileError::CreateCompiler)?; // let mut f = File::open(&path).map_err(CompileError::Open)?; // let mut src = String::new(); // f.read_to_string(&mut src).map_err(CompileError::Open)?; // options.set_include_callback(|path, include_type, folder_path, depth| { // get_include(path, include_type, folder_path, depth) // }); // let result = compiler // .compile_into_spirv( // src.as_str(), // shader_kind, // path.as_ref().to_str().ok_or(CompileError::InvalidPath)?, // "main", // Some(&options), // ) // .map_err(CompileError::Compile)?; // let data = result.as_binary(); // Ok(data.to_owned()) //}