Skip to content

Commit

Permalink
Fix doclinks in egui-wgpu docs (emilk#4677)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk authored Jun 19, 2024
1 parent d23742c commit 159f836
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion crates/egui-wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
34 changes: 16 additions & 18 deletions crates/egui-wgpu/src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`].
///
Expand Down Expand Up @@ -50,15 +50,15 @@ 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.
///
/// ## 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.
///
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 159f836

Please sign in to comment.