Struct PixelsHost
pub struct PixelsHost { /* private fields */ }Expand description
Renders the requests made on its thread, for a frame loop whose thread
cannot wait for the GPU: drive it every frame while it
is waiting. Requests made while one exists go to it.
It draws with a renderer of its own rather than the frame’s: one-shot pixels must know whether their render dropped geometry (a scene busier than the reserved memory), and the frame’s renderer reports that for whichever of its frames it last measured.
Implementations§
§impl PixelsHost
impl PixelsHost
pub fn new() -> PixelsHost
pub fn new() -> PixelsHost
A host for this thread’s requests, with no GPU yet: requests wait
for set_gpu.
pub fn waiting(&self) -> bool
pub fn needs_gpu(&self) -> bool
pub fn needs_gpu(&self) -> bool
Whether requests wait for a renderer: the host creates one (on the
web, asynchronously) and hands it over with set_gpu.
pub fn draws_on(&self, device: &Device) -> bool
pub fn draws_on(&self, device: &Device) -> bool
Whether it renders on device; a host whose device was lost and
replaced hands it a renderer on the new one.
pub fn set_gpu(&mut self, device: Device, queue: Queue, renderer: Renderer)
pub fn set_gpu(&mut self, device: Device, queue: Queue, renderer: Renderer)
Render from now on with renderer on device.
pub fn refuse(&mut self, why: &str)
pub fn refuse(&mut self, why: &str)
Answer every waiting request with why: the host could not create
its renderer.
pub fn drive(&mut self) -> bool
pub fn drive(&mut self) -> bool
Move the requests on without waiting: start the next one, or look whether the GPU has copied the current one out and answer it. One request at a time, so the renderer’s memory report is that request’s. Whether it answered one: what asked for it reads it on the next frame, so the caller draws one.
Trait Implementations§
§impl Default for PixelsHost
impl Default for PixelsHost
§fn default() -> PixelsHost
fn default() -> PixelsHost
Auto Trait Implementations§
impl Freeze for PixelsHost
impl !RefUnwindSafe for PixelsHost
impl Send for PixelsHost
impl !Sync for PixelsHost
impl Unpin for PixelsHost
impl UnsafeUnpin for PixelsHost
impl !UnwindSafe for PixelsHost
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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