Skip to content

Commit 80a4936

Browse files
committed
use futures::lock::Mutex instead of std Mutex
1 parent a621364 commit 80a4936

File tree

1 file changed

+4
-3
lines changed
  • node-graph/wgpu-executor/src

1 file changed

+4
-3
lines changed

node-graph/wgpu-executor/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@ mod context;
33
use anyhow::Result;
44
pub use context::Context;
55
use dyn_any::StaticType;
6+
use futures::lock::Mutex;
67
use glam::UVec2;
78
use graphene_application_io::{ApplicationIo, EditorApi, SurfaceHandle, SurfaceId};
89
use graphene_core::{Color, Ctx};
910
pub use graphene_svg_renderer::RenderContext;
10-
use std::sync::{Arc, Mutex};
11+
use std::sync::Arc;
1112
use vello::{AaConfig, AaSupport, RenderParams, Renderer, RendererOptions, Scene};
1213
use wgpu::util::TextureBlitter;
1314
use wgpu::{Origin3d, SurfaceConfiguration, TextureAspect};
1415

1516
#[derive(dyn_any::DynAny)]
1617
pub struct WgpuExecutor {
1718
pub context: Context,
18-
vello_renderer: futures::lock::Mutex<Renderer>,
19+
vello_renderer: Mutex<Renderer>,
1920
}
2021

2122
impl std::fmt::Debug for WgpuExecutor {
@@ -57,7 +58,7 @@ const VELLO_SURFACE_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Rgba8Unor
5758

5859
impl WgpuExecutor {
5960
pub async fn render_vello_scene(&self, scene: &Scene, surface: &WgpuSurface, size: UVec2, context: &RenderContext, background: Color) -> Result<()> {
60-
let mut guard = surface.surface.target_texture.lock().unwrap();
61+
let mut guard = surface.surface.target_texture.lock().await;
6162
let target_texture = if let Some(target_texture) = &*guard
6263
&& target_texture.size == size
6364
{

0 commit comments

Comments
 (0)