forked shade_runner and added compiler options. Going to add buttons along with a workflow for picking swatches

This commit is contained in:
2019-07-07 01:00:26 -07:00
parent 942ff4035d
commit 820b99ae4e
5 changed files with 50 additions and 5 deletions

View File

@@ -0,0 +1,34 @@
//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())
//}