From 456095d02616d5767e0253d9e7f9a6b547909ba6 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 3 Oct 2024 11:10:50 +0100 Subject: [PATCH] Correctly gate imports and remove some more useless imports --- examples/headless/src/main.rs | 2 +- examples/simple_sdl2/src/main.rs | 2 +- examples/with_winit/src/lib.rs | 2 +- vello/src/lib.rs | 43 +++++++++++++------------------- vello_tests/src/lib.rs | 2 +- 5 files changed, 22 insertions(+), 29 deletions(-) diff --git a/examples/headless/src/main.rs b/examples/headless/src/main.rs index 3866b2e0..cc681d06 100644 --- a/examples/headless/src/main.rs +++ b/examples/headless/src/main.rs @@ -14,7 +14,7 @@ use vello::wgpu::{ self, BufferDescriptor, BufferUsages, CommandEncoderDescriptor, Extent3d, ImageCopyBuffer, TextureDescriptor, TextureFormat, TextureUsages, }; -use vello::{block_on_wgpu, RendererOptions, Scene}; +use vello::{util::block_on_wgpu, RendererOptions, Scene}; fn main() -> Result<()> { #[cfg(not(target_arch = "wasm32"))] diff --git a/examples/simple_sdl2/src/main.rs b/examples/simple_sdl2/src/main.rs index 5adacf92..49e13e02 100644 --- a/examples/simple_sdl2/src/main.rs +++ b/examples/simple_sdl2/src/main.rs @@ -16,7 +16,7 @@ use std::num::NonZeroUsize; use vello::kurbo::{Affine, Circle, Ellipse, Line, RoundedRect, Stroke}; use vello::peniko::Color; use vello::util::{RenderContext, RenderSurface}; -use vello::{AaConfig, DebugLayers, Renderer, RendererOptions, Scene}; +use vello::{low_level::DebugLayers, AaConfig, Renderer, RendererOptions, Scene}; use vello::wgpu; diff --git a/examples/with_winit/src/lib.rs b/examples/with_winit/src/lib.rs index f027ff2d..3d2aebeb 100644 --- a/examples/with_winit/src/lib.rs +++ b/examples/with_winit/src/lib.rs @@ -548,7 +548,7 @@ impl<'s> ApplicationHandler for VelloApp<'s> { // it requires more async wiring for the readback. See // [#gpu > async on wasm](https://xi.zulipchat.com/#narrow/stream/197075-gpu/topic/async.20on.20wasm) if self.async_pipeline && cfg!(not(target_arch = "wasm32")) { - self.scene_complexity = vello::block_on_wgpu( + self.scene_complexity = vello::util::block_on_wgpu( &device_handle.device, self.renderers[surface.dev_id] .as_mut() diff --git a/vello/src/lib.rs b/vello/src/lib.rs index c06c0bad..e14d5397 100644 --- a/vello/src/lib.rs +++ b/vello/src/lib.rs @@ -86,35 +86,11 @@ mod recording; mod render; mod scene; mod shaders; -#[cfg(feature = "wgpu")] -mod wgpu_engine; - -#[cfg(feature = "wgpu")] -use std::{num::NonZeroUsize, sync::Arc}; - -use debug::DebugLayers; -/// Styling and composition primitives. -pub use peniko; -/// 2D geometry, with a focus on curves. -pub use peniko::kurbo; - -use recording::{BindType, ImageFormat, ImageProxy, Recording, ResourceProxy, ShaderId}; -use render::Render; -use shaders::FullShaders; -pub use skrifa; -use vello_encoding::BumpAllocators; -pub use vello_encoding::Glyph; - -#[cfg(feature = "wgpu")] -pub use wgpu; #[cfg(feature = "wgpu")] pub mod util; - -pub use scene::{DrawGlyphs, Scene}; -use thiserror::Error; #[cfg(feature = "wgpu")] -pub use util::block_on_wgpu; +mod wgpu_engine; pub mod low_level { //! Utilities which can be used to create an alternative Vello renderer to [`Renderer`][crate::Renderer]. @@ -131,7 +107,24 @@ pub mod low_level { /// Temporary export, used in `with_winit` for stats pub use vello_encoding::BumpAllocators; } +/// Styling and composition primitives. +pub use peniko; +/// 2D geometry, with a focus on curves. +pub use peniko::kurbo; +pub use skrifa; + +#[cfg(feature = "wgpu")] +pub use wgpu; +pub use scene::{DrawGlyphs, Scene}; +pub use vello_encoding::Glyph; + +use debug::DebugLayers; +use low_level::*; +use thiserror::Error; + +#[cfg(feature = "wgpu")] +use std::{num::NonZeroUsize, sync::Arc}; #[cfg(feature = "wgpu")] use vello_encoding::Resolver; #[cfg(feature = "wgpu")] diff --git a/vello_tests/src/lib.rs b/vello_tests/src/lib.rs index d5bf2013..727ac3a6 100644 --- a/vello_tests/src/lib.rs +++ b/vello_tests/src/lib.rs @@ -17,7 +17,7 @@ use vello::wgpu::{ self, BufferDescriptor, BufferUsages, CommandEncoderDescriptor, Extent3d, ImageCopyBuffer, TextureDescriptor, TextureFormat, TextureUsages, }; -use vello::{block_on_wgpu, util::RenderContext, AaConfig, RendererOptions, Scene}; +use vello::{util::block_on_wgpu, util::RenderContext, AaConfig, RendererOptions, Scene}; mod compare; mod snapshot;