Struct BorrowedRenderTarget

Source
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 with RENDER_ATTACHMENT usage.
  • size is the full physical-pixel extent, not a logical size or a crop. Both axes are nonzero and within the device’s max_texture_dimension_2d.
  • format matches the renderer’s pipeline format. Format reinterpretation through a differently formatted view is not supported by this contract.
  • If supplied, texture backs exactly this view, with matching dimensions and format. It is a single-layer D2 image, 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 TextureView

Full-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: PhysicalExtent

Full physical dimensions; both axes must be nonzero.

§format: TextureFormat

Attachment format, exactly matching the renderer’s pipeline format.

Trait Implementations§

Source§

impl<'a> Clone for BorrowedRenderTarget<'a>

Source§

fn clone(&self) -> BorrowedRenderTarget<'a>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for BorrowedRenderTarget<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Copy for BorrowedRenderTarget<'a>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<A> IntoClickAction<A> for A
where A: Clone + 'static,

§

fn into_click_action(self) -> ClickAction<A>

Implements the into_click_action helper used by this module.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Props for T
where T: Clone + 'static,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,