pub struct BorrowedRenderTarget<'a> {
pub view: &'a TextureView,
pub texture: Option<&'a Texture>,
pub size: PhysicalExtent,
pub format: TextureFormat,
}Expand description
A host-owned, single-sampled color target borrowed for UI recording.
Use this with crate::Renderer::record_layered_to_target_scaled when the
application already owns the image and command encoder. Unlike RenderFrame,
this descriptor transfers no ownership and carries no presentation callback.
The host acquires, submits, and presents the image itself.
§Attachment contract
- The view and encoder belong to
crate::Renderer::device. - The view is
D2, covers mip zero only and array layer zero only, and uses a single-sampled color texture withRENDER_ATTACHMENTusage. sizeis the full physical-pixel extent, not a logical size or a crop. Both axes are nonzero and within the device’smax_texture_dimension_2d.formatmatches the renderer’s pipeline format. Format reinterpretation through a differently formatted view is not supported by this contract.- If supplied,
texturebacks exactly this view, with matching dimensions and format. It is a single-layerD2image, not a multisampled attachment.
Wgpu 0.20 does not expose a view’s descriptor or backing texture for inspection. The caller must attest the view metadata and identity. The recorder checks the supplied extent, format and texture descriptor, but cannot prove that the view refers to that texture or that all handles share a device. Wgpu validates invalid GPU bindings separately; such failures are not typed recorder errors.
§Examples
use ailloli_ui_render_wgpu::{BorrowedRenderTarget, PhysicalExtent};
fn describe<'a>(
texture: &'a wgpu::Texture,
view: &'a wgpu::TextureView,
) -> BorrowedRenderTarget<'a> {
BorrowedRenderTarget {
view,
texture: Some(texture),
size: PhysicalExtent::new(texture.width(), texture.height()),
format: texture.format(),
}
}Fields§
§view: &'a TextureViewFull-size destination color view, on the renderer’s device.
texture: Option<&'a Texture>Optional backing image for destination-dependent effects.
None is sufficient for ordinary UI and foreground blur. Backdrop blur,
Multiply, and Screen blends require Some with COPY_SRC usage.
The recorder never acquires, owns, or presents this texture.
size: PhysicalExtentFull physical dimensions; both axes must be nonzero.
format: TextureFormatAttachment format, exactly matching the renderer’s pipeline format.
Trait Implementations§
Source§impl<'a> Clone for BorrowedRenderTarget<'a>
impl<'a> Clone for BorrowedRenderTarget<'a>
Source§fn clone(&self) -> BorrowedRenderTarget<'a>
fn clone(&self) -> BorrowedRenderTarget<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for BorrowedRenderTarget<'a>
impl<'a> Debug for BorrowedRenderTarget<'a>
impl<'a> Copy for BorrowedRenderTarget<'a>
Auto Trait Implementations§
impl<'a> Freeze for BorrowedRenderTarget<'a>
impl<'a> !RefUnwindSafe for BorrowedRenderTarget<'a>
impl<'a> Send for BorrowedRenderTarget<'a>
impl<'a> Sync for BorrowedRenderTarget<'a>
impl<'a> Unpin for BorrowedRenderTarget<'a>
impl<'a> !UnwindSafe for BorrowedRenderTarget<'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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.
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>
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>
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