Skip to content

Commit

Permalink
Remove Arc from override_image
Browse files Browse the repository at this point in the history
A gain from wgpu 0.24
  • Loading branch information
DJMcNab committed Jan 28, 2025
1 parent 2f08fe7 commit 480a2e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
9 changes: 3 additions & 6 deletions vello/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,7 @@ use vello_encoding::Resolver;
use wgpu_engine::{ExternalResource, WgpuEngine};

#[cfg(feature = "wgpu")]
use std::{
num::NonZeroUsize,
sync::{atomic::AtomicBool, Arc},
};
use std::{num::NonZeroUsize, sync::atomic::AtomicBool};
#[cfg(feature = "wgpu")]
use wgpu::{Device, Queue, SurfaceTexture, TextureFormat, TextureView};
#[cfg(all(feature = "wgpu", feature = "wgpu-profiler"))]
Expand Down Expand Up @@ -584,8 +581,8 @@ impl Renderer {
pub fn override_image(
&mut self,
image: &peniko::Image,
texture: Option<wgpu::TexelCopyTextureInfoBase<Arc<wgpu::Texture>>>,
) -> Option<wgpu::TexelCopyTextureInfoBase<Arc<wgpu::Texture>>> {
texture: Option<wgpu::TexelCopyTextureInfoBase<wgpu::Texture>>,
) -> Option<wgpu::TexelCopyTextureInfoBase<wgpu::Texture>> {
match texture {
Some(texture) => self.engine.image_overrides.insert(image.data.id(), texture),
None => self.engine.image_overrides.remove(&image.data.id()),
Expand Down
3 changes: 1 addition & 2 deletions vello/src/wgpu_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use std::borrow::Cow;
use std::cell::RefCell;
use std::collections::hash_map::Entry;
use std::collections::{HashMap, HashSet};
use std::sync::Arc;

use vello_shaders::cpu::CpuBinding;

Expand Down Expand Up @@ -41,7 +40,7 @@ pub(crate) struct WgpuEngine {
/// Overrides from a specific `Image::data`'s [`id`](peniko::Blob::id) to a wgpu `Texture`.
///
/// The `Texture` should have the same size as the `Image`.
pub(crate) image_overrides: HashMap<u64, wgpu::TexelCopyTextureInfoBase<Arc<Texture>>>,
pub(crate) image_overrides: HashMap<u64, wgpu::TexelCopyTextureInfoBase<Texture>>,
}

enum PipelineState {
Expand Down

0 comments on commit 480a2e1

Please sign in to comment.