mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 16:25:31 +00:00
Use the glsl to spirv compiler in shader-parser
This commit is contained in:
parent
f2da9331f2
commit
c67d3a6a93
@ -2,3 +2,6 @@
|
|||||||
name = "shader-parser"
|
name = "shader-parser"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>"]
|
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>"]
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
glsl-to-spirv = { path = "../glsl-to-spirv" }
|
||||||
|
@ -1,9 +1,21 @@
|
|||||||
|
extern crate glsl_to_spirv;
|
||||||
extern crate shader_parser;
|
extern crate shader_parser;
|
||||||
|
|
||||||
use std::io::Cursor;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let content = include_bytes!("example.spv");
|
let shader = r#"
|
||||||
let output = shader_parser::reflect(Cursor::new(&content[..])).unwrap();
|
#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);
|
println!("{}", output);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user