pub trait Device<A: Api>: Send + Sync {
Show 35 methods
// Required methods
unsafe fn exit(self, queue: A::Queue);
unsafe fn create_buffer(
&self,
desc: &BufferDescriptor<'_>
) -> Result<A::Buffer, DeviceError>;
unsafe fn destroy_buffer(&self, buffer: A::Buffer);
unsafe fn map_buffer(
&self,
buffer: &A::Buffer,
range: MemoryRange
) -> Result<BufferMapping, DeviceError>;
unsafe fn unmap_buffer(&self, buffer: &A::Buffer) -> Result<(), DeviceError>;
unsafe fn flush_mapped_ranges<I>(&self, buffer: &A::Buffer, ranges: I)
where I: Iterator<Item = MemoryRange>;
unsafe fn invalidate_mapped_ranges<I>(&self, buffer: &A::Buffer, ranges: I)
where I: Iterator<Item = MemoryRange>;
unsafe fn create_texture(
&self,
desc: &TextureDescriptor<'_>
) -> Result<A::Texture, DeviceError>;
unsafe fn destroy_texture(&self, texture: A::Texture);
unsafe fn create_texture_view(
&self,
texture: &A::Texture,
desc: &TextureViewDescriptor<'_>
) -> Result<A::TextureView, DeviceError>;
unsafe fn destroy_texture_view(&self, view: A::TextureView);
unsafe fn create_sampler(
&self,
desc: &SamplerDescriptor<'_>
) -> Result<A::Sampler, DeviceError>;
unsafe fn destroy_sampler(&self, sampler: A::Sampler);
unsafe fn create_command_encoder(
&self,
desc: &CommandEncoderDescriptor<'_, A>
) -> Result<A::CommandEncoder, DeviceError>;
unsafe fn destroy_command_encoder(&self, pool: A::CommandEncoder);
unsafe fn create_bind_group_layout(
&self,
desc: &BindGroupLayoutDescriptor<'_>
) -> Result<A::BindGroupLayout, DeviceError>;
unsafe fn destroy_bind_group_layout(&self, bg_layout: A::BindGroupLayout);
unsafe fn create_pipeline_layout(
&self,
desc: &PipelineLayoutDescriptor<'_, A>
) -> Result<A::PipelineLayout, DeviceError>;
unsafe fn destroy_pipeline_layout(&self, pipeline_layout: A::PipelineLayout);
unsafe fn create_bind_group(
&self,
desc: &BindGroupDescriptor<'_, A>
) -> Result<A::BindGroup, DeviceError>;
unsafe fn destroy_bind_group(&self, group: A::BindGroup);
unsafe fn create_shader_module(
&self,
desc: &ShaderModuleDescriptor<'_>,
shader: ShaderInput<'_>
) -> Result<A::ShaderModule, ShaderError>;
unsafe fn destroy_shader_module(&self, module: A::ShaderModule);
unsafe fn create_render_pipeline(
&self,
desc: &RenderPipelineDescriptor<'_, A>
) -> Result<A::RenderPipeline, PipelineError>;
unsafe fn destroy_render_pipeline(&self, pipeline: A::RenderPipeline);
unsafe fn create_compute_pipeline(
&self,
desc: &ComputePipelineDescriptor<'_, A>
) -> Result<A::ComputePipeline, PipelineError>;
unsafe fn destroy_compute_pipeline(&self, pipeline: A::ComputePipeline);
unsafe fn create_query_set(
&self,
desc: &QuerySetDescriptor<Label<'_>>
) -> Result<A::QuerySet, DeviceError>;
unsafe fn destroy_query_set(&self, set: A::QuerySet);
unsafe fn create_fence(&self) -> Result<A::Fence, DeviceError>;
unsafe fn destroy_fence(&self, fence: A::Fence);
unsafe fn get_fence_value(
&self,
fence: &A::Fence
) -> Result<FenceValue, DeviceError>;
unsafe fn wait(
&self,
fence: &A::Fence,
value: FenceValue,
timeout_ms: u32
) -> Result<bool, DeviceError>;
unsafe fn start_capture(&self) -> bool;
unsafe fn stop_capture(&self);
}
Required Methods§
sourceunsafe fn create_buffer(
&self,
desc: &BufferDescriptor<'_>
) -> Result<A::Buffer, DeviceError>
unsafe fn create_buffer( &self, desc: &BufferDescriptor<'_> ) -> Result<A::Buffer, DeviceError>
Creates a new buffer.
The initial usage is BufferUses::empty()
.
unsafe fn destroy_buffer(&self, buffer: A::Buffer)
unsafe fn map_buffer( &self, buffer: &A::Buffer, range: MemoryRange ) -> Result<BufferMapping, DeviceError>
unsafe fn unmap_buffer(&self, buffer: &A::Buffer) -> Result<(), DeviceError>
unsafe fn flush_mapped_ranges<I>(&self, buffer: &A::Buffer, ranges: I)where I: Iterator<Item = MemoryRange>,
unsafe fn invalidate_mapped_ranges<I>(&self, buffer: &A::Buffer, ranges: I)where I: Iterator<Item = MemoryRange>,
sourceunsafe fn create_texture(
&self,
desc: &TextureDescriptor<'_>
) -> Result<A::Texture, DeviceError>
unsafe fn create_texture( &self, desc: &TextureDescriptor<'_> ) -> Result<A::Texture, DeviceError>
Creates a new texture.
The initial usage for all subresources is TextureUses::UNINITIALIZED
.
unsafe fn destroy_texture(&self, texture: A::Texture)
unsafe fn create_texture_view( &self, texture: &A::Texture, desc: &TextureViewDescriptor<'_> ) -> Result<A::TextureView, DeviceError>
unsafe fn destroy_texture_view(&self, view: A::TextureView)
unsafe fn create_sampler( &self, desc: &SamplerDescriptor<'_> ) -> Result<A::Sampler, DeviceError>
unsafe fn destroy_sampler(&self, sampler: A::Sampler)
unsafe fn create_command_encoder( &self, desc: &CommandEncoderDescriptor<'_, A> ) -> Result<A::CommandEncoder, DeviceError>
unsafe fn destroy_command_encoder(&self, pool: A::CommandEncoder)
sourceunsafe fn create_bind_group_layout(
&self,
desc: &BindGroupLayoutDescriptor<'_>
) -> Result<A::BindGroupLayout, DeviceError>
unsafe fn create_bind_group_layout( &self, desc: &BindGroupLayoutDescriptor<'_> ) -> Result<A::BindGroupLayout, DeviceError>
Creates a bind group layout.
unsafe fn destroy_bind_group_layout(&self, bg_layout: A::BindGroupLayout)
unsafe fn create_pipeline_layout( &self, desc: &PipelineLayoutDescriptor<'_, A> ) -> Result<A::PipelineLayout, DeviceError>
unsafe fn destroy_pipeline_layout(&self, pipeline_layout: A::PipelineLayout)
unsafe fn create_bind_group( &self, desc: &BindGroupDescriptor<'_, A> ) -> Result<A::BindGroup, DeviceError>
unsafe fn destroy_bind_group(&self, group: A::BindGroup)
unsafe fn create_shader_module( &self, desc: &ShaderModuleDescriptor<'_>, shader: ShaderInput<'_> ) -> Result<A::ShaderModule, ShaderError>
unsafe fn destroy_shader_module(&self, module: A::ShaderModule)
unsafe fn create_render_pipeline( &self, desc: &RenderPipelineDescriptor<'_, A> ) -> Result<A::RenderPipeline, PipelineError>
unsafe fn destroy_render_pipeline(&self, pipeline: A::RenderPipeline)
unsafe fn create_compute_pipeline( &self, desc: &ComputePipelineDescriptor<'_, A> ) -> Result<A::ComputePipeline, PipelineError>
unsafe fn destroy_compute_pipeline(&self, pipeline: A::ComputePipeline)
unsafe fn create_query_set( &self, desc: &QuerySetDescriptor<Label<'_>> ) -> Result<A::QuerySet, DeviceError>
unsafe fn destroy_query_set(&self, set: A::QuerySet)
unsafe fn create_fence(&self) -> Result<A::Fence, DeviceError>
unsafe fn destroy_fence(&self, fence: A::Fence)
unsafe fn get_fence_value( &self, fence: &A::Fence ) -> Result<FenceValue, DeviceError>
sourceunsafe fn wait(
&self,
fence: &A::Fence,
value: FenceValue,
timeout_ms: u32
) -> Result<bool, DeviceError>
unsafe fn wait( &self, fence: &A::Fence, value: FenceValue, timeout_ms: u32 ) -> Result<bool, DeviceError>
Calling wait with a lower value than the current fence value will immediately return.