Some work on build output

This commit is contained in:
Pierre Krieger 2016-01-31 13:34:19 +01:00
parent 466dffd48f
commit c7a19a1cff
2 changed files with 25 additions and 5 deletions

View File

@ -5,12 +5,13 @@ fn main() {
let shader = r#"
#version 450
uniform vec4 u_test;
uniform sampler2D u_texture;
vec4 f_color;
in vec2 v_texcoords;
out vec4 f_color;
void main() {
f_color = u_test;
f_color = texture(u_texture, v_texcoords);
}
"#;

View File

@ -16,7 +16,26 @@ pub fn reflect<R>(mut spirv: R) -> Result<String, Error>
let mut output = String::new();
for instruction in doc.instructions.iter() {
{
let spirv_data = data.iter().map(|&byte| byte.to_string())
.collect::<Vec<String>>()
.join(", ");
output.push_str(&format!(r#"
pub struct Shader;
impl Shader {{
pub fn load(device: &::std::sync::Arc<::vulkano::Device>) {{
unsafe {{
let data = [{spirv_data}];
::vulkano::Shader::new(device, &data)
}}
}}
}}
"#, spirv_data = spirv_data));
}
/*for instruction in doc.instructions.iter() {
match instruction {
&parse::Instruction::Variable { result_type_id, result_id, ref storage_class, .. } => {
match *storage_class {
@ -31,7 +50,7 @@ pub fn reflect<R>(mut spirv: R) -> Result<String, Error>
},
_ => ()
}
}
}*/
Ok(output)
}