From c27f74355876e85981db3cfe9d8e632f17dc95f8 Mon Sep 17 00:00:00 2001 From: Alphyr <47725341+a1phyr@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:27:03 +0100 Subject: [PATCH] Avoid a clone when creating a Glsl shader (#5118) --- CHANGELOG.md | 1 + wgpu/src/backend/wgpu_core.rs | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c096556e0d..b7012833c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,6 +84,7 @@ Bottom level categories: - Fix performance regression when allocating a large amount of resources of the same type. By @nical in [#5229](https://github.com/gfx-rs/wgpu/pull/5229) - Fix docs.rs wasm32 builds. By @cwfitzgerald in [#5310](https://github.com/gfx-rs/wgpu/pull/5310) - Improve error message when binding count limit hit. By @hackaugusto in [#5298](https://github.com/gfx-rs/wgpu/pull/5298) +- Remove an unnecessary `clone` during GLSL shader injestion. By @a1phyr in [#5118](https://github.com/gfx-rs/wgpu/pull/5118). #### DX12 - Fix `panic!` when dropping `Instance` without `InstanceFlags::VALIDATION`. By @hakolao in [#5134](https://github.com/gfx-rs/wgpu/pull/5134) diff --git a/wgpu/src/backend/wgpu_core.rs b/wgpu/src/backend/wgpu_core.rs index 1d4139e73f..ddc133dd1e 100644 --- a/wgpu/src/backend/wgpu_core.rs +++ b/wgpu/src/backend/wgpu_core.rs @@ -852,13 +852,10 @@ impl crate::Context for ContextWgpuCore { ShaderSource::Glsl { ref shader, stage, - ref defines, + defines, } => { // Parse the given shader code and store its representation. - let options = naga::front::glsl::Options { - stage, - defines: defines.clone(), - }; + let options = naga::front::glsl::Options { stage, defines }; let mut parser = naga::front::glsl::Frontend::default(); let module = parser.parse(&options, shader).unwrap();