[−][src]Trait pixels::RenderPass
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.
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.
The render pass will also receive a reference to another wgpu::TextureView when the pass is
executed. This texture view is the render_target.
Required methods
fn render(&self, encoder: &mut CommandEncoder, render_target: &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.
Arguments
encoder- Command encoder for the render passrender_target- A reference to the output texturetexels- The byte slice passed toPixels::render
fn update_bindings(
&mut self,
input_texture: &TextureView,
input_texture_size: &Extent3d
)
&mut self,
input_texture: &TextureView,
input_texture_size: &Extent3d
)
This method will be called when the input wgpu::TextureView needs to be rebinded.
A wgpu::TextureView is provided to the RenderPass factory as an input texture with
the original SurfaceTexture size. This method is called in response to resizing the
SurfaceTexture, where your RenderPass impl can update its input texture for the new
size.
Arguments
input_texture- A reference to theTextureViewfor this render pass's inputinput_texture_size- Theinput_texturesize
Provided methods
fn resize(&mut self, encoder: &mut CommandEncoder, width: u32, height: u32)
When the window is resized, this method will be called, allowing the render pass to customize itself to the display size.
The default implementation is a no-op.
Arguments
encoder- Command encoder for the render passwidth- Render target width in physical pixel unitsheight- Render target height in physical pixel units
fn debug(&self, f: &mut Formatter) -> Result
This function implements Debug for trait objects.
You are encouraged to override the default impl to provide better debug messages.