pub struct Gpu {
pub device: Device,
pub queue: Queue,
pub adapter: Adapter,
/* private fields */
}Expand description
The device and the one pipeline per target format.
Fields§
§device: Device§queue: Queue§adapter: AdapterImplementations§
Source§impl Gpu
impl Gpu
Sourcepub fn new(
instance: &Instance,
compatible: Option<&Surface<'_>>,
prefer: Option<(u32, u32)>,
allow_software: bool,
) -> Result<Gpu, String>
pub fn new( instance: &Instance, compatible: Option<&Surface<'_>>, prefer: Option<(u32, u32)>, allow_software: bool, ) -> Result<Gpu, String>
Opens a device able to present to compatible (or any device, for
drawing off-screen): the adapter with PCI ids prefer when there is
one (the adapter the monitors are plugged into), else a low-power one.
Sourcepub fn canvas(&self, player: &Player) -> Canvas
pub fn canvas(&self, player: &Player) -> Canvas
Puts the player’s current frame and palette on the GPU.
Sourcepub fn upload(&self, canvas: &mut Canvas, player: &Player, rects: &[PixelRect])
pub fn upload(&self, canvas: &mut Canvas, player: &Player, rects: &[PixelRect])
Copies those rectangles of the player’s frame to the canvas: one buffer write and one command buffer, however many rectangles.
Sourcepub fn draw(
&mut self,
canvas: &Canvas,
target: &TextureView,
format: TextureFormat,
)
pub fn draw( &mut self, canvas: &Canvas, target: &TextureView, format: TextureFormat, )
Draws the canvas into target (a surface texture or an off-screen
one) and submits.
Auto Trait Implementations§
impl !RefUnwindSafe for Gpu
impl !UnwindSafe for Gpu
impl Forget for Gpu
impl Freeze for Gpu
impl Move for Gpu
impl Send for Gpu
impl Sync for Gpu
impl Unpin for Gpu
impl UnsafeUnpin for Gpu
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.