Avoid allocation for spirv shaders

This commit is contained in:
maik 2019-06-23 12:34:47 +02:00
parent 1b75f9eb5d
commit 13398b0127
2 changed files with 4 additions and 7 deletions

View file

@ -544,10 +544,8 @@ fn main() {
];
base.device.update_descriptor_sets(&write_desc_sets, &[]);
let mut vertex_spv_file =
Cursor::new(include_bytes!("../../shader/texture/vert.spv").to_vec());
let mut frag_spv_file =
Cursor::new(include_bytes!("../../shader/texture/frag.spv").to_vec());
let mut vertex_spv_file = Cursor::new(&include_bytes!("../../shader/texture/vert.spv")[..]);
let mut frag_spv_file = Cursor::new(&include_bytes!("../../shader/texture/frag.spv")[..]);
let vertex_code =
read_spv(&mut vertex_spv_file).expect("Failed to read vertex shader spv file");

View file

@ -199,9 +199,8 @@ fn main() {
.bind_buffer_memory(vertex_input_buffer, vertex_input_buffer_memory, 0)
.unwrap();
let mut vertex_spv_file =
Cursor::new(include_bytes!("../../shader/triangle/vert.spv").to_vec());
let mut frag_spv_file =
Cursor::new(include_bytes!("../../shader/triangle/frag.spv").to_vec());
Cursor::new(&include_bytes!("../../shader/triangle/vert.spv")[..]);
let mut frag_spv_file = Cursor::new(&include_bytes!("../../shader/triangle/frag.spv")[..]);
let vertex_code =
read_spv(&mut vertex_spv_file).expect("Failed to read vertex shader spv file");