Use the glsl to spirv compiler in shader-parser

This commit is contained in:
Pierre Krieger 2016-01-31 13:18:58 +01:00
parent f2da9331f2
commit c67d3a6a93
2 changed files with 19 additions and 4 deletions

View File

@ -2,3 +2,6 @@
name = "shader-parser"
version = "0.1.0"
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>"]
[dev-dependencies]
glsl-to-spirv = { path = "../glsl-to-spirv" }

View File

@ -1,9 +1,21 @@
extern crate glsl_to_spirv;
extern crate shader_parser;
use std::io::Cursor;
fn main() {
let content = include_bytes!("example.spv");
let output = shader_parser::reflect(Cursor::new(&content[..])).unwrap();
let shader = r#"
#version 450
uniform vec4 u_test;
vec4 f_color;
void main() {
f_color = u_test;
}
"#;
let content = glsl_to_spirv::compile(Some((shader, glsl_to_spirv::ShaderType::Fragment))).unwrap();
let output = shader_parser::reflect(content).unwrap();
println!("{}", output);
}