ShaderRenderElement use borrowed Uniforms to minimize copy (#756)
Browse files at this commit1 changed file +4 -4
src/render_helpers/shader_element.rsmodified+4 -4
| @@ -185,7 +185,7 @@ impl ShaderRenderElement { | ||
| 185 | 185 | // Should only be used for visual improvements, i.e. corner radius anti-aliasing. |
| 186 | 186 | scale: f32, |
| 187 | 187 | alpha: f32, |
| 188 | - uniforms: Vec<Uniform<'_>>, | |
| 188 | + additional_uniforms: Vec<Uniform<'static>>, | |
| 189 | 189 | textures: HashMap<String, GlesTexture>, |
| 190 | 190 | kind: Kind, |
| 191 | 191 | ) -> Self { |
| @@ -197,7 +197,7 @@ impl ShaderRenderElement { | ||
| 197 | 197 | opaque_regions: opaque_regions.unwrap_or_default(), |
| 198 | 198 | scale, |
| 199 | 199 | alpha, |
| 200 | - additional_uniforms: uniforms.into_iter().map(|u| u.into_owned()).collect(), | |
| 200 | + additional_uniforms, | |
| 201 | 201 | textures, |
| 202 | 202 | kind, |
| 203 | 203 | } |
| @@ -227,13 +227,13 @@ impl ShaderRenderElement { | ||
| 227 | 227 | size: Size<f64, Logical>, |
| 228 | 228 | opaque_regions: Option<Vec<Rectangle<f64, Logical>>>, |
| 229 | 229 | scale: f32, |
| 230 | - uniforms: Vec<Uniform<'_>>, | |
| 230 | + uniforms: Vec<Uniform<'static>>, | |
| 231 | 231 | textures: HashMap<String, GlesTexture>, |
| 232 | 232 | ) { |
| 233 | 233 | self.area.size = size; |
| 234 | 234 | self.opaque_regions = opaque_regions.unwrap_or_default(); |
| 235 | 235 | self.scale = scale; |
| 236 | - self.additional_uniforms = uniforms.into_iter().map(|u| u.into_owned()).collect(); | |
| 236 | + self.additional_uniforms = uniforms; | |
| 237 | 237 | self.textures = textures; |
| 238 | 238 | |
| 239 | 239 | self.commit_counter.increment(); |