Skip to main content

ExternalExtents

Struct ExternalExtents 

Source
pub struct ExternalExtents { /* private fields */ }
Expand description

The texel extent of every externally bound texture, keyed by the opaque id a Command::SceneTexture names it by.

A projection of the renderer’s own registry, maintained by the one call that owns both halves (EngineRenderer::bind_texture/unbind_texture), so the two can never disagree about which ids are live. Only the extent crosses over: the view stays on the GPU side, which is what keeps compile free of wgpu.

A compiler built standalone starts empty, which reads as “nothing is bound” — every SceneTexture then draws nothing, exactly as an unregistered id does.

Implementations§

Source§

impl ExternalExtents

Source

pub fn new() -> Self

An empty map — nothing bound.

Source

pub fn bind(&mut self, id: u64, size: (u32, u32)) -> bool

Records id as bound at size texels, returning whether the extent is usable at all.

A dimension past u16::MAX is refused rather than truncated: the record the shader reads packs the source region into u16 halves, so a truncated extent would sample a rectangle the caller never named. A zero dimension is refused for the same reason a zero-sized image is — there is no scale to map it onto dest with.

Source

pub fn unbind(&mut self, id: u64)

Forgets id, if it was bound.

Source

pub fn get(&self, id: u64) -> Option<(u16, u16)>

The texel extent bound under id, if any.

Source

pub fn len(&self) -> usize

How many textures are bound.

Source

pub fn is_empty(&self) -> bool

Whether nothing is bound.

Trait Implementations§

Source§

impl Debug for ExternalExtents

Source§

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

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

impl Default for ExternalExtents

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

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.

Source§

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

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

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

Source§

impl<T> WasmNotSendSync for T

Source§

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