Skip to content

Commit

Permalink
Fix doc_markdown lints in bevy_render (#3479)
Browse files Browse the repository at this point in the history
#3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time.

This PR fixes lints in the `bevy_render` crate.
  • Loading branch information
mfdorst committed Jan 9, 2022
1 parent 6f167aa commit e566853
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_render/src/color/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ impl Color {
}
}

/// Converts a `Color` to a `[f32; 4]` from sRBG colorspace
/// Converts a `Color` to a `[f32; 4]` from sRGB colorspace
pub fn as_rgba_f32(self: Color) -> [f32; 4] {
match self {
Color::Rgba {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/mesh/mesh/conversions.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! These implementations allow you to
//! convert std::vec::Vec<T> to VertexAttributeValues::T and back.
//! convert `std::vec::Vec<T>` to `VertexAttributeValues::T` and back.
//!
//! # Examples
//!
Expand Down
14 changes: 7 additions & 7 deletions crates/bevy_render/src/mesh/mesh/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ impl Mesh {
/// Per vertex joint transform matrix index. Use in conjunction with [`Mesh::set_attribute`]
pub const ATTRIBUTE_JOINT_INDEX: &'static str = "Vertex_JointIndex";

/// Construct a new mesh. You need to provide a PrimitiveTopology so that the
/// Construct a new mesh. You need to provide a [`PrimitiveTopology`] so that the
/// renderer knows how to treat the vertex data. Most of the time this will be
/// `PrimitiveTopology::TriangleList`.
/// [`PrimitiveTopology::TriangleList`].
pub fn new(primitive_topology: PrimitiveTopology) -> Self {
Mesh {
primitive_topology,
Expand Down Expand Up @@ -269,7 +269,7 @@ impl Mesh {
///
/// # Panics
/// Panics if [`Indices`] are set or [`Mesh::ATTRIBUTE_POSITION`] is not of type `float3`.
/// Consider calling [Mesh::duplicate_vertices] or export your mesh with normal attributes.
/// Consider calling [`Mesh::duplicate_vertices`] or export your mesh with normal attributes.
pub fn compute_flat_normals(&mut self) {
if self.indices().is_some() {
panic!("`compute_flat_normals` can't work on indexed geometry. Consider calling `Mesh::duplicate_vertices`.");
Expand Down Expand Up @@ -404,8 +404,8 @@ pub enum VertexAttributeValues {
}

impl VertexAttributeValues {
/// Returns the number of vertices in this VertexAttribute. For a single
/// mesh, all of the VertexAttributeValues must have the same length.
/// Returns the number of vertices in this [`VertexAttributeValues`]. For a single
/// mesh, all of the [`VertexAttributeValues`] must have the same length.
pub fn len(&self) -> usize {
match *self {
VertexAttributeValues::Float32(ref values) => values.len(),
Expand Down Expand Up @@ -439,7 +439,7 @@ impl VertexAttributeValues {
}
}

/// Returns `true` if there are no vertices in this VertexAttributeValue.
/// Returns `true` if there are no vertices in this [`VertexAttributeValues`].
pub fn is_empty(&self) -> bool {
self.len() == 0
}
Expand All @@ -453,7 +453,7 @@ impl VertexAttributeValues {
}

// TODO: add vertex format as parameter here and perform type conversions
/// Flattens the VertexAttributeArray into a sequence of bytes. This is
/// Flattens the [`VertexAttributeValues`] into a sequence of bytes. This is
/// useful for serialization and sending to the GPU.
pub fn get_bytes(&self) -> &[u8] {
match self {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/render_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub trait RenderAsset: Asset {
/// The GPU-representation of the the asset.
type PreparedAsset: Send + Sync + 'static;
/// Specifies all ECS data required by [`RenderAsset::prepare_asset`].
/// For convenience use the [`lifetimeless`](bevy_ecs::system::lifetimeless) SystemParams.
/// For convenience use the [`lifetimeless`](bevy_ecs::system::lifetimeless) [`SystemParam`].
type Param: SystemParam;
/// Converts the asset into a [`RenderAsset::ExtractedAsset`].
fn extract_asset(&self) -> Self::ExtractedAsset;
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_render/src/render_graph/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use super::NodeId;
/// They are used to describe the ordering (which node has to run first)
/// and may be of two kinds: [`NodeEdge`](Self::NodeEdge) and [`SlotEdge`](Self::SlotEdge).
///
/// Edges are added via the render_graph::add_node_edge(output_node, input_node) and the
/// render_graph::add_slot_edge(output_node, output_slot, input_node, input_slot) methods.
/// Edges are added via the `render_graph::add_node_edge(output_node, input_node)` and the
/// `render_graph::add_slot_edge(output_node, output_slot, input_node, input_slot)` methods.
///
/// The former simply states that the `output_node` has to be run before the `input_node`,
/// while the later connects an output slot of the `output_node`
Expand All @@ -32,15 +32,15 @@ pub enum Edge {
}

impl Edge {
/// Returns the id of the 'input_node'.
/// Returns the id of the `input_node`.
pub fn get_input_node(&self) -> NodeId {
match self {
Edge::SlotEdge { input_node, .. } => *input_node,
Edge::NodeEdge { input_node, .. } => *input_node,
}
}

/// Returns the id of the 'output_node'.
/// Returns the id of the `output_node`.
pub fn get_output_node(&self) -> NodeId {
match self {
Edge::SlotEdge { output_node, .. } => *output_node,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/render_graph/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl NodeId {
///
/// Nodes are the fundamental part of the graph and used to extend its functionality, by
/// generating draw calls and/or running subgraphs.
/// They are added via the render_graph::add_node(my_node) methode.
/// They are added via the `render_graph::add_node(my_node)` method.
///
/// To determine their position in the graph and ensure that all required dependencies (inputs)
/// are already executed, [`Edges`](Edge) are used.
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/render_graph/node_slot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::borrow::Cow;
use crate::render_resource::{Buffer, Sampler, TextureView};

/// A value passed between render [`Nodes`](super::Node).
/// Corresponds to the [SlotType] specified in the [`RenderGraph`](super::RenderGraph).
/// Corresponds to the [`SlotType`] specified in the [`RenderGraph`](super::RenderGraph).
///
/// Slots can have four different types of values:
/// [`Buffer`], [`TextureView`], [`Sampler`] and [`Entity`].
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/render_phase/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl<P: PhaseItem> DrawFunctions<P> {
}
}

/// RenderCommand is a trait that runs an ECS query and produces one or more
/// [`RenderCommand`] is a trait that runs an ECS query and produces one or more
/// [`TrackedRenderPass`] calls. Types implementing this trait can be composed (as tuples).
///
/// They can be registered as a [`Draw`] function via the
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/render_phase/draw_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ impl<'a> TrackedRenderPass<'a> {

/// Set push constant data.
///
/// Features::PUSH_CONSTANTS must be enabled on the device in order to call these functions.
/// `Features::PUSH_CONSTANTS` must be enabled on the device in order to call these functions.
pub fn set_push_constants(&mut self, stages: ShaderStages, offset: u32, data: &[u8]) {
trace!(
"set push constants: {:?} offset: {} data.len: {}",
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_render/src/render_resource/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use wgpu::{
#[derive(Copy, Clone, Hash, Eq, PartialEq, Debug)]
pub struct RenderPipelineId(Uuid);

/// A RenderPipeline represents a graphics pipeline and its stages (shaders), bindings and vertex buffers.
/// A [`RenderPipeline`] represents a graphics pipeline and its stages (shaders), bindings and vertex buffers.
///
/// May be converted from and dereferences to a wgpu [`RenderPipeline`](wgpu::RenderPipeline).
/// Can be created via [`RenderDevice::create_render_pipeline`](crate::renderer::RenderDevice::create_render_pipeline).
Expand Down Expand Up @@ -50,7 +50,7 @@ impl Deref for RenderPipeline {
#[derive(Copy, Clone, Hash, Eq, PartialEq, Debug)]
pub struct ComputePipelineId(Uuid);

/// A ComputePipeline represents a compute pipeline and its single shader stage.
/// A [`ComputePipeline`] represents a compute pipeline and its single shader stage.
///
/// May be converted from and dereferences to a wgpu [`ComputePipeline`](wgpu::ComputePipeline).
/// Can be created via [`RenderDevice::create_compute_pipeline`](crate::renderer::RenderDevice::create_compute_pipeline).
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/render_resource/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl Deref for Texture {
pub struct TextureViewId(Uuid);

/// This type combines wgpu's [`TextureView`](wgpu::TextureView) and
/// [SurfaceTexture`](wgpu::SurfaceTexture) into the same interface.
/// [`SurfaceTexture`](wgpu::SurfaceTexture) into the same interface.
#[derive(Clone, Debug)]
pub enum TextureViewValue {
/// The value is an actual wgpu [`TextureView`](wgpu::TextureView).
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/renderer/render_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl RenderDevice {
self.device.limits()
}

/// Creates a [ShaderModule](wgpu::ShaderModule) from either SPIR-V or WGSL source code.
/// Creates a [`ShaderModule`](wgpu::ShaderModule) from either SPIR-V or WGSL source code.
#[inline]
pub fn create_shader_module(&self, desc: &wgpu::ShaderModuleDescriptor) -> wgpu::ShaderModule {
self.device.create_shader_module(desc)
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/texture/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl Image {
}

/// Load a bytes buffer in a [`Texture`], according to type `image_type`, using the `image`
/// crate`
/// crate
pub fn from_buffer(buffer: &[u8], image_type: ImageType) -> Result<Image, TextureError> {
let format = match image_type {
ImageType::MimeType(mime_type) => match mime_type {
Expand Down

0 comments on commit e566853

Please sign in to comment.