Skip to main content

WebGpuRing

Struct WebGpuRing 

Source
pub struct WebGpuRing;
Expand description

A BorrowedTarget’s part on WebGPU: both sides share the device’s queue, so frames need no separate sync objects.

Trait Implementations§

Source§

impl RingBackend for WebGpuRing

Source§

fn new( _backend: &mut RendererBackend, textures: &BorrowedTextures, producer: SyncKind, ) -> Result<Self, Error>

Fails as BorrowedTextures::check does, and with ErrorKind::Unsupported for a producer kind the target can’t hand over.

Source§

fn check_replacement( &self, current: &BorrowedTextures, next: &BorrowedTextures, ) -> Result<(), Error>

Fails with ErrorKind::Unsupported for another format or depth format, or depth textures where the ring had none, and as BorrowedTextures::check does.

Source§

fn targets( gpu: &WebGpu, textures: &BorrowedTextures, ) -> Result<TargetFormats, Error>

Fails with ErrorKind::Unsupported for a color format that WebGpu has no texture of.

Source§

type Gpu = WebGpu

The backend’s Gpu, which the host’s textures are imported into.
Source§

type Renderer = RendererBackend

The backend that the target is built on.
Source§

type Textures = BorrowedTextures

The host’s textures.
Source§

type Wait = !

What the next frame drawn into a slot waits for: the host’s reads of the slot’s texture.
Source§

type Handed = !

What a slot’s last frame handed the host and the target keeps until the host gives the slot back, such as a sync file.
Source§

fn import( gpu: &mut WebGpu, textures: &BorrowedTextures, slot: usize, depth: bool, ) -> Result<TextureId, GpuError>

Imports the host’s color texture at slot into gpu, or with depth, its depth and stencil texture.
Source§

fn wait_for( &mut self, _gpu: &mut WebGpu, consumer: ConsumerSync, ) -> Result<Option<Infallible>, Error>

What the next frame drawn into a slot waits for, once the host gave the slot back with consumer, or None when it waits for nothing.
Source§

fn wait_before_using( gpu: &mut Self::Gpu, texture: TextureId, wait: &Self::Wait, ) -> Result<(), GpuError>

Has the next submit of gpu that draws into texture wait for wait.
Source§

fn take_waits_into_next_submit(gpu: &mut Self::Gpu, texture: TextureId)

Has the next submit of gpu wait for what texture waits for, though nothing drew into it.
Source§

fn forget_waits(gpu: &mut Self::Gpu, texture: TextureId) -> bool

Drops what texture waits for, which no submit of gpu takes now. Returns whether it waited for something, which no pass took: false where a pass that drew into it took its waits into a submit.
Source§

fn waited(gpu: &mut Self::Gpu, wait: Self::Wait)

A submit of gpu took wait, or may have, which the ring lets go of once the work submitted so far and the next submit’s is done.
Source§

fn prepare_submit( &mut self, gpu: &mut Self::Gpu, textures: &Self::Textures, slot: Option<usize>, ) -> bool

Prepares the ring’s commands for submission, before the target flushes and signals the producer’s sync. slot is the slot of the frame ending, or None when the target is releasing or replacing its textures. Returning false drops the frame.
Source§

fn signal_after_next_submit(&mut self, gpu: &mut Self::Gpu)

Has the next submit of gpu signal the object that the host waits on for a frame, for a producer kind that names one.
Source§

fn producer_sync( &mut self, gpu: &mut Self::Gpu, ) -> Option<(GpuSync, Option<Self::Handed>)>

The sync that the host waits for, once the frame was submitted, for a producer kind that names an object, and what the slot keeps of it until the host gives it back. None when there is none, which drops the frame. A frame that hands nothing to keep leaves what the slot kept of an earlier frame until the host gives the slot back.
Source§

fn release_handed(gpu: &mut Self::Gpu, handed: Self::Handed)

Releases what a frame or texture release handed the host, with gpu, when the target drops it before its own Drop.
Source§

fn tear_down(&mut self, gpu: &mut Self::Gpu)

Lets go of the objects that the frames signal once the work submitted so far is done, as the target goes.
Source§

fn wait_for_frames(&self, what: &str)

Blocks until the work submitted so far is done, where the backend must before a target dropped without its tear-down, and so without the Gpu to defer to, lets go of what the frames used. Logs what was going on when the wait fails.
Source§

fn forget(wait: Self::Wait)

Lets go of wait, which no submit takes.

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> 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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,

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