You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Trac3r-rust/src/util.rs

34 lines
1.2 KiB

//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<T>(path: T, shader_kind: ShaderKind) -> Result<Vec<u32>, CompileError>
// where
// T: AsRef<Path>,
//{
// // 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())
//}