From 159f8360fac72ed69e2bfcbada1e46621a791fbb Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 19 Jun 2024 11:26:26 +0200 Subject: [PATCH] Fix doclinks in egui-wgpu docs (#4677) --- crates/egui-wgpu/src/lib.rs | 2 +- crates/egui-wgpu/src/renderer.rs | 34 +++++++++++++++----------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/crates/egui-wgpu/src/lib.rs b/crates/egui-wgpu/src/lib.rs index 78def51db..118f24654 100644 --- a/crates/egui-wgpu/src/lib.rs +++ b/crates/egui-wgpu/src/lib.rs @@ -80,7 +80,7 @@ pub struct RenderState { } impl RenderState { - /// Creates a new `RenderState`, containing everything needed for drawing egui with wgpu. + /// Creates a new [`RenderState`], containing everything needed for drawing egui with wgpu. /// /// # Errors /// Wgpu initialization may fail due to incompatible hardware or driver for a given config. diff --git a/crates/egui-wgpu/src/renderer.rs b/crates/egui-wgpu/src/renderer.rs index a4bc8809c..18e13a89c 100644 --- a/crates/egui-wgpu/src/renderer.rs +++ b/crates/egui-wgpu/src/renderer.rs @@ -10,7 +10,7 @@ use wgpu::util::DeviceExt as _; /// You can use this for storage when implementing [`CallbackTrait`]. pub type CallbackResources = type_map::concurrent::TypeMap; -/// You can use this to do custom `wgpu` rendering in an egui app. +/// You can use this to do custom [`wgpu`] rendering in an egui app. /// /// Implement [`CallbackTrait`] and call [`Callback::new_paint_callback`]. /// @@ -50,7 +50,7 @@ impl Callback { /// /// ## Command Encoder /// -/// The passed-in `CommandEncoder` is egui's and can be used directly to register +/// The passed-in [`wgpu::CommandEncoder`] is egui's and can be used directly to register /// wgpu commands for simple use cases. /// This allows reusing the same [`wgpu::CommandEncoder`] for all callbacks and egui /// rendering itself. @@ -58,7 +58,7 @@ impl Callback { /// ## Command Buffers /// /// For more complicated use cases, one can also return a list of arbitrary -/// `CommandBuffer`s and have complete control over how they get created and fed. +/// [`wgpu::CommandBuffer`]s and have complete control over how they get created and fed. /// In particular, this gives an opportunity to parallelize command registration and /// prevents a faulty callback from poisoning the main wgpu pipeline. /// @@ -498,7 +498,7 @@ impl Renderer { render_pass.set_scissor_rect(0, 0, size_in_pixels[0], size_in_pixels[1]); } - /// Should be called before `render()`. + /// Should be called before [`Self::render`]. pub fn update_texture( &mut self, device: &wgpu::Device, @@ -631,12 +631,11 @@ impl Renderer { self.textures.get(id) } - /// Registers a `wgpu::Texture` with a `epaint::TextureId`. + /// Registers a [`wgpu::Texture`] with a [`epaint::TextureId`]. /// /// This enables the application to reference the texture inside an image ui element. /// This effectively enables off-screen rendering inside the egui UI. Texture must have - /// the texture format `TextureFormat::Rgba8UnormSrgb` and - /// Texture usage `TextureUsage::SAMPLED`. + /// the texture format [`wgpu::TextureFormat::Rgba8UnormSrgb`]. pub fn register_native_texture( &mut self, device: &wgpu::Device, @@ -655,9 +654,9 @@ impl Renderer { ) } - /// Registers a `wgpu::Texture` with an existing `epaint::TextureId`. + /// Registers a [`wgpu::Texture`] with an existing [`epaint::TextureId`]. /// - /// This enables applications to reuse `TextureId`s. + /// This enables applications to reuse [`epaint::TextureId`]s. pub fn update_egui_texture_from_wgpu_texture( &mut self, device: &wgpu::Device, @@ -678,15 +677,14 @@ impl Renderer { ); } - /// Registers a `wgpu::Texture` with a `epaint::TextureId` while also accepting custom - /// `wgpu::SamplerDescriptor` options. + /// Registers a [`wgpu::Texture`] with a [`epaint::TextureId`] while also accepting custom + /// [`wgpu::SamplerDescriptor`] options. /// /// This allows applications to specify individual minification/magnification filters as well as /// custom mipmap and tiling options. /// - /// The `Texture` must have the format `TextureFormat::Rgba8UnormSrgb` and usage - /// `TextureUsage::SAMPLED`. Any compare function supplied in the `SamplerDescriptor` will be - /// ignored. + /// The texture must have the format [`wgpu::TextureFormat::Rgba8UnormSrgb`]. + /// Any compare function supplied in the [`wgpu::SamplerDescriptor`] will be ignored. #[allow(clippy::needless_pass_by_value)] // false positive pub fn register_native_texture_with_sampler_options( &mut self, @@ -723,10 +721,10 @@ impl Renderer { id } - /// Registers a `wgpu::Texture` with an existing `epaint::TextureId` while also accepting custom - /// `wgpu::SamplerDescriptor` options. + /// Registers a [`wgpu::Texture`] with an existing [`epaint::TextureId`] while also accepting custom + /// [`wgpu::SamplerDescriptor`] options. /// - /// This allows applications to reuse `TextureId`s created with custom sampler options. + /// This allows applications to reuse [`epaint::TextureId`]s created with custom sampler options. #[allow(clippy::needless_pass_by_value)] // false positive pub fn update_egui_texture_from_wgpu_texture_with_sampler_options( &mut self, @@ -766,7 +764,7 @@ impl Renderer { } /// Uploads the uniform, vertex and index data used by the renderer. - /// Should be called before `render()`. + /// Should be called before [`Self::render`]. /// /// Returns all user-defined command buffers gathered from [`CallbackTrait::prepare`] & [`CallbackTrait::finish_prepare`] callbacks. pub fn update_buffers(