Trait wgpu_hal::Device

source ·
pub trait Device<A: Api>: WasmNotSendSync {
Show 39 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); unsafe fn create_acceleration_structure( &self, desc: &AccelerationStructureDescriptor<'_> ) -> Result<A::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::AccelerationStructure ) -> BufferAddress; unsafe fn destroy_acceleration_structure( &self, acceleration_structure: A::AccelerationStructure );
}

Required Methods§

source

unsafe fn exit(self, queue: A::Queue)

Exit connection to this logical device.

source

unsafe fn create_buffer( &self, desc: &BufferDescriptor<'_> ) -> Result<A::Buffer, DeviceError>

Creates a new buffer.

The initial usage is BufferUses::empty().

source

unsafe fn destroy_buffer(&self, buffer: A::Buffer)

source

unsafe fn map_buffer( &self, buffer: &A::Buffer, range: MemoryRange ) -> Result<BufferMapping, DeviceError>

source

unsafe fn unmap_buffer(&self, buffer: &A::Buffer) -> Result<(), DeviceError>

source

unsafe fn flush_mapped_ranges<I>(&self, buffer: &A::Buffer, ranges: I)
where I: Iterator<Item = MemoryRange>,

source

unsafe fn invalidate_mapped_ranges<I>(&self, buffer: &A::Buffer, ranges: I)
where I: Iterator<Item = MemoryRange>,

source

unsafe fn create_texture( &self, desc: &TextureDescriptor<'_> ) -> Result<A::Texture, DeviceError>

Creates a new texture.

The initial usage for all subresources is TextureUses::UNINITIALIZED.

source

unsafe fn destroy_texture(&self, texture: A::Texture)

source

unsafe fn create_texture_view( &self, texture: &A::Texture, desc: &TextureViewDescriptor<'_> ) -> Result<A::TextureView, DeviceError>

source

unsafe fn destroy_texture_view(&self, view: A::TextureView)

source

unsafe fn create_sampler( &self, desc: &SamplerDescriptor<'_> ) -> Result<A::Sampler, DeviceError>

source

unsafe fn destroy_sampler(&self, sampler: A::Sampler)

source

unsafe fn create_command_encoder( &self, desc: &CommandEncoderDescriptor<'_, A> ) -> Result<A::CommandEncoder, DeviceError>

source

unsafe fn destroy_command_encoder(&self, pool: A::CommandEncoder)

source

unsafe fn create_bind_group_layout( &self, desc: &BindGroupLayoutDescriptor<'_> ) -> Result<A::BindGroupLayout, DeviceError>

Creates a bind group layout.

source

unsafe fn destroy_bind_group_layout(&self, bg_layout: A::BindGroupLayout)

source

unsafe fn create_pipeline_layout( &self, desc: &PipelineLayoutDescriptor<'_, A> ) -> Result<A::PipelineLayout, DeviceError>

source

unsafe fn destroy_pipeline_layout(&self, pipeline_layout: A::PipelineLayout)

source

unsafe fn create_bind_group( &self, desc: &BindGroupDescriptor<'_, A> ) -> Result<A::BindGroup, DeviceError>

source

unsafe fn destroy_bind_group(&self, group: A::BindGroup)

source

unsafe fn create_shader_module( &self, desc: &ShaderModuleDescriptor<'_>, shader: ShaderInput<'_> ) -> Result<A::ShaderModule, ShaderError>

source

unsafe fn destroy_shader_module(&self, module: A::ShaderModule)

source

unsafe fn create_render_pipeline( &self, desc: &RenderPipelineDescriptor<'_, A> ) -> Result<A::RenderPipeline, PipelineError>

source

unsafe fn destroy_render_pipeline(&self, pipeline: A::RenderPipeline)

source

unsafe fn create_compute_pipeline( &self, desc: &ComputePipelineDescriptor<'_, A> ) -> Result<A::ComputePipeline, PipelineError>

source

unsafe fn destroy_compute_pipeline(&self, pipeline: A::ComputePipeline)

source

unsafe fn create_query_set( &self, desc: &QuerySetDescriptor<Label<'_>> ) -> Result<A::QuerySet, DeviceError>

source

unsafe fn destroy_query_set(&self, set: A::QuerySet)

source

unsafe fn create_fence(&self) -> Result<A::Fence, DeviceError>

source

unsafe fn destroy_fence(&self, fence: A::Fence)

source

unsafe fn get_fence_value( &self, fence: &A::Fence ) -> Result<FenceValue, DeviceError>

source

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.

source

unsafe fn start_capture(&self) -> bool

source

unsafe fn stop_capture(&self)

source

unsafe fn create_acceleration_structure( &self, desc: &AccelerationStructureDescriptor<'_> ) -> Result<A::AccelerationStructure, DeviceError>

source

unsafe fn get_acceleration_structure_build_sizes( &self, desc: &GetAccelerationStructureBuildSizesDescriptor<'_, A> ) -> AccelerationStructureBuildSizes

source

unsafe fn get_acceleration_structure_device_address( &self, acceleration_structure: &A::AccelerationStructure ) -> BufferAddress

source

unsafe fn destroy_acceleration_structure( &self, acceleration_structure: A::AccelerationStructure )

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Device<Api> for Context

source§

impl Device<Api> for wgpu_hal::gles::Device

source§

impl Device<Api> for wgpu_hal::vulkan::Device