pub struct GpuContext {
pub adapter: Adapter,
pub device: Device,
pub queue: Queue,
}Expand description
A device and queue ready for rendering.
Fields§
§adapter: AdapterPhysical GPU the device was created on.
device: DeviceLogical device that owns all GPU resources.
queue: QueueCommand queue for uploads and submissions.
Implementations§
Source§impl GpuContext
impl GpuContext
Sourcepub async fn new(
instance: &Instance,
surface: Option<&Surface<'_>>,
) -> Result<Self, GpuError>
pub async fn new( instance: &Instance, surface: Option<&Surface<'_>>, ) -> Result<Self, GpuError>
Requests an adapter (compatible with surface, when given) and a device
with default limits, which every WebGPU implementation supports.
A power preference is what makes wgpu rank adapters: without one it takes
the first it finds, which on Linux can be Vulkan on the CPU with the real
GPU right there on GL. An interface needs little, so it asks for the GPU
that spends the least; WGPU_POWER_PREF overrides that. When the adapter
cannot give the limits needed, as an old GPU may not, the others get a turn.
Trait Implementations§
Source§impl Clone for GpuContext
impl Clone for GpuContext
Source§fn clone(&self) -> GpuContext
fn clone(&self) -> GpuContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for GpuContext
impl !UnwindSafe for GpuContext
impl Freeze for GpuContext
impl Send for GpuContext
impl Sync for GpuContext
impl Unpin for GpuContext
impl UnsafeUnpin for GpuContext
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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