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