pub struct Device { /* private fields */ }Expand description
a logical GPU device: creates resources, records commands, owns the queue
Implementations§
Source§impl Device
impl Device
Sourcepub fn encoder(&self) -> Result<CommandEncoder<'_>>
pub fn encoder(&self) -> Result<CommandEncoder<'_>>
a command encoder (a recording command buffer)
Source§impl Device
impl Device
pub fn queue(&self) -> &Queue
pub fn info(&self) -> &AdapterInfo
pub fn limits(&self) -> &Limits
pub fn level(&self) -> Level
Sourcepub fn is_lost(&self) -> bool
pub fn is_lost(&self) -> bool
the device was lost: every call fails with DeviceLost; create a new device
Sourcepub fn test_lose(&self)
pub fn test_lose(&self)
(test aid) behave as a lost device from now on (a lost device runs nothing any more and its resources may go at once; here the GPU may still work on the last submission: it finishes first)
Sourcepub fn validating(&self) -> bool
pub fn validating(&self) -> bool
the validation layer watches this device
Sourcepub fn poll(&self) -> Result<()>
pub fn poll(&self) -> Result<()>
free what the GPU has finished with (also done by submit and wait)
Sourcepub fn wait(&self, id: SubmitId, timeout_ns: u64) -> Result<bool>
pub fn wait(&self, id: SubmitId, timeout_ns: u64) -> Result<bool>
wait for a submission -> false when timeout_ns passed first
Sourcepub fn is_done(&self, id: SubmitId) -> bool
pub fn is_done(&self, id: SubmitId) -> bool
the submission id is done on the GPU (asks the driver; never waits)
Sourcepub fn memory_reserved(&self) -> u64
pub fn memory_reserved(&self) -> u64
bytes of device and host memory the device holds in blocks
Source§impl Device
impl Device
pub fn create_buffer(&self, desc: &BufferDesc) -> Result<Buffer>
Source§impl Device
impl Device
pub fn create_texture(&self, desc: &TextureDesc) -> Result<Texture>
Source§impl Device
impl Device
pub fn create_sampler(&self, desc: &SamplerDesc) -> Result<Sampler>
Source§impl Device
impl Device
pub fn create_bind_group_layout( &self, bindings: &[Binding], ) -> Result<BindGroupLayout>
Source§impl Device
impl Device
pub fn create_pipeline_layout( &self, desc: &PipelineLayoutDesc<'_>, ) -> Result<PipelineLayout>
Source§impl Device
impl Device
pub fn create_bind_group(&self, desc: &BindGroupDesc<'_>) -> Result<BindGroup>
Source§impl Device
impl Device
pub fn create_bindless(&self, desc: &BindlessDesc) -> Result<Bindless>
Source§impl Device
impl Device
pub fn create_compute_pipeline( &self, desc: &ComputePipelineDesc<'_>, ) -> Result<ComputePipeline>
Sourcepub fn create_compute_pipeline_sized(
&self,
desc: &ComputePipelineDesc<'_>,
size: u32,
) -> Result<ComputePipeline>
pub fn create_compute_pipeline_sized( &self, desc: &ComputePipelineDesc<'_>, size: u32, ) -> Result<ComputePipeline>
create_compute_pipeline with a required subgroup size (WGSL @subgroup_size, what wgsl::Output::subgroup_size returns): Features::subgroup_size_control, a power of two in Limits::subgroup_min_size ..= subgroup_max_size; size 0: the driver’s choice