mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 16:25:31 +00:00
Some work on build output
This commit is contained in:
parent
466dffd48f
commit
c7a19a1cff
@ -5,12 +5,13 @@ fn main() {
|
|||||||
let shader = r#"
|
let shader = r#"
|
||||||
#version 450
|
#version 450
|
||||||
|
|
||||||
uniform vec4 u_test;
|
uniform sampler2D u_texture;
|
||||||
|
|
||||||
vec4 f_color;
|
in vec2 v_texcoords;
|
||||||
|
out vec4 f_color;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
f_color = u_test;
|
f_color = texture(u_texture, v_texcoords);
|
||||||
}
|
}
|
||||||
|
|
||||||
"#;
|
"#;
|
||||||
|
@ -16,7 +16,26 @@ pub fn reflect<R>(mut spirv: R) -> Result<String, Error>
|
|||||||
|
|
||||||
let mut output = String::new();
|
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 {
|
match instruction {
|
||||||
&parse::Instruction::Variable { result_type_id, result_id, ref storage_class, .. } => {
|
&parse::Instruction::Variable { result_type_id, result_id, ref storage_class, .. } => {
|
||||||
match *storage_class {
|
match *storage_class {
|
||||||
@ -31,7 +50,7 @@ pub fn reflect<R>(mut spirv: R) -> Result<String, Error>
|
|||||||
},
|
},
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
Ok(output)
|
Ok(output)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user