diff --git a/wgpu/examples/boids/main.rs b/wgpu/examples/boids/main.rs index bb19d5066..229e09624 100644 --- a/wgpu/examples/boids/main.rs +++ b/wgpu/examples/boids/main.rs @@ -46,11 +46,11 @@ impl framework::Example for Example { device: &wgpu::Device, _queue: &wgpu::Queue, ) -> Self { - let compute_shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor { + let compute_shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("compute.wgsl"))), }); - let draw_shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor { + let draw_shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("draw.wgsl"))), }); diff --git a/wgpu/examples/bunnymark/main.rs b/wgpu/examples/bunnymark/main.rs index 47fa1d92d..aaf9f50c0 100644 --- a/wgpu/examples/bunnymark/main.rs +++ b/wgpu/examples/bunnymark/main.rs @@ -46,7 +46,7 @@ impl framework::Example for Example { device: &wgpu::Device, queue: &wgpu::Queue, ) -> Self { - let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor { + let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!( "../../../wgpu-hal/examples/halmark/shader.wgsl" diff --git a/wgpu/examples/conservative-raster/main.rs b/wgpu/examples/conservative-raster/main.rs index 20104e35c..7617d508a 100644 --- a/wgpu/examples/conservative-raster/main.rs +++ b/wgpu/examples/conservative-raster/main.rs @@ -85,13 +85,12 @@ impl framework::Example for Example { push_constant_ranges: &[], }); - let shader_triangle_and_lines = - device.create_shader_module(&wgpu::ShaderModuleDescriptor { - label: None, - source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!( - "triangle_and_lines.wgsl" - ))), - }); + let shader_triangle_and_lines = device.create_shader_module(wgpu::ShaderModuleDescriptor { + label: None, + source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!( + "triangle_and_lines.wgsl" + ))), + }); let pipeline_triangle_conservative = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { @@ -197,7 +196,7 @@ impl framework::Example for Example { bind_group_layouts: &[&bind_group_layout], push_constant_ranges: &[], }); - let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor { + let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("upscale.wgsl"))), }); diff --git a/wgpu/examples/cube/main.rs b/wgpu/examples/cube/main.rs index bc180acb1..c03e3f200 100644 --- a/wgpu/examples/cube/main.rs +++ b/wgpu/examples/cube/main.rs @@ -240,7 +240,7 @@ impl framework::Example for Example { label: None, }); - let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor { + let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), }); diff --git a/wgpu/examples/hello-compute/main.rs b/wgpu/examples/hello-compute/main.rs index df157cbfe..3e21ee11b 100644 --- a/wgpu/examples/hello-compute/main.rs +++ b/wgpu/examples/hello-compute/main.rs @@ -69,7 +69,7 @@ async fn execute_gpu_inner( numbers: &[u32], ) -> Option> { // Loads the shader from WGSL - let cs_module = device.create_shader_module(&wgpu::ShaderModuleDescriptor { + let cs_module = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), }); diff --git a/wgpu/examples/hello-triangle/main.rs b/wgpu/examples/hello-triangle/main.rs index 1fc230f79..5fea4c4c0 100644 --- a/wgpu/examples/hello-triangle/main.rs +++ b/wgpu/examples/hello-triangle/main.rs @@ -35,7 +35,7 @@ async fn run(event_loop: EventLoop<()>, window: Window) { .expect("Failed to create device"); // Load the shaders from disk - let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor { + let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), }); diff --git a/wgpu/examples/mipmap/main.rs b/wgpu/examples/mipmap/main.rs index cd31863b8..634528e6e 100644 --- a/wgpu/examples/mipmap/main.rs +++ b/wgpu/examples/mipmap/main.rs @@ -78,7 +78,7 @@ impl Example { query_sets: &Option, mip_count: u32, ) { - let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor { + let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("blit.wgsl"))), }); @@ -272,7 +272,7 @@ impl framework::Example for Example { }); // Create the render pipeline - let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor { + let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("draw.wgsl"))), }); diff --git a/wgpu/examples/msaa-line/main.rs b/wgpu/examples/msaa-line/main.rs index 5178f32a2..8364286c1 100644 --- a/wgpu/examples/msaa-line/main.rs +++ b/wgpu/examples/msaa-line/main.rs @@ -126,7 +126,7 @@ impl framework::Example for Example { log::info!("Press left/right arrow keys to change sample_count."); let sample_count = 4; - let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor { + let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), }); diff --git a/wgpu/examples/shadow/main.rs b/wgpu/examples/shadow/main.rs index f03af8e35..bb8fec5ac 100644 --- a/wgpu/examples/shadow/main.rs +++ b/wgpu/examples/shadow/main.rs @@ -449,7 +449,7 @@ impl framework::Example for Example { attributes: &vertex_attr, }; - let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor { + let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), }); diff --git a/wgpu/examples/skybox/main.rs b/wgpu/examples/skybox/main.rs index 2b8f6d8f9..a44cb7044 100644 --- a/wgpu/examples/skybox/main.rs +++ b/wgpu/examples/skybox/main.rs @@ -170,7 +170,7 @@ impl framework::Example for Skybox { }); // Create the render pipeline - let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor { + let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), }); diff --git a/wgpu/examples/texture-arrays/main.rs b/wgpu/examples/texture-arrays/main.rs index 8c68585cc..d09c28b70 100644 --- a/wgpu/examples/texture-arrays/main.rs +++ b/wgpu/examples/texture-arrays/main.rs @@ -87,7 +87,7 @@ impl framework::Example for Example { queue: &wgpu::Queue, ) -> Self { let mut uniform_workaround = false; - let base_shader_module = device.create_shader_module(&wgpu::include_wgsl!("indexing.wgsl")); + let base_shader_module = device.create_shader_module(wgpu::include_wgsl!("indexing.wgsl")); let env_override = match std::env::var("WGPU_TEXTURE_ARRAY_STYLE") { Ok(value) => match &*value.to_lowercase() { "nonuniform" | "non_uniform" => Some(true), @@ -119,7 +119,7 @@ impl framework::Example for Example { // capabilities even if we don't use it. So for now put it in a separate module. let fragment_shader_module = if !uniform_workaround { non_uniform_shader_module = - device.create_shader_module(&wgpu::include_wgsl!("non_uniform_indexing.wgsl")); + device.create_shader_module(wgpu::include_wgsl!("non_uniform_indexing.wgsl")); &non_uniform_shader_module } else { &base_shader_module diff --git a/wgpu/examples/water/main.rs b/wgpu/examples/water/main.rs index 5667d0567..1b6085144 100644 --- a/wgpu/examples/water/main.rs +++ b/wgpu/examples/water/main.rs @@ -494,11 +494,11 @@ impl framework::Example for Example { }); // Upload/compile them to GPU code. - let terrain_module = device.create_shader_module(&wgpu::ShaderModuleDescriptor { + let terrain_module = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: Some("terrain"), source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("terrain.wgsl"))), }); - let water_module = device.create_shader_module(&wgpu::ShaderModuleDescriptor { + let water_module = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: Some("water"), source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("water.wgsl"))), }); diff --git a/wgpu/src/backend/direct.rs b/wgpu/src/backend/direct.rs index 1f46c461b..eb0d755e1 100644 --- a/wgpu/src/backend/direct.rs +++ b/wgpu/src/backend/direct.rs @@ -1070,7 +1070,7 @@ impl crate::Context for Context { fn device_create_shader_module( &self, device: &Self::DeviceId, - desc: &ShaderModuleDescriptor, + desc: ShaderModuleDescriptor, shader_bound_checks: wgt::ShaderBoundChecks, ) -> Self::ShaderModuleId { let global = &self.0; diff --git a/wgpu/src/backend/web.rs b/wgpu/src/backend/web.rs index 6d3c1b240..e65ee9b4a 100644 --- a/wgpu/src/backend/web.rs +++ b/wgpu/src/backend/web.rs @@ -1251,7 +1251,7 @@ impl crate::Context for Context { fn device_create_shader_module( &self, device: &Self::DeviceId, - desc: &crate::ShaderModuleDescriptor, + desc: crate::ShaderModuleDescriptor, _shader_bound_checks: wgt::ShaderBoundChecks, ) -> Self::ShaderModuleId { let mut descriptor = match desc.source { diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index b6303bf39..f14298c42 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -257,7 +257,7 @@ trait Context: Debug + Send + Sized + Sync { fn device_create_shader_module( &self, device: &Self::DeviceId, - desc: &ShaderModuleDescriptor, + desc: ShaderModuleDescriptor, shader_bound_checks: wgt::ShaderBoundChecks, ) -> Self::ShaderModuleId; unsafe fn device_create_shader_module_spirv( @@ -1971,7 +1971,7 @@ impl Device { } /// Creates a shader module from either SPIR-V or WGSL source code. - pub fn create_shader_module(&self, desc: &ShaderModuleDescriptor) -> ShaderModule { + pub fn create_shader_module(&self, desc: ShaderModuleDescriptor) -> ShaderModule { ShaderModule { context: Arc::clone(&self.context), id: Context::device_create_shader_module( @@ -1995,7 +1995,7 @@ impl Device { /// This has no effect on web. pub unsafe fn create_shader_module_unchecked( &self, - desc: &ShaderModuleDescriptor, + desc: ShaderModuleDescriptor, ) -> ShaderModule { ShaderModule { context: Arc::clone(&self.context), diff --git a/wgpu/tests/shader_primitive_index/mod.rs b/wgpu/tests/shader_primitive_index/mod.rs index a131dab8a..921aa112a 100644 --- a/wgpu/tests/shader_primitive_index/mod.rs +++ b/wgpu/tests/shader_primitive_index/mod.rs @@ -105,7 +105,7 @@ fn pulling_common( ) { let shader = ctx .device - .create_shader_module(&wgpu::include_wgsl!("primitive_index.wgsl")); + .create_shader_module(wgpu::include_wgsl!("primitive_index.wgsl")); let two_triangles_xy: [f32; 12] = [ -1.0, -1.0, 0.0, -1.0, -0.5, 0.0, // left triangle, negative x, negative y diff --git a/wgpu/tests/vertex_indices/mod.rs b/wgpu/tests/vertex_indices/mod.rs index 7c99ca1e2..d59c0a519 100644 --- a/wgpu/tests/vertex_indices/mod.rs +++ b/wgpu/tests/vertex_indices/mod.rs @@ -11,7 +11,7 @@ fn pulling_common( ) { let shader = ctx .device - .create_shader_module(&wgpu::include_wgsl!("draw.vert.wgsl")); + .create_shader_module(wgpu::include_wgsl!("draw.vert.wgsl")); let bgl = ctx .device