pub struct RenderFrame {
pub view: TextureView,
pub size: PhysicalExtent,
pub format: TextureFormat,
/* private fields */
}Expand description
One acquired render destination from a host target.
§Examples
use ailloli_ui_render_wgpu::RenderFrame;
fn inspect(frame: &RenderFrame) {
let _: u32 = frame.size.width;
let _: wgpu::TextureFormat = frame.format;
}Fields§
§view: TextureViewTexture view bound to the target image.
size: PhysicalExtentActive frame dimensions.
format: TextureFormatOutput format for this frame.
Implementations§
Source§impl RenderFrame
impl RenderFrame
Sourcepub fn texture(&self) -> Option<&Texture>
pub fn texture(&self) -> Option<&Texture>
Returns the backing texture for effects that require reads or copies.
View-only targets return None; surface and owned-texture frames return
Some until the frame is consumed by Self::present.
§Examples
use ailloli_ui_render_wgpu::RenderFrame;
fn can_capture(frame: &RenderFrame) -> bool { frame.texture().is_some() }Sourcepub fn from_texture(
view: TextureView,
texture: Texture,
size: PhysicalExtent,
format: TextureFormat,
present: Option<Box<dyn FnOnce()>>,
) -> Self
pub fn from_texture( view: TextureView, texture: Texture, size: PhysicalExtent, format: TextureFormat, present: Option<Box<dyn FnOnce()>>, ) -> Self
Wraps a host-owned texture and its view as a render frame.
present is an optional one-shot host callback invoked after consuming
the texture source.
§Examples
use ailloli_ui_render_wgpu::{PhysicalExtent, RenderFrame};
fn wrap(view: wgpu::TextureView, texture: wgpu::Texture) -> RenderFrame {
RenderFrame::from_texture(view, texture, PhysicalExtent::new(64, 64),
wgpu::TextureFormat::Rgba8Unorm, None)
}Sourcepub fn present(self)
pub fn present(self)
Present the acquired frame to its consumer.
Surface frames call SurfaceTexture::present first, then the optional
host callback exactly once. Owned and view-only frames run only the
callback.
§Examples
use ailloli_ui_render_wgpu::RenderFrame;
fn finish(frame: RenderFrame) { frame.present(); }Auto Trait Implementations§
impl Freeze for RenderFrame
impl !RefUnwindSafe for RenderFrame
impl !Send for RenderFrame
impl !Sync for RenderFrame
impl Unpin for RenderFrame
impl !UnwindSafe for RenderFrame
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more