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 upload buffer 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 Gpuwhere
*const ArcInner<CoreDevice> is !null: Freeze,
PhantomData<ArcInner<CoreDevice>>: Freeze,
*const ArcInner<CoreQueue> is !null: Freeze,
PhantomData<ArcInner<CoreQueue>>: Freeze,
*const ArcInner<CoreAdapter> is !null: Freeze,
PhantomData<ArcInner<CoreAdapter>>: Freeze,
*const ArcInner<CoreBindGroupLayout> is !null: Freeze,
PhantomData<ArcInner<CoreBindGroupLayout>>: Freeze,
*const ArcInner<CorePipelineLayout> is !null: Freeze,
PhantomData<ArcInner<CorePipelineLayout>>: Freeze,
*const ArcInner<CoreShaderModule> is !null: Freeze,
PhantomData<ArcInner<CoreShaderModule>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<(TextureFormat, RenderPipeline)>: Freeze,
impl Move for Gpu
impl Send for Gpu
impl Sync for Gpu
impl Unpin for Gpu
impl UnsafeUnpin for Gpuwhere
*const ArcInner<CoreDevice> is !null: UnsafeUnpin,
PhantomData<ArcInner<CoreDevice>>: UnsafeUnpin,
*const ArcInner<CoreQueue> is !null: UnsafeUnpin,
PhantomData<ArcInner<CoreQueue>>: UnsafeUnpin,
*const ArcInner<CoreAdapter> is !null: UnsafeUnpin,
PhantomData<ArcInner<CoreAdapter>>: UnsafeUnpin,
*const ArcInner<CoreBindGroupLayout> is !null: UnsafeUnpin,
PhantomData<ArcInner<CoreBindGroupLayout>>: UnsafeUnpin,
*const ArcInner<CorePipelineLayout> is !null: UnsafeUnpin,
PhantomData<ArcInner<CorePipelineLayout>>: UnsafeUnpin,
*const ArcInner<CoreShaderModule> is !null: UnsafeUnpin,
PhantomData<ArcInner<CoreShaderModule>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<(TextureFormat, RenderPipeline)>: UnsafeUnpin,
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