pub struct Device { /* private fields */ }Expand description
a logical GPU device: creates resources, records commands, owns the queue
Implementations§
Source§impl Device
impl Device
pub fn queue(&self) -> &Queue
pub fn info(&self) -> &AdapterInfo
pub fn features(&self) -> &Features
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
pub fn validating(&self) -> bool
Sourcepub fn poll(&self) -> Result<()>
pub fn poll(&self) -> Result<()>
what the browser has said since the last look (nothing to free here)
Sourcepub fn wait(&self, id: SubmitId, _timeout_ns: u64) -> Result<bool>
pub fn wait(&self, id: SubmitId, _timeout_ns: u64) -> Result<bool>
the browser cannot wait on this thread: at once whether the submission is done
pub fn wait_idle(&self) -> Result<()>
pub fn completed(&self) -> SubmitId
Sourcepub fn is_done(&self, id: SubmitId) -> bool
pub fn is_done(&self, id: SubmitId) -> bool
the submission id is done on the GPU (the browser’s answer comes with its event loop)
Sourcepub fn memory_reserved(&self) -> u64
pub fn memory_reserved(&self) -> u64
what the buffers and textures asked for (the browser says nothing about its own memory)
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>
pub fn create_sampler(&self, d: &SamplerDesc) -> Result<Sampler>
Source§impl Device
impl Device
pub fn create_bind_group_layout( &self, bindings: &[Binding], ) -> Result<BindGroupLayout>
Sourcepub fn create_pipeline_layout(
&self,
desc: &PipelineLayoutDesc<'_>,
) -> Result<PipelineLayout>
pub fn create_pipeline_layout( &self, desc: &PipelineLayoutDesc<'_>, ) -> Result<PipelineLayout>
groups: at most BIND_GROUPS_MAX, and with push constants at most 3 (the last is theirs)
pub fn create_bind_group(&self, desc: &BindGroupDesc<'_>) -> Result<BindGroup>
Sourcepub fn create_bindless(&self, _desc: &BindlessDesc) -> Result<Bindless>
pub fn create_bindless(&self, _desc: &BindlessDesc) -> Result<Bindless>
(level Voll)
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>
(a required subgroup size: not built in the browser; size 0 is the plain pipeline)
pub fn create_render_pipeline( &self, desc: &RenderPipelineDesc<'_>, ) -> Result<RenderPipeline>
Sourcepub fn create_timestamps(&self, _count: u32) -> Result<Timestamps>
pub fn create_timestamps(&self, _count: u32) -> Result<Timestamps>
(not built in the browser: Features::timestamps is false; WebGPU has them only at the start and the end of a pass)