Pass the device by value when loading a shader

This commit is contained in:
tomaka 2017-07-03 16:53:44 +02:00
parent 587ed7ca97
commit d293c6cbcf
5 changed files with 9 additions and 9 deletions

View File

@ -100,7 +100,7 @@ void main() {
struct Dummy;
}
let shader = cs::Shader::load(&device)
let shader = cs::Shader::load(device.clone())
.expect("failed to create shader module");
ComputePipeline::new(device.clone(), &shader.main_entry_point(), &())
.expect("failed to create compute pipeline")

View File

@ -80,8 +80,8 @@ fn main() {
Vertex { position: [ 0.5, 0.5 ] },
].iter().cloned()).expect("failed to create buffer");
let vs = vs::Shader::load(&device).expect("failed to create shader module");
let fs = fs::Shader::load(&device).expect("failed to create shader module");
let vs = vs::Shader::load(device.clone()).expect("failed to create shader module");
let fs = fs::Shader::load(device.clone()).expect("failed to create shader module");
let renderpass = Arc::new(
single_pass_renderpass!(device.clone(),

View File

@ -97,8 +97,8 @@ fn main() {
})
.expect("failed to create buffer");
let vs = vs::Shader::load(&device).expect("failed to create shader module");
let fs = fs::Shader::load(&device).expect("failed to create shader module");
let vs = vs::Shader::load(device.clone()).expect("failed to create shader module");
let fs = fs::Shader::load(device.clone()).expect("failed to create shader module");
let renderpass = Arc::new(
single_pass_renderpass!(device.clone(),

View File

@ -230,8 +230,8 @@ void main() {
struct Dummy;
}
let vs = vs::Shader::load(&device).expect("failed to create shader module");
let fs = fs::Shader::load(&device).expect("failed to create shader module");
let vs = vs::Shader::load(device.clone()).expect("failed to create shader module");
let fs = fs::Shader::load(device.clone()).expect("failed to create shader module");
// At this point, OpenGL initialization would be finished. However in Vulkan it is not. OpenGL
// implicitely does a lot of computation whenever you draw. In Vulkan, you have to do all this

View File

@ -133,7 +133,7 @@ impl {name} {{
/// Loads the shader in Vulkan as a `ShaderModule`.
#[inline]
#[allow(unsafe_code)]
pub fn load(device: &::std::sync::Arc<::vulkano::device::Device>)
pub fn load(device: ::std::sync::Arc<::vulkano::device::Device>)
-> Result<{name}, ::vulkano::OomError>
{{
@ -164,7 +164,7 @@ impl {name} {{
let data = [{spirv_data}];
Ok({name} {{
shader: try!(::vulkano::pipeline::shader::ShaderModule::new(device.clone(), &data))
shader: try!(::vulkano::pipeline::shader::ShaderModule::new(device, &data))
}})
}}
}}