Skip to main content

HeadlessAtlas

Struct HeadlessAtlas 

Source
pub struct HeadlessAtlas(/* private fields */);
Expand description

A sprite atlas for windows without a GPU. It hands out uniquely identified tiles without uploading any pixels, so glyph, SVG, and image painting can run to completion in tests and headless platforms.

Trait Implementations§

Source§

impl Default for HeadlessAtlas

Source§

fn default() -> Self

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

impl PlatformAtlas for HeadlessAtlas

Source§

fn get_or_insert_with<'a>( &self, key: AtlasKey, build: &mut dyn FnMut() -> Result<Option<(Size<DevicePixels>, Cow<'a, [u8]>)>>, ) -> Result<Option<AtlasTile>>

The builder runs with the atlas locked and must not re-enter the same atlas.
Source§

fn remove(&self, key: &AtlasKey)

Source§

fn upload_from_gpu( &self, _key: &AtlasKey, _size: Size<DevicePixels>, _texture: GpuTextureHandle, ) -> Result<Option<AtlasTile>>

Fill the tile for key from a texture that is ALREADY in the renderer’s own GPU memory, with no CPU round trip — the tile is allocated on the first call and overwritten in place on every call after it. Read more
Source§

fn upload_from_d3d12( &self, _key: &AtlasKey, _size: Size<DevicePixels>, _texture: D3D12TextureHandle, _owner: Arc<dyn Any + Send + Sync>, ) -> Result<Option<AtlasTile>>

Copies a straight-alpha BGRA8 D3D12 texture on this atlas’s device. The source is in RENDER_TARGET state before and after the copy. Its producer signals ready_fence at ready_value; the consumer waits on its GPU queue. owner retains the producer allocation and fence until the copy completes, not merely until this function returns.
Source§

fn upload_from_metal( &self, _key: &AtlasKey, _size: Size<DevicePixels>, _texture: GpuTextureHandle, _ready: Option<(*mut c_void, u64)>, _owner: Arc<dyn Any + Send + Sync>, ) -> Result<Option<AtlasTile>>

vue-native fork: copies a straight-alpha BGRA8Unorm (or _sRGB) id<MTLTexture> on this atlas’s device into the tile for key, on the renderer’s queue. With ready (an id<MTLSharedEvent> and a value) the copy waits on the GPU until the event reaches it; without, the texture must already be written. owner is retained until the copy completes.
Source§

fn tile(&self, _key: &AtlasKey) -> Option<AtlasTile>

vue-native fork: the tile key maps to now, if any. None from a backend that does not say, which makes every crate::Window::write_image_tile report a moved tile: correct, only never the cheap path.
Source§

fn write_bytes( &self, _key: &AtlasKey, _size: Size<DevicePixels>, _bytes: &[u8], ) -> Result<Option<AtlasTile>>

vue-native fork: writes bytes (size, in the key’s texture format, rows packed) into the tile for key, overwriting it in place when it exists at this size and taking a new one otherwise. The CPU twin of PlatformAtlas::upload_from_gpu: not memoised, one tile per key. Read more
Source§

fn stats(&self) -> Option<AtlasStats>

vue-native fork: the atlas’s footprint, per texture kind — for an embedder’s memory report. None from a backend that does not keep count.

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more