pub struct GpuContext { /* private fields */ }Expand description
GPU context holding device and queue.
This is the main entry point for GPU operations. It manages the WGPU device and queue, and provides methods for creating buffers, pipelines, and executing compute shaders.
Implementations§
Source§impl GpuContext
impl GpuContext
Sourcepub async fn new() -> GpuResult<Self>
pub async fn new() -> GpuResult<Self>
Create a new GPU context with default configuration.
§Errors
Returns an error if no suitable GPU adapter is found or device request fails.
Sourcepub async fn with_config(config: GpuContextConfig) -> GpuResult<Self>
pub async fn with_config(config: GpuContextConfig) -> GpuResult<Self>
Create a new GPU context with custom configuration.
§Errors
Returns an error if no suitable GPU adapter is found or device request fails.
Sourcepub fn adapter_info(&self) -> &AdapterInfo
pub fn adapter_info(&self) -> &AdapterInfo
Get adapter information.
Sourcepub fn supports_feature(&self, feature: Features) -> bool
pub fn supports_feature(&self, feature: Features) -> bool
Check if the device supports a specific feature.
Sourcepub fn max_workgroup_size(&self) -> (u32, u32, u32)
pub fn max_workgroup_size(&self) -> (u32, u32, u32)
Get maximum workgroup size for compute shaders.
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 · 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 Freeze for GpuContext
impl !RefUnwindSafe for GpuContext
impl Send for GpuContext
impl Sync for GpuContext
impl Unpin for GpuContext
impl UnsafeUnpin for GpuContext
impl !UnwindSafe for GpuContext
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