Trait wgpu_hal::Device

source ·
pub trait Device: WasmNotSendSync {
    type A: Api;

Show 39 methods // Required methods unsafe fn exit(self, queue: <Self::A as Api>::Queue); unsafe fn create_buffer( &self, desc: &BufferDescriptor<'_> ) -> Result<<Self::A as Api>::Buffer, DeviceError>; unsafe fn destroy_buffer(&self, buffer: <Self::A as Api>::Buffer); unsafe fn map_buffer( &self, buffer: &<Self::A as Api>::Buffer, range: MemoryRange ) -> Result<BufferMapping, DeviceError>; unsafe fn unmap_buffer( &self, buffer: &<Self::A as Api>::Buffer ) -> Result<(), DeviceError>; unsafe fn flush_mapped_ranges<I>( &self, buffer: &<Self::A as Api>::Buffer, ranges: I ) where I: Iterator<Item = MemoryRange>; unsafe fn invalidate_mapped_ranges<I>( &self, buffer: &<Self::A as Api>::Buffer, ranges: I ) where I: Iterator<Item = MemoryRange>; unsafe fn create_texture( &self, desc: &TextureDescriptor<'_> ) -> Result<<Self::A as Api>::Texture, DeviceError>; unsafe fn destroy_texture(&self, texture: <Self::A as Api>::Texture); unsafe fn create_texture_view( &self, texture: &<Self::A as Api>::Texture, desc: &TextureViewDescriptor<'_> ) -> Result<<Self::A as Api>::TextureView, DeviceError>; unsafe fn destroy_texture_view(&self, view: <Self::A as Api>::TextureView); unsafe fn create_sampler( &self, desc: &SamplerDescriptor<'_> ) -> Result<<Self::A as Api>::Sampler, DeviceError>; unsafe fn destroy_sampler(&self, sampler: <Self::A as Api>::Sampler); unsafe fn create_command_encoder( &self, desc: &CommandEncoderDescriptor<'_, Self::A> ) -> Result<<Self::A as Api>::CommandEncoder, DeviceError>; unsafe fn destroy_command_encoder( &self, pool: <Self::A as Api>::CommandEncoder ); unsafe fn create_bind_group_layout( &self, desc: &BindGroupLayoutDescriptor<'_> ) -> Result<<Self::A as Api>::BindGroupLayout, DeviceError>; unsafe fn destroy_bind_group_layout( &self, bg_layout: <Self::A as Api>::BindGroupLayout ); unsafe fn create_pipeline_layout( &self, desc: &PipelineLayoutDescriptor<'_, Self::A> ) -> Result<<Self::A as Api>::PipelineLayout, DeviceError>; unsafe fn destroy_pipeline_layout( &self, pipeline_layout: <Self::A as Api>::PipelineLayout ); unsafe fn create_bind_group( &self, desc: &BindGroupDescriptor<'_, Self::A> ) -> Result<<Self::A as Api>::BindGroup, DeviceError>; unsafe fn destroy_bind_group(&self, group: <Self::A as Api>::BindGroup); unsafe fn create_shader_module( &self, desc: &ShaderModuleDescriptor<'_>, shader: ShaderInput<'_> ) -> Result<<Self::A as Api>::ShaderModule, ShaderError>; unsafe fn destroy_shader_module( &self, module: <Self::A as Api>::ShaderModule ); unsafe fn create_render_pipeline( &self, desc: &RenderPipelineDescriptor<'_, Self::A> ) -> Result<<Self::A as Api>::RenderPipeline, PipelineError>; unsafe fn destroy_render_pipeline( &self, pipeline: <Self::A as Api>::RenderPipeline ); unsafe fn create_compute_pipeline( &self, desc: &ComputePipelineDescriptor<'_, Self::A> ) -> Result<<Self::A as Api>::ComputePipeline, PipelineError>; unsafe fn destroy_compute_pipeline( &self, pipeline: <Self::A as Api>::ComputePipeline ); unsafe fn create_query_set( &self, desc: &QuerySetDescriptor<Label<'_>> ) -> Result<<Self::A as Api>::QuerySet, DeviceError>; unsafe fn destroy_query_set(&self, set: <Self::A as Api>::QuerySet); unsafe fn create_fence( &self ) -> Result<<Self::A as Api>::Fence, DeviceError>; unsafe fn destroy_fence(&self, fence: <Self::A as Api>::Fence); unsafe fn get_fence_value( &self, fence: &<Self::A as Api>::Fence ) -> Result<FenceValue, DeviceError>; unsafe fn wait( &self, fence: &<Self::A as Api>::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<<Self::A as Api>::AccelerationStructure, DeviceError>; unsafe fn get_acceleration_structure_build_sizes( &self, desc: &GetAccelerationStructureBuildSizesDescriptor<'_, Self::A> ) -> AccelerationStructureBuildSizes; unsafe fn get_acceleration_structure_device_address( &self, acceleration_structure: &<Self::A as Api>::AccelerationStructure ) -> BufferAddress; unsafe fn destroy_acceleration_structure( &self, acceleration_structure: <Self::A as Api>::AccelerationStructure );
}

Required Associated Types§

source

type A: Api

Required Methods§

source

unsafe fn exit(self, queue: <Self::A as Api>::Queue)

Exit connection to this logical device.

source

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

Creates a new buffer.

The initial usage is BufferUses::empty().

source

unsafe fn destroy_buffer(&self, buffer: <Self::A as Api>::Buffer)

source

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

source

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

source

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

source

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

source

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

Creates a new texture.

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

source

unsafe fn destroy_texture(&self, texture: <Self::A as Api>::Texture)

source

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

source

unsafe fn destroy_texture_view(&self, view: <Self::A as Api>::TextureView)

source

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

source

unsafe fn destroy_sampler(&self, sampler: <Self::A as Api>::Sampler)

source

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

Create a fresh CommandEncoder.

The new CommandEncoder is in the “closed” state.

source

unsafe fn destroy_command_encoder(&self, pool: <Self::A as Api>::CommandEncoder)

source

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

Creates a bind group layout.

source

unsafe fn destroy_bind_group_layout( &self, bg_layout: <Self::A as Api>::BindGroupLayout )

source

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

source

unsafe fn destroy_pipeline_layout( &self, pipeline_layout: <Self::A as Api>::PipelineLayout )

source

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

source

unsafe fn destroy_bind_group(&self, group: <Self::A as Api>::BindGroup)

source

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

source

unsafe fn destroy_shader_module(&self, module: <Self::A as Api>::ShaderModule)

source

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

source

unsafe fn destroy_render_pipeline( &self, pipeline: <Self::A as Api>::RenderPipeline )

source

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

source

unsafe fn destroy_compute_pipeline( &self, pipeline: <Self::A as Api>::ComputePipeline )

source

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

source

unsafe fn destroy_query_set(&self, set: <Self::A as Api>::QuerySet)

source

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

source

unsafe fn destroy_fence(&self, fence: <Self::A as Api>::Fence)

source

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

source

unsafe fn wait( &self, fence: &<Self::A as Api>::Fence, value: FenceValue, timeout_ms: u32 ) -> Result<bool, DeviceError>

Wait for fence to reach value.

Operations like Queue::submit can accept a Fence and a FenceValue to store in it, so you can use this wait function to wait for a given queue submission to finish execution.

The value argument must be a value that some actual operation you have already presented to the device is going to store in fence. You cannot wait for values yet to be submitted. (This restriction accommodates implementations like the vulkan backend’s FencePool that must allocate a distinct synchronization object for each fence value one is able to wait for.)

Calling wait with a lower FenceValue than fence’s current value returns immediately.

source

unsafe fn start_capture(&self) -> bool

source

unsafe fn stop_capture(&self)

source

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

source

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

source

unsafe fn get_acceleration_structure_device_address( &self, acceleration_structure: &<Self::A as Api>::AccelerationStructure ) -> BufferAddress

source

unsafe fn destroy_acceleration_structure( &self, acceleration_structure: <Self::A as Api>::AccelerationStructure )

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Device for Context

§

type A = Api

source§

impl Device for wgpu_hal::gles::Device

§

type A = Api

source§

impl Device for wgpu_hal::vulkan::Device

§

type A = Api