From 2f062f2a43d8c4f3f77ccc62b63b78372a4877e4 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:11:35 +0100 Subject: [PATCH] Fix incorrect wgpu mixing --- vello/src/lib.rs | 16 +++++++++------- vello_encoding/src/estimate.rs | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/vello/src/lib.rs b/vello/src/lib.rs index 86d7a4ced..04660215f 100644 --- a/vello/src/lib.rs +++ b/vello/src/lib.rs @@ -89,10 +89,12 @@ mod shaders; mod wgpu_engine; #[cfg(feature = "wgpu")] -use std::num::NonZeroUsize; -use std::sync::{ - atomic::{AtomicBool, Ordering}, - Arc, +use std::{ + num::NonZeroUsize, + sync::{ + atomic::{AtomicBool, Ordering}, + Arc, + }, }; /// Styling and composition primitives. @@ -124,7 +126,6 @@ pub use shaders::FullShaders; #[cfg(feature = "wgpu")] use vello_encoding::Resolver; -use wgpu::SubmissionIndex; #[cfg(feature = "wgpu")] use wgpu_engine::{ExternalResource, WgpuEngine}; @@ -132,8 +133,8 @@ use wgpu_engine::{ExternalResource, WgpuEngine}; pub use vello_encoding::BumpAllocators; #[cfg(feature = "wgpu")] use wgpu::{ - Buffer, BufferUsages, Device, PipelineCompilationOptions, Queue, SurfaceTexture, TextureFormat, - TextureView, + Buffer, BufferUsages, Device, PipelineCompilationOptions, Queue, SubmissionIndex, + SurfaceTexture, TextureFormat, TextureView, }; #[cfg(all(feature = "wgpu", feature = "wgpu-profiler"))] use wgpu_profiler::{GpuProfiler, GpuProfilerSettings}; @@ -239,6 +240,7 @@ pub enum Error { #[allow(dead_code)] // this can be unused when wgpu feature is not used pub(crate) type Result = std::result::Result; +#[cfg(feature = "wgpu")] type BumpSubmission = (SubmissionIndex, Buffer, Arc); /// Renders a scene into a texture or surface. diff --git a/vello_encoding/src/estimate.rs b/vello_encoding/src/estimate.rs index 6d1e87008..c36497d11 100644 --- a/vello_encoding/src/estimate.rs +++ b/vello_encoding/src/estimate.rs @@ -4,7 +4,7 @@ //! This utility provides conservative size estimation for buffer allocations backing //! GPU bump memory. This estimate relies on heuristics and naturally overestimates. -use super::{BumpAllocatorMemory, BumpAllocators, Transform}; +use super::{BumpAllocators, Transform}; use peniko::kurbo::{Cap, Join, PathEl, Point, Stroke, Vec2}; const RSQRT_OF_TOL: f64 = 2.2360679775; // tol = 0.2