mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 00:04:15 +00:00
Pass the device by value when loading a shader
This commit is contained in:
parent
587ed7ca97
commit
d293c6cbcf
@ -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")
|
||||
|
@ -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(),
|
||||
|
@ -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(),
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
}})
|
||||
}}
|
||||
}}
|
||||
|
Loading…
Reference in New Issue
Block a user