Rewrite all doc comments to wrap at 100 characters (was 80)
This commit is contained in:
parent
70306c5cfd
commit
38ce5c186d
25
src/lib.rs
25
src/lib.rs
|
@ -1,15 +1,13 @@
|
|||
//! A tiny library providing a GPU-powered pixel pixel buffer.
|
||||
//!
|
||||
//! [`Pixels`] represents a 2D pixel buffer with an explicit image resolution,
|
||||
//! making it ideal for prototyping simple pixel-based games, animations, and
|
||||
//! emulators. The pixel buffer is rendered entirely on the GPU, allowing
|
||||
//! developers to easily incorporate special effects with shaders and a
|
||||
//! customizable pipeline.
|
||||
//! [`Pixels`] represents a 2D pixel buffer with an explicit image resolution, making it ideal for
|
||||
//! prototyping simple pixel-based games, animations, and emulators. The pixel buffer is rendered
|
||||
//! entirely on the GPU, allowing developers to easily incorporate special effects with shaders and
|
||||
//! a customizable pipeline.
|
||||
//!
|
||||
//! The GPU interface is offered by [`wgpu`](https://crates.io/crates/wgpu), and
|
||||
//! is re-exported for your convenience. Use a windowing framework or context
|
||||
//! manager of your choice; [`winit`](https://crates.io/crates/winit) is a good
|
||||
//! place to start.
|
||||
//! The GPU interface is offered by [`wgpu`](https://crates.io/crates/wgpu), and is re-exported for
|
||||
//! your convenience. Use a windowing framework or context manager of your choice;
|
||||
//! [`winit`](https://crates.io/crates/winit) is a good place to start.
|
||||
|
||||
use std::error::Error as StdError;
|
||||
use std::fmt;
|
||||
|
@ -67,9 +65,8 @@ pub enum Error {
|
|||
impl<'a> SurfaceTexture<'a> {
|
||||
/// Create a logical texture for a window surface.
|
||||
///
|
||||
/// It is recommended (but not required) that the `width` and `height` are
|
||||
/// equivalent to the physical dimentions of the `surface`. E.g. scaled by
|
||||
/// the HiDPI factor.
|
||||
/// It is recommended (but not required) that the `width` and `height` are equivalent to the
|
||||
/// physical dimentions of the `surface`. E.g. scaled by the HiDPI factor.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
@ -225,8 +222,8 @@ impl<'a> PixelsBuilder<'a> {
|
|||
|
||||
/// Set the pixel aspect ratio to simulate non-square pixels.
|
||||
///
|
||||
/// This setting enables a render pass that horizontally scales the pixel
|
||||
/// buffer by the given factor.
|
||||
/// This setting enables a render pass that horizontally scales the pixel buffer by the given
|
||||
/// factor.
|
||||
///
|
||||
/// 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> {
|
||||
|
|
|
@ -2,40 +2,33 @@ use wgpu::TextureView;
|
|||
|
||||
/// 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
|
||||
/// nearest-neighbor sampler to preserve pixel edges. Optionally it may also
|
||||
/// have a second scaling pass that transforms the texture to its final size
|
||||
/// (for non-square pixel aspect ratios). During this second pass, the texture
|
||||
/// is stretched horizontally using a linear sampler.
|
||||
/// [`Pixels`] always has at least one render pass; a scaling pass that uses a nearest-neighbor
|
||||
/// sampler to preserve pixel edges. Optionally it may also have a second scaling pass that
|
||||
/// transforms the texture to its final size (for non-square pixel aspect ratios). During this
|
||||
/// second pass, the texture is stretched horizontally using a linear sampler.
|
||||
///
|
||||
/// Any additional render passes are executed afterward.
|
||||
///
|
||||
/// Each render pass is configured with one [`wgpu::TextureView`] as an input.
|
||||
/// You will probably want to create a binding for this `texture_view` so your
|
||||
/// shaders can sample from it.
|
||||
/// Each render pass is configured with one [`wgpu::TextureView`] as an input. You will probably
|
||||
/// want to create a binding for this `texture_view` so your shaders can sample from it.
|
||||
///
|
||||
/// The render pass will also receive a reference to another
|
||||
/// [`wgpu::TextureView`] when the pass is executed. This texture view is the
|
||||
/// `render_target`.
|
||||
/// The render pass will also receive a reference to another [`wgpu::TextureView`] when the pass is
|
||||
/// executed. This texture view is the `render_target`.
|
||||
///
|
||||
/// [`Pixels`]: ./struct.Pixels.html
|
||||
pub trait RenderPass {
|
||||
/// The `update_bindings` method will be called when the `texture_view`
|
||||
/// needs to be recreated.
|
||||
/// The `update_bindings` method will be called when the `texture_view` needs to be recreated.
|
||||
///
|
||||
/// It's always called at least once when the default [`Pixels`] render
|
||||
/// passes are created. This can also happen in response to resizing the
|
||||
/// [`SurfaceTexture`].
|
||||
/// It's always called at least once when the default [`Pixels`] render passes are created.
|
||||
/// This can also happen in response to resizing the [`SurfaceTexture`].
|
||||
///
|
||||
/// You will typically recreate your bindings here to reference the new
|
||||
/// input `texture_view`.
|
||||
/// You will typically recreate your bindings here to reference the new input `texture_view`.
|
||||
///
|
||||
/// [`Pixels`]: ./struct.Pixels.html
|
||||
/// [`SurfaceTexture`]: ./struct.SurfaceTexture.html
|
||||
fn update_bindings(&mut self, texture_view: &TextureView);
|
||||
|
||||
/// Called when it is time to execute this render pass. Use the `encoder` to
|
||||
/// encode all commands related to this render pass. The result must be
|
||||
/// stored to the `render_target`.
|
||||
/// Called when it is time to execute this render pass. Use the `encoder` to encode all
|
||||
/// commands related to this render pass. The result must be stored to the `render_target`.
|
||||
fn render_pass(&self, encoder: &mut wgpu::CommandEncoder, render_target: &TextureView);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue