From c67d3a6a93d07248395ffb5c0d9243cbc2491788 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sun, 31 Jan 2016 13:18:58 +0100 Subject: [PATCH] Use the glsl to spirv compiler in shader-parser --- shader-parser/Cargo.toml | 3 +++ shader-parser/examples/example.rs | 20 ++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/shader-parser/Cargo.toml b/shader-parser/Cargo.toml index 755ab390..b737e658 100644 --- a/shader-parser/Cargo.toml +++ b/shader-parser/Cargo.toml @@ -2,3 +2,6 @@ name = "shader-parser" version = "0.1.0" authors = ["Pierre Krieger "] + +[dev-dependencies] +glsl-to-spirv = { path = "../glsl-to-spirv" } diff --git a/shader-parser/examples/example.rs b/shader-parser/examples/example.rs index aceb22b9..0dd9155a 100644 --- a/shader-parser/examples/example.rs +++ b/shader-parser/examples/example.rs @@ -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); }