Rewrite all doc comments to wrap at 100 characters (was 80)

This commit is contained in:
Jay Oster 2019-10-02 01:07:11 -07:00
parent 70306c5cfd
commit 38ce5c186d
2 changed files with 25 additions and 35 deletions

View file

@ -1,15 +1,13 @@
//! A tiny library providing a GPU-powered pixel pixel buffer. //! A tiny library providing a GPU-powered pixel pixel buffer.
//! //!
//! [`Pixels`] represents a 2D pixel buffer with an explicit image resolution, //! [`Pixels`] represents a 2D pixel buffer with an explicit image resolution, making it ideal for
//! making it ideal for prototyping simple pixel-based games, animations, and //! prototyping simple pixel-based games, animations, and emulators. The pixel buffer is rendered
//! emulators. The pixel buffer is rendered entirely on the GPU, allowing //! entirely on the GPU, allowing developers to easily incorporate special effects with shaders and
//! developers to easily incorporate special effects with shaders and a //! a customizable pipeline.
//! customizable pipeline.
//! //!
//! The GPU interface is offered by [`wgpu`](https://crates.io/crates/wgpu), and //! The GPU interface is offered by [`wgpu`](https://crates.io/crates/wgpu), and is re-exported for
//! is re-exported for your convenience. Use a windowing framework or context //! your convenience. Use a windowing framework or context manager of your choice;
//! manager of your choice; [`winit`](https://crates.io/crates/winit) is a good //! [`winit`](https://crates.io/crates/winit) is a good place to start.
//! place to start.
use std::error::Error as StdError; use std::error::Error as StdError;
use std::fmt; use std::fmt;
@ -67,9 +65,8 @@ pub enum Error {
impl<'a> SurfaceTexture<'a> { impl<'a> SurfaceTexture<'a> {
/// Create a logical texture for a window surface. /// Create a logical texture for a window surface.
/// ///
/// It is recommended (but not required) that the `width` and `height` are /// It is recommended (but not required) that the `width` and `height` are equivalent to the
/// equivalent to the physical dimentions of the `surface`. E.g. scaled by /// physical dimentions of the `surface`. E.g. scaled by the HiDPI factor.
/// the HiDPI factor.
/// ///
/// # Examples /// # Examples
/// ///
@ -225,8 +222,8 @@ impl<'a> PixelsBuilder<'a> {
/// Set the pixel aspect ratio to simulate non-square pixels. /// Set the pixel aspect ratio to simulate non-square pixels.
/// ///
/// This setting enables a render pass that horizontally scales the pixel /// This setting enables a render pass that horizontally scales the pixel buffer by the given
/// buffer by the given factor. /// factor.
/// ///
/// E.g. set this to `8.0 / 7.0` for an 8:7 pixel aspect ratio. /// E.g. set this to `8.0 / 7.0` for an 8:7 pixel aspect ratio.
pub fn pixel_aspect_ratio(mut self, pixel_aspect_ratio: f64) -> PixelsBuilder<'a> { pub fn pixel_aspect_ratio(mut self, pixel_aspect_ratio: f64) -> PixelsBuilder<'a> {

View file

@ -2,40 +2,33 @@ use wgpu::TextureView;
/// Objects that implement this trait can be added to [`Pixels`] as a render pass. /// Objects that implement this trait can be added to [`Pixels`] as a render pass.
/// ///
/// [`Pixels`] always has at least one render pass; a scaling pass that uses a /// [`Pixels`] always has at least one render pass; a scaling pass that uses a nearest-neighbor
/// nearest-neighbor sampler to preserve pixel edges. Optionally it may also /// sampler to preserve pixel edges. Optionally it may also have a second scaling pass that
/// have a second scaling pass that transforms the texture to its final size /// transforms the texture to its final size (for non-square pixel aspect ratios). During this
/// (for non-square pixel aspect ratios). During this second pass, the texture /// second pass, the texture is stretched horizontally using a linear sampler.
/// is stretched horizontally using a linear sampler.
/// ///
/// Any additional render passes are executed afterward. /// Any additional render passes are executed afterward.
/// ///
/// Each render pass is configured with one [`wgpu::TextureView`] as an input. /// Each render pass is configured with one [`wgpu::TextureView`] as an input. You will probably
/// You will probably want to create a binding for this `texture_view` so your /// want to create a binding for this `texture_view` so your shaders can sample from it.
/// shaders can sample from it.
/// ///
/// The render pass will also receive a reference to another /// The render pass will also receive a reference to another [`wgpu::TextureView`] when the pass is
/// [`wgpu::TextureView`] when the pass is executed. This texture view is the /// executed. This texture view is the `render_target`.
/// `render_target`.
/// ///
/// [`Pixels`]: ./struct.Pixels.html /// [`Pixels`]: ./struct.Pixels.html
pub trait RenderPass { pub trait RenderPass {
/// The `update_bindings` method will be called when the `texture_view` /// The `update_bindings` method will be called when the `texture_view` needs to be recreated.
/// needs to be recreated.
/// ///
/// It's always called at least once when the default [`Pixels`] render /// It's always called at least once when the default [`Pixels`] render passes are created.
/// passes are created. This can also happen in response to resizing the /// This can also happen in response to resizing the [`SurfaceTexture`].
/// [`SurfaceTexture`].
/// ///
/// You will typically recreate your bindings here to reference the new /// You will typically recreate your bindings here to reference the new input `texture_view`.
/// input `texture_view`.
/// ///
/// [`Pixels`]: ./struct.Pixels.html /// [`Pixels`]: ./struct.Pixels.html
/// [`SurfaceTexture`]: ./struct.SurfaceTexture.html /// [`SurfaceTexture`]: ./struct.SurfaceTexture.html
fn update_bindings(&mut self, texture_view: &TextureView); fn update_bindings(&mut self, texture_view: &TextureView);
/// Called when it is time to execute this render pass. Use the `encoder` to /// Called when it is time to execute this render pass. Use the `encoder` to encode all
/// encode all commands related to this render pass. The result must be /// commands related to this render pass. The result must be stored to the `render_target`.
/// stored to the `render_target`.
fn render_pass(&self, encoder: &mut wgpu::CommandEncoder, render_target: &TextureView); fn render_pass(&self, encoder: &mut wgpu::CommandEncoder, render_target: &TextureView);
} }