From 217e06662683d4377ad475f20f1af3757b52996a Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 5 Feb 2024 15:12:59 +0100 Subject: [PATCH] Make `egui_wgpu::renderer` a private module (#3979) All its contents is exported to the top-level --- crates/eframe/src/web/web_painter_wgpu.rs | 4 ++-- crates/egui-wgpu/src/lib.rs | 8 ++++---- crates/egui-wgpu/src/renderer.rs | 1 - crates/egui-wgpu/src/winit.rs | 2 +- crates/egui_demo_app/src/apps/custom3d_wgpu.rs | 4 ++-- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/crates/eframe/src/web/web_painter_wgpu.rs b/crates/eframe/src/web/web_painter_wgpu.rs index 0ec0f8239d1..857a1f5404c 100644 --- a/crates/eframe/src/web/web_painter_wgpu.rs +++ b/crates/eframe/src/web/web_painter_wgpu.rs @@ -7,7 +7,7 @@ use raw_window_handle::{ use wasm_bindgen::JsValue; use web_sys::HtmlCanvasElement; -use egui_wgpu::{renderer::ScreenDescriptor, RenderState, SurfaceErrorAction}; +use egui_wgpu::{RenderState, SurfaceErrorAction}; use crate::WebOptions; @@ -233,7 +233,7 @@ impl WebPainter for WebPainterWgpu { }); // Upload all resources for the GPU. - let screen_descriptor = ScreenDescriptor { + let screen_descriptor = egui_wgpu::ScreenDescriptor { size_in_pixels, pixels_per_point, }; diff --git a/crates/egui-wgpu/src/lib.rs b/crates/egui-wgpu/src/lib.rs index bb696aa28df..78def51dbb0 100644 --- a/crates/egui-wgpu/src/lib.rs +++ b/crates/egui-wgpu/src/lib.rs @@ -3,7 +3,7 @@ //! If you're targeting WebGL you also need to turn on the //! `webgl` feature of the `wgpu` crate: //! -//! ```ignore +//! ```toml //! # Enable both WebGL and WebGPU backends on web. //! wgpu = { version = "*", features = ["webgpu", "webgl"] } //! ``` @@ -21,9 +21,9 @@ pub use wgpu; /// Low-level painting of [`egui`](https://github.com/emilk/egui) on [`wgpu`]. -pub mod renderer; -pub use renderer::Renderer; -pub use renderer::{Callback, CallbackResources, CallbackTrait}; +mod renderer; + +pub use renderer::*; /// Module for painting [`egui`](https://github.com/emilk/egui) with [`wgpu`] on [`winit`]. #[cfg(feature = "winit")] diff --git a/crates/egui-wgpu/src/renderer.rs b/crates/egui-wgpu/src/renderer.rs index 5f5452bdeff..058ce928768 100644 --- a/crates/egui-wgpu/src/renderer.rs +++ b/crates/egui-wgpu/src/renderer.rs @@ -4,7 +4,6 @@ use std::{borrow::Cow, num::NonZeroU64, ops::Range}; use epaint::{ahash::HashMap, emath::NumExt, PaintCallbackInfo, Primitive, Vertex}; -use wgpu; use wgpu::util::DeviceExt as _; /// You can use this for storage when implementing [`CallbackTrait`]. diff --git a/crates/egui-wgpu/src/winit.rs b/crates/egui-wgpu/src/winit.rs index 12e8e25ad06..07c917155aa 100644 --- a/crates/egui-wgpu/src/winit.rs +++ b/crates/egui-wgpu/src/winit.rs @@ -73,7 +73,7 @@ impl BufferPadding { /// Everything you need to paint egui with [`wgpu`] on [`winit`]. /// -/// Alternatively you can use [`crate::renderer`] directly. +/// Alternatively you can use [`crate::Renderer`] directly. /// /// NOTE: all egui viewports share the same painter. pub struct Painter { diff --git a/crates/egui_demo_app/src/apps/custom3d_wgpu.rs b/crates/egui_demo_app/src/apps/custom3d_wgpu.rs index 24fb970d5f8..6b748cb1d74 100644 --- a/crates/egui_demo_app/src/apps/custom3d_wgpu.rs +++ b/crates/egui_demo_app/src/apps/custom3d_wgpu.rs @@ -2,7 +2,7 @@ use std::num::NonZeroU64; use eframe::{ egui_wgpu::wgpu::util::DeviceExt, - egui_wgpu::{self, renderer::ScreenDescriptor, wgpu}, + egui_wgpu::{self, wgpu}, }; pub struct Custom3d { @@ -148,7 +148,7 @@ impl egui_wgpu::CallbackTrait for CustomTriangleCallback { &self, device: &wgpu::Device, queue: &wgpu::Queue, - _screen_descriptor: &ScreenDescriptor, + _screen_descriptor: &egui_wgpu::ScreenDescriptor, _egui_encoder: &mut wgpu::CommandEncoder, resources: &mut egui_wgpu::CallbackResources, ) -> Vec {