pub struct CustomPass<'a> {
pub device: &'a Device,
pub queue: &'a Queue,
pub encoder: &'a mut CommandEncoder,
/* private fields */
}Expand description
What a Painter::custom closure gets: the frame’s encoder and
the painter’s render target at that point in the frame (the canvas, the window, or the
MSAA texture resolving into either).
With indexed colour on (Self::is_indexed) the target holds palette indices: return
index_out(i) from INDEX_WGSL (feature indexed) instead of a colour.
The easiest way to draw is Self::begin_render_pass, which attaches the target the same
way the painter does (load, store, MSAA resolve, depth). Build the pipeline for it with
Self::format, Self::multisample and Self::depth_stencil, so it matches the
attachments whatever AppConfig::msaa_samples and depth_format are.
Fields§
§device: &'a Device§queue: &'a Queue§encoder: &'a mut CommandEncoderImplementations§
Source§impl<'a> CustomPass<'a>
impl<'a> CustomPass<'a>
Sourcepub fn begin_render_pass(&mut self, label: &str) -> RenderPass<'_>
pub fn begin_render_pass(&mut self, label: &str) -> RenderPass<'_>
A render pass onto the painter’s target that keeps what is already there (the clear colour and lower layers), with the MSAA resolve and depth attachment the painter uses.
Sourcepub fn view(&self) -> &TextureView
pub fn view(&self) -> &TextureView
The colour view drawn into: the MSAA texture when multisampling, else the canvas (or
the window without one). For passes set up by hand; see Self::resolve_target.
Sourcepub fn resolve_target(&self) -> Option<&TextureView>
pub fn resolve_target(&self) -> Option<&TextureView>
Some(view) when multisampling: the MSAA colour resolves into it.
Sourcepub fn depth_view(&self) -> Option<&TextureView>
pub fn depth_view(&self) -> Option<&TextureView>
The depth view, when AppConfig::depth_format is set.
Sourcepub fn format(&self) -> TextureFormat
pub fn format(&self) -> TextureFormat
The target’s colour format (always sRGB; see Graphics::surface_format).
Sourcepub fn multisample(&self) -> MultisampleState
pub fn multisample(&self) -> MultisampleState
Multisample state matching the target, for the pipeline.
Sourcepub fn depth_stencil(&self) -> Option<DepthStencilState>
pub fn depth_stencil(&self) -> Option<DepthStencilState>
Depth-stencil state matching the target, for the pipeline: None without a depth
buffer, else one that neither tests nor writes depth (like the painter’s 2D layers).
Sourcepub fn is_indexed(&self) -> bool
pub fn is_indexed(&self) -> bool
Whether the target holds palette indices (indexed colour is on) rather than colours.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for CustomPass<'a>
impl<'a> !UnwindSafe for CustomPass<'a>
impl<'a> Forget for CustomPass<'a>
impl<'a> Freeze for CustomPass<'a>
impl<'a> Send for CustomPass<'a>
impl<'a> Sync for CustomPass<'a>
impl<'a> Unpin for CustomPass<'a>
impl<'a> UnsafeUnpin for CustomPass<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.