Skip to main content

Global

Struct Global 

pub struct Global {
    pub instance: Instance,
    /* private fields */
}
Available on crate feature unstable-wgpu-28 only.

Fields§

§instance: Instance

Implementations§

§

impl Global

pub unsafe fn buffer_as_hal<A>( &self, id: Id<Buffer>, ) -> Option<impl Deref<Target = <A as Api>::Buffer>>
where A: Api,

Available on crate feature wgpu-28 only.
§Safety
  • The raw buffer handle must not be manually destroyed

pub unsafe fn texture_as_hal<A>( &self, id: Id<Texture>, ) -> Option<impl Deref<Target = <A as Api>::Texture>>
where A: Api,

Available on crate feature wgpu-28 only.
§Safety
  • The raw texture handle must not be manually destroyed

pub unsafe fn texture_view_as_hal<A>( &self, id: Id<TextureView>, ) -> Option<impl Deref<Target = <A as Api>::TextureView>>
where A: Api,

Available on crate feature wgpu-28 only.
§Safety
  • The raw texture view handle must not be manually destroyed

pub unsafe fn adapter_as_hal<A>( &self, id: Id<Adapter>, ) -> Option<impl Deref<Target = <A as Api>::Adapter>>
where A: Api,

Available on crate feature wgpu-28 only.
§Safety
  • The raw adapter handle must not be manually destroyed

pub unsafe fn device_as_hal<A>( &self, id: Id<Device>, ) -> Option<impl Deref<Target = <A as Api>::Device>>
where A: Api,

Available on crate feature wgpu-28 only.
§Safety
  • The raw device handle must not be manually destroyed

pub unsafe fn device_fence_as_hal<A>( &self, id: Id<Device>, ) -> Option<impl Deref<Target = <A as Api>::Fence>>
where A: Api,

Available on crate feature wgpu-28 only.
§Safety
  • The raw fence handle must not be manually destroyed

pub unsafe fn surface_as_hal<A>( &self, id: Id<Surface>, ) -> Option<impl Deref<Target = <A as Api>::Surface>>
where A: Api,

Available on crate feature wgpu-28 only.
§Safety
  • The raw surface handle must not be manually destroyed

pub unsafe fn command_encoder_as_hal_mut<A, F, R>( &self, id: Id<CommandEncoder>, hal_command_encoder_callback: F, ) -> R
where A: Api, F: FnOnce(Option<&mut <A as Api>::CommandEncoder>) -> R,

Available on crate feature wgpu-28 only.

Encode commands using the raw HAL command encoder.

§Panics

If the command encoder has already been used with the wgpu encoding API.

§Safety
  • The raw command encoder handle must not be manually destroyed

pub unsafe fn queue_as_hal<A>( &self, id: Id<Queue>, ) -> Option<impl Deref<Target = <A as Api>::Queue>>
where A: Api,

Available on crate feature wgpu-28 only.
§Safety
  • The raw queue handle must not be manually destroyed

pub unsafe fn blas_as_hal<A>( &self, id: Id<Blas>, ) -> Option<impl Deref<Target = <A as Api>::AccelerationStructure>>
where A: Api,

Available on crate feature wgpu-28 only.
§Safety
  • The raw blas handle must not be manually destroyed

pub unsafe fn tlas_as_hal<A>( &self, id: Id<Tlas>, ) -> Option<impl Deref<Target = <A as Api>::AccelerationStructure>>
where A: Api,

Available on crate feature wgpu-28 only.
§Safety
  • The raw tlas handle must not be manually destroyed
§

impl Global

pub fn command_encoder_clear_buffer( &self, command_encoder_id: Id<CommandEncoder>, dst: Id<Buffer>, offset: u64, size: Option<u64>, ) -> Result<(), EncoderStateError>

Available on crate feature wgpu-28 only.

pub fn command_encoder_clear_texture( &self, command_encoder_id: Id<CommandEncoder>, dst: Id<Texture>, subresource_range: &ImageSubresourceRange, ) -> Result<(), EncoderStateError>

Available on crate feature wgpu-28 only.
§

impl Global

pub fn command_encoder_begin_compute_pass( &self, encoder_id: Id<CommandEncoder>, desc: &ComputePassDescriptor<'_>, ) -> (ComputePass, Option<CommandEncoderError>)

Available on crate feature wgpu-28 only.

Creates a compute pass.

If creation fails, an invalid pass is returned. Attempting to record commands into an invalid pass is permitted, but a validation error will ultimately be generated when the parent encoder is finished, and it is not possible to run any commands from the invalid pass.

If successful, puts the encoder into the Locked state.

pub fn compute_pass_end( &self, pass: &mut ComputePass, ) -> Result<(), EncoderStateError>

Available on crate feature wgpu-28 only.
§

impl Global

pub fn compute_pass_set_bind_group( &self, pass: &mut ComputePass, index: u32, bind_group_id: Option<Id<BindGroup>>, offsets: &[u32], ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn compute_pass_set_pipeline( &self, pass: &mut ComputePass, pipeline_id: Id<ComputePipeline>, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn compute_pass_set_immediates( &self, pass: &mut ComputePass, offset: u32, data: &[u8], ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn compute_pass_dispatch_workgroups( &self, pass: &mut ComputePass, groups_x: u32, groups_y: u32, groups_z: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn compute_pass_dispatch_workgroups_indirect( &self, pass: &mut ComputePass, buffer_id: Id<Buffer>, offset: u64, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn compute_pass_push_debug_group( &self, pass: &mut ComputePass, label: &str, color: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn compute_pass_pop_debug_group( &self, pass: &mut ComputePass, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn compute_pass_insert_debug_marker( &self, pass: &mut ComputePass, label: &str, color: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn compute_pass_write_timestamp( &self, pass: &mut ComputePass, query_set_id: Id<QuerySet>, query_index: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn compute_pass_begin_pipeline_statistics_query( &self, pass: &mut ComputePass, query_set_id: Id<QuerySet>, query_index: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn compute_pass_end_pipeline_statistics_query( &self, pass: &mut ComputePass, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.
§

impl Global

pub fn command_encoder_write_timestamp( &self, command_encoder_id: Id<CommandEncoder>, query_set_id: Id<QuerySet>, query_index: u32, ) -> Result<(), EncoderStateError>

Available on crate feature wgpu-28 only.

pub fn command_encoder_resolve_query_set( &self, command_encoder_id: Id<CommandEncoder>, query_set_id: Id<QuerySet>, start_query: u32, query_count: u32, destination: Id<Buffer>, destination_offset: u64, ) -> Result<(), EncoderStateError>

Available on crate feature wgpu-28 only.
§

impl Global

pub fn command_encoder_mark_acceleration_structures_built( &self, command_encoder_id: Id<CommandEncoder>, blas_ids: &[Id<Blas>], tlas_ids: &[Id<Tlas>], ) -> Result<(), EncoderStateError>

Available on crate feature wgpu-28 only.

pub fn command_encoder_build_acceleration_structures<'a>( &self, command_encoder_id: Id<CommandEncoder>, blas_iter: impl Iterator<Item = BlasBuildEntry<'a>>, tlas_iter: impl Iterator<Item = TlasPackage<'a>>, ) -> Result<(), EncoderStateError>

Available on crate feature wgpu-28 only.
§

impl Global

pub fn command_encoder_begin_render_pass( &self, encoder_id: Id<CommandEncoder>, desc: &RenderPassDescriptor<'_>, ) -> (RenderPass, Option<CommandEncoderError>)

Available on crate feature wgpu-28 only.

Creates a render pass.

If creation fails, an invalid pass is returned. Attempting to record commands into an invalid pass is permitted, but a validation error will ultimately be generated when the parent encoder is finished, and it is not possible to run any commands from the invalid pass.

If successful, puts the encoder into the Locked state.

pub fn render_pass_end( &self, pass: &mut RenderPass, ) -> Result<(), EncoderStateError>

Available on crate feature wgpu-28 only.
§

impl Global

pub fn render_pass_set_bind_group( &self, pass: &mut RenderPass, index: u32, bind_group_id: Option<Id<BindGroup>>, offsets: &[u32], ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_set_pipeline( &self, pass: &mut RenderPass, pipeline_id: Id<RenderPipeline>, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_set_index_buffer( &self, pass: &mut RenderPass, buffer_id: Id<Buffer>, index_format: IndexFormat, offset: u64, size: Option<NonZero<u64>>, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_set_vertex_buffer( &self, pass: &mut RenderPass, slot: u32, buffer_id: Id<Buffer>, offset: u64, size: Option<NonZero<u64>>, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_set_blend_constant( &self, pass: &mut RenderPass, color: Color, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_set_stencil_reference( &self, pass: &mut RenderPass, value: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_set_viewport( &self, pass: &mut RenderPass, x: f32, y: f32, w: f32, h: f32, depth_min: f32, depth_max: f32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_set_scissor_rect( &self, pass: &mut RenderPass, x: u32, y: u32, w: u32, h: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_set_immediates( &self, pass: &mut RenderPass, offset: u32, data: &[u8], ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_draw( &self, pass: &mut RenderPass, vertex_count: u32, instance_count: u32, first_vertex: u32, first_instance: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_draw_indexed( &self, pass: &mut RenderPass, index_count: u32, instance_count: u32, first_index: u32, base_vertex: i32, first_instance: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_draw_mesh_tasks( &self, pass: &mut RenderPass, group_count_x: u32, group_count_y: u32, group_count_z: u32, ) -> Result<(), RenderPassError>

Available on crate feature wgpu-28 only.

pub fn render_pass_draw_indirect( &self, pass: &mut RenderPass, buffer_id: Id<Buffer>, offset: u64, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_draw_indexed_indirect( &self, pass: &mut RenderPass, buffer_id: Id<Buffer>, offset: u64, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_draw_mesh_tasks_indirect( &self, pass: &mut RenderPass, buffer_id: Id<Buffer>, offset: u64, ) -> Result<(), RenderPassError>

Available on crate feature wgpu-28 only.

pub fn render_pass_multi_draw_indirect( &self, pass: &mut RenderPass, buffer_id: Id<Buffer>, offset: u64, count: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_multi_draw_indexed_indirect( &self, pass: &mut RenderPass, buffer_id: Id<Buffer>, offset: u64, count: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_multi_draw_mesh_tasks_indirect( &self, pass: &mut RenderPass, buffer_id: Id<Buffer>, offset: u64, count: u32, ) -> Result<(), RenderPassError>

Available on crate feature wgpu-28 only.

pub fn render_pass_multi_draw_indirect_count( &self, pass: &mut RenderPass, buffer_id: Id<Buffer>, offset: u64, count_buffer_id: Id<Buffer>, count_buffer_offset: u64, max_count: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_multi_draw_indexed_indirect_count( &self, pass: &mut RenderPass, buffer_id: Id<Buffer>, offset: u64, count_buffer_id: Id<Buffer>, count_buffer_offset: u64, max_count: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_multi_draw_mesh_tasks_indirect_count( &self, pass: &mut RenderPass, buffer_id: Id<Buffer>, offset: u64, count_buffer_id: Id<Buffer>, count_buffer_offset: u64, max_count: u32, ) -> Result<(), RenderPassError>

Available on crate feature wgpu-28 only.

pub fn render_pass_push_debug_group( &self, pass: &mut RenderPass, label: &str, color: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_pop_debug_group( &self, pass: &mut RenderPass, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_insert_debug_marker( &self, pass: &mut RenderPass, label: &str, color: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_write_timestamp( &self, pass: &mut RenderPass, query_set_id: Id<QuerySet>, query_index: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_begin_occlusion_query( &self, pass: &mut RenderPass, query_index: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_end_occlusion_query( &self, pass: &mut RenderPass, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_begin_pipeline_statistics_query( &self, pass: &mut RenderPass, query_set_id: Id<QuerySet>, query_index: u32, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_end_pipeline_statistics_query( &self, pass: &mut RenderPass, ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.

pub fn render_pass_execute_bundles( &self, pass: &mut RenderPass, render_bundle_ids: &[Id<RenderBundle>], ) -> Result<(), PassStateError>

Available on crate feature wgpu-28 only.
§

impl Global

pub fn command_encoder_copy_buffer_to_buffer( &self, command_encoder_id: Id<CommandEncoder>, source: Id<Buffer>, source_offset: u64, destination: Id<Buffer>, destination_offset: u64, size: Option<u64>, ) -> Result<(), EncoderStateError>

Available on crate feature wgpu-28 only.

pub fn command_encoder_copy_buffer_to_texture( &self, command_encoder_id: Id<CommandEncoder>, source: &TexelCopyBufferInfo<Id<Buffer>>, destination: &TexelCopyTextureInfo<Id<Texture>>, copy_size: &Extent3d, ) -> Result<(), EncoderStateError>

Available on crate feature wgpu-28 only.

pub fn command_encoder_copy_texture_to_buffer( &self, command_encoder_id: Id<CommandEncoder>, source: &TexelCopyTextureInfo<Id<Texture>>, destination: &TexelCopyBufferInfo<Id<Buffer>>, copy_size: &Extent3d, ) -> Result<(), EncoderStateError>

Available on crate feature wgpu-28 only.

pub fn command_encoder_copy_texture_to_texture( &self, command_encoder_id: Id<CommandEncoder>, source: &TexelCopyTextureInfo<Id<Texture>>, destination: &TexelCopyTextureInfo<Id<Texture>>, copy_size: &Extent3d, ) -> Result<(), EncoderStateError>

Available on crate feature wgpu-28 only.
§

impl Global

pub fn command_encoder_transition_resources( &self, command_encoder_id: Id<CommandEncoder>, buffer_transitions: impl Iterator<Item = BufferTransition<Id<Buffer>>>, texture_transitions: impl Iterator<Item = TextureTransition<Id<Texture>>>, ) -> Result<(), EncoderStateError>

Available on crate feature wgpu-28 only.
§

impl Global

pub fn command_encoder_finish( &self, encoder_id: Id<CommandEncoder>, desc: &CommandBufferDescriptor<Option<Cow<'_, str>>>, id_in: Option<Id<CommandBuffer>>, ) -> (Id<CommandBuffer>, Option<(String, CommandEncoderError)>)

Available on crate feature wgpu-28 only.

Finishes a command encoder, creating a command buffer and returning errors that were deferred until now.

The returned String is the label of the command encoder, supplied so that wgpu can include the label when printing deferred errors without having its own copy of the label. This is a kludge and should be replaced if we think of a better solution to propagating labels.

pub fn command_encoder_push_debug_group( &self, encoder_id: Id<CommandEncoder>, label: &str, ) -> Result<(), EncoderStateError>

Available on crate feature wgpu-28 only.

pub fn command_encoder_insert_debug_marker( &self, encoder_id: Id<CommandEncoder>, label: &str, ) -> Result<(), EncoderStateError>

Available on crate feature wgpu-28 only.

pub fn command_encoder_pop_debug_group( &self, encoder_id: Id<CommandEncoder>, ) -> Result<(), EncoderStateError>

Available on crate feature wgpu-28 only.
§

impl Global

pub fn adapter_is_surface_supported( &self, adapter_id: Id<Adapter>, surface_id: Id<Surface>, ) -> bool

Available on crate feature wgpu-28 only.

pub fn surface_get_capabilities( &self, surface_id: Id<Surface>, adapter_id: Id<Adapter>, ) -> Result<SurfaceCapabilities, GetSurfaceSupportError>

Available on crate feature wgpu-28 only.

pub fn device_features(&self, device_id: Id<Device>) -> Features

Available on crate feature wgpu-28 only.

pub fn device_limits(&self, device_id: Id<Device>) -> Limits

Available on crate feature wgpu-28 only.

pub fn device_downlevel_properties( &self, device_id: Id<Device>, ) -> DownlevelCapabilities

Available on crate feature wgpu-28 only.

pub fn device_create_buffer( &self, device_id: Id<Device>, desc: &BufferDescriptor<Option<Cow<'_, str>>>, id_in: Option<Id<Buffer>>, ) -> (Id<Buffer>, Option<CreateBufferError>)

Available on crate feature wgpu-28 only.

pub fn create_buffer_error( &self, id_in: Option<Id<Buffer>>, desc: &BufferDescriptor<Option<Cow<'_, str>>>, )

Available on crate feature wgpu-28 only.

Assign id_in an error with the given label.

Ensure that future attempts to use id_in as a buffer ID will propagate the error, following the WebGPU “contagious invalidity” style.

Firefox uses this function to comply strictly with the WebGPU spec, which requires GPUBufferDescriptor validation to be generated on the Device timeline and leave the newly created GPUBuffer invalid.

Ideally, we would simply let device_create_buffer take care of all of this, but some errors must be detected before we can even construct a wgpu_types::BufferDescriptor to give it. For example, the WebGPU API allows a GPUBufferDescriptor’s usage property to be any WebIDL unsigned long value, but we can’t construct a wgpu_types::BufferUsages value from values with unassigned bits set. This means we must validate usage before we can call device_create_buffer.

When that validation fails, we must arrange for the buffer id to be considered invalid. This method provides the means to do so.

pub fn create_render_bundle_error( &self, id_in: Option<Id<RenderBundle>>, desc: &RenderBundleDescriptor<Option<Cow<'_, str>>>, )

Available on crate feature wgpu-28 only.

Assign id_in an error with the given label.

See Self::create_buffer_error for more context and explanation.

pub fn create_texture_error( &self, id_in: Option<Id<Texture>>, desc: &TextureDescriptor<Option<Cow<'_, str>>, Vec<TextureFormat>>, )

Available on crate feature wgpu-28 only.

Assign id_in an error with the given label.

See Self::create_buffer_error for more context and explanation.

pub fn create_external_texture_error( &self, id_in: Option<Id<ExternalTexture>>, desc: &ExternalTextureDescriptor<Option<Cow<'_, str>>>, )

Available on crate feature wgpu-28 only.

Assign id_in an error with the given label.

See Self::create_buffer_error for more context and explanation.

pub fn create_bind_group_layout_error( &self, id_in: Option<Id<BindGroupLayout>>, label: Option<Cow<'_, str>>, )

Available on crate feature wgpu-28 only.

Assign id_in an error with the given label.

In JavaScript environments, it is possible to call GPUDevice.createBindGroupLayout with entries that are invalid. Because our Rust’s types for bind group layouts prevent even calling Self::device_create_bind_group, we let standards-compliant environments register an invalid bind group layout so this crate’s API can still be consistently used.

See Self::create_buffer_error for additional context and explanation.

pub fn buffer_destroy(&self, buffer_id: Id<Buffer>)

Available on crate feature wgpu-28 only.

pub fn buffer_drop(&self, buffer_id: Id<Buffer>)

Available on crate feature wgpu-28 only.

pub fn device_create_texture( &self, device_id: Id<Device>, desc: &TextureDescriptor<Option<Cow<'_, str>>, Vec<TextureFormat>>, id_in: Option<Id<Texture>>, ) -> (Id<Texture>, Option<CreateTextureError>)

Available on crate feature wgpu-28 only.

pub unsafe fn create_texture_from_hal( &self, hal_texture: Box<dyn DynTexture>, device_id: Id<Device>, desc: &TextureDescriptor<Option<Cow<'_, str>>, Vec<TextureFormat>>, id_in: Option<Id<Texture>>, ) -> (Id<Texture>, Option<CreateTextureError>)

Available on crate feature wgpu-28 only.
§Safety
  • hal_texture must be created from device_id corresponding raw handle.
  • hal_texture must be created respecting desc
  • hal_texture must be initialized

pub unsafe fn create_buffer_from_hal<A>( &self, hal_buffer: <A as Api>::Buffer, device_id: Id<Device>, desc: &BufferDescriptor<Option<Cow<'_, str>>>, id_in: Option<Id<Buffer>>, ) -> (Id<Buffer>, Option<CreateBufferError>)
where A: Api,

Available on crate feature wgpu-28 only.
§Safety
  • hal_buffer must be created from device_id corresponding raw handle.
  • hal_buffer must be created respecting desc
  • hal_buffer must be initialized
  • hal_buffer must not have zero size.

pub fn texture_destroy(&self, texture_id: Id<Texture>)

Available on crate feature wgpu-28 only.

pub fn texture_drop(&self, texture_id: Id<Texture>)

Available on crate feature wgpu-28 only.

pub fn texture_create_view( &self, texture_id: Id<Texture>, desc: &TextureViewDescriptor<'_>, id_in: Option<Id<TextureView>>, ) -> (Id<TextureView>, Option<CreateTextureViewError>)

Available on crate feature wgpu-28 only.

pub fn texture_view_drop( &self, texture_view_id: Id<TextureView>, ) -> Result<(), TextureViewDestroyError>

Available on crate feature wgpu-28 only.

pub fn device_create_external_texture( &self, device_id: Id<Device>, desc: &ExternalTextureDescriptor<Option<Cow<'_, str>>>, planes: &[Id<TextureView>], id_in: Option<Id<ExternalTexture>>, ) -> (Id<ExternalTexture>, Option<CreateExternalTextureError>)

Available on crate feature wgpu-28 only.

pub fn external_texture_destroy(&self, external_texture_id: Id<ExternalTexture>)

Available on crate feature wgpu-28 only.

pub fn external_texture_drop(&self, external_texture_id: Id<ExternalTexture>)

Available on crate feature wgpu-28 only.

pub fn device_create_sampler( &self, device_id: Id<Device>, desc: &SamplerDescriptor<'_>, id_in: Option<Id<Sampler>>, ) -> (Id<Sampler>, Option<CreateSamplerError>)

Available on crate feature wgpu-28 only.

pub fn sampler_drop(&self, sampler_id: Id<Sampler>)

Available on crate feature wgpu-28 only.

pub fn device_create_bind_group_layout( &self, device_id: Id<Device>, desc: &BindGroupLayoutDescriptor<'_>, id_in: Option<Id<BindGroupLayout>>, ) -> (Id<BindGroupLayout>, Option<CreateBindGroupLayoutError>)

Available on crate feature wgpu-28 only.

pub fn bind_group_layout_drop(&self, bind_group_layout_id: Id<BindGroupLayout>)

Available on crate feature wgpu-28 only.

pub fn device_create_pipeline_layout( &self, device_id: Id<Device>, desc: &PipelineLayoutDescriptor<'_>, id_in: Option<Id<PipelineLayout>>, ) -> (Id<PipelineLayout>, Option<CreatePipelineLayoutError>)

Available on crate feature wgpu-28 only.

pub fn pipeline_layout_drop(&self, pipeline_layout_id: Id<PipelineLayout>)

Available on crate feature wgpu-28 only.

pub fn device_create_bind_group( &self, device_id: Id<Device>, desc: &BindGroupDescriptor<'_>, id_in: Option<Id<BindGroup>>, ) -> (Id<BindGroup>, Option<CreateBindGroupError>)

Available on crate feature wgpu-28 only.

pub fn bind_group_drop(&self, bind_group_id: Id<BindGroup>)

Available on crate feature wgpu-28 only.

pub fn device_create_shader_module( &self, device_id: Id<Device>, desc: &ShaderModuleDescriptor<'_>, source: ShaderModuleSource<'_>, id_in: Option<Id<ShaderModule>>, ) -> (Id<ShaderModule>, Option<CreateShaderModuleError>)

Available on crate feature wgpu-28 only.

Create a shader module with the given source.

This function may consume a lot of stack space. Compiler-enforced limits for parsing recursion exist; if shader compilation runs into them, it will return an error gracefully. However, on some build profiles and platforms, the default stack size for a thread may be exceeded before this limit is reached during parsing. Callers should ensure that there is enough stack space for this, particularly if calls to this method are exposed to user input.

pub unsafe fn device_create_shader_module_passthrough( &self, device_id: Id<Device>, desc: &CreateShaderModuleDescriptorPassthrough<'_, Option<Cow<'_, str>>>, id_in: Option<Id<ShaderModule>>, ) -> (Id<ShaderModule>, Option<CreateShaderModuleError>)

Available on crate feature wgpu-28 only.
§Safety

This function passes source code or binary to the backend as-is and can potentially result in a driver crash.

pub fn shader_module_drop(&self, shader_module_id: Id<ShaderModule>)

Available on crate feature wgpu-28 only.

pub fn device_create_command_encoder( &self, device_id: Id<Device>, desc: &CommandEncoderDescriptor<Option<Cow<'_, str>>>, id_in: Option<Id<CommandEncoder>>, ) -> (Id<CommandEncoder>, Option<DeviceError>)

Available on crate feature wgpu-28 only.

pub fn command_encoder_drop(&self, command_encoder_id: Id<CommandEncoder>)

Available on crate feature wgpu-28 only.

pub fn command_buffer_drop(&self, command_buffer_id: Id<CommandBuffer>)

Available on crate feature wgpu-28 only.

pub fn device_create_render_bundle_encoder( &self, device_id: Id<Device>, desc: &RenderBundleEncoderDescriptor<'_>, ) -> (*mut RenderBundleEncoder, Option<CreateRenderBundleError>)

Available on crate feature wgpu-28 only.

pub fn render_bundle_encoder_finish( &self, bundle_encoder: RenderBundleEncoder, desc: &RenderBundleDescriptor<Option<Cow<'_, str>>>, id_in: Option<Id<RenderBundle>>, ) -> (Id<RenderBundle>, Option<RenderBundleError>)

Available on crate feature wgpu-28 only.

pub fn render_bundle_drop(&self, render_bundle_id: Id<RenderBundle>)

Available on crate feature wgpu-28 only.

pub fn device_create_query_set( &self, device_id: Id<Device>, desc: &QuerySetDescriptor<Option<Cow<'_, str>>>, id_in: Option<Id<QuerySet>>, ) -> (Id<QuerySet>, Option<CreateQuerySetError>)

Available on crate feature wgpu-28 only.

pub fn query_set_drop(&self, query_set_id: Id<QuerySet>)

Available on crate feature wgpu-28 only.

pub fn device_create_render_pipeline( &self, device_id: Id<Device>, desc: &RenderPipelineDescriptor<'_>, id_in: Option<Id<RenderPipeline>>, ) -> (Id<RenderPipeline>, Option<CreateRenderPipelineError>)

Available on crate feature wgpu-28 only.

pub fn device_create_mesh_pipeline( &self, device_id: Id<Device>, desc: &MeshPipelineDescriptor<'_>, id_in: Option<Id<RenderPipeline>>, ) -> (Id<RenderPipeline>, Option<CreateRenderPipelineError>)

Available on crate feature wgpu-28 only.

pub fn render_pipeline_get_bind_group_layout( &self, pipeline_id: Id<RenderPipeline>, index: u32, id_in: Option<Id<BindGroupLayout>>, ) -> (Id<BindGroupLayout>, Option<GetBindGroupLayoutError>)

Available on crate feature wgpu-28 only.

Get an ID of one of the bind group layouts. The ID adds a refcount, which needs to be released by calling bind_group_layout_drop.

pub fn render_pipeline_drop(&self, render_pipeline_id: Id<RenderPipeline>)

Available on crate feature wgpu-28 only.

pub fn device_create_compute_pipeline( &self, device_id: Id<Device>, desc: &ComputePipelineDescriptor<'_>, id_in: Option<Id<ComputePipeline>>, ) -> (Id<ComputePipeline>, Option<CreateComputePipelineError>)

Available on crate feature wgpu-28 only.

pub fn compute_pipeline_get_bind_group_layout( &self, pipeline_id: Id<ComputePipeline>, index: u32, id_in: Option<Id<BindGroupLayout>>, ) -> (Id<BindGroupLayout>, Option<GetBindGroupLayoutError>)

Available on crate feature wgpu-28 only.

Get an ID of one of the bind group layouts. The ID adds a refcount, which needs to be released by calling bind_group_layout_drop.

pub fn compute_pipeline_drop(&self, compute_pipeline_id: Id<ComputePipeline>)

Available on crate feature wgpu-28 only.

pub unsafe fn device_create_pipeline_cache( &self, device_id: Id<Device>, desc: &PipelineCacheDescriptor<'_>, id_in: Option<Id<PipelineCache>>, ) -> (Id<PipelineCache>, Option<CreatePipelineCacheError>)

Available on crate feature wgpu-28 only.
§Safety

The data argument of desc must have been returned by Self::pipeline_cache_get_data for the same adapter

pub fn pipeline_cache_drop(&self, pipeline_cache_id: Id<PipelineCache>)

Available on crate feature wgpu-28 only.

pub fn surface_configure( &self, surface_id: Id<Surface>, device_id: Id<Device>, config: &SurfaceConfiguration<Vec<TextureFormat>>, ) -> Option<ConfigureSurfaceError>

Available on crate feature wgpu-28 only.

pub fn device_poll( &self, device_id: Id<Device>, poll_type: PollType<u64>, ) -> Result<PollStatus, WaitIdleError>

Available on crate feature wgpu-28 only.

Check device_id for freeable resources and completed buffer mappings.

Return queue_empty indicating whether there are more queue submissions still in flight.

pub fn poll_all_devices(&self, force_wait: bool) -> Result<bool, WaitIdleError>

Available on crate feature wgpu-28 only.

Poll all devices on all backends.

This is the implementation of wgpu::Instance::poll_all.

Return all_queue_empty indicating whether there are more queue submissions still in flight.

pub unsafe fn device_start_graphics_debugger_capture( &self, device_id: Id<Device>, )

Available on crate feature wgpu-28 only.
§Safety

pub unsafe fn device_stop_graphics_debugger_capture( &self, device_id: Id<Device>, )

Available on crate feature wgpu-28 only.
§Safety

pub fn pipeline_cache_get_data(&self, id: Id<PipelineCache>) -> Option<Vec<u8>>

Available on crate feature wgpu-28 only.

pub fn device_drop(&self, device_id: Id<Device>)

Available on crate feature wgpu-28 only.

pub fn device_set_device_lost_closure( &self, device_id: Id<Device>, device_lost_closure: Box<dyn FnOnce(DeviceLostReason, String) + Send>, )

Available on crate feature wgpu-28 only.

device_lost_closure might never be called.

pub fn device_destroy(&self, device_id: Id<Device>)

Available on crate feature wgpu-28 only.

pub fn device_get_internal_counters( &self, device_id: Id<Device>, ) -> InternalCounters

Available on crate feature wgpu-28 only.

pub fn device_generate_allocator_report( &self, device_id: Id<Device>, ) -> Option<AllocatorReport>

Available on crate feature wgpu-28 only.

pub fn queue_drop(&self, queue_id: Id<Queue>)

Available on crate feature wgpu-28 only.

pub fn buffer_map_async( &self, buffer_id: Id<Buffer>, offset: u64, size: Option<u64>, op: BufferMapOperation, ) -> Result<u64, BufferAccessError>

Available on crate feature wgpu-28 only.

op.callback is guaranteed to be called.

pub fn buffer_get_mapped_range( &self, buffer_id: Id<Buffer>, offset: u64, size: Option<u64>, ) -> Result<(NonNull<u8>, u64), BufferAccessError>

Available on crate feature wgpu-28 only.

pub fn buffer_unmap( &self, buffer_id: Id<Buffer>, ) -> Result<(), BufferAccessError>

Available on crate feature wgpu-28 only.
§

impl Global

pub fn queue_write_buffer( &self, queue_id: Id<Queue>, buffer_id: Id<Buffer>, buffer_offset: u64, data: &[u8], ) -> Result<(), QueueWriteError>

Available on crate feature wgpu-28 only.

pub fn queue_create_staging_buffer( &self, queue_id: Id<Queue>, buffer_size: NonZero<u64>, id_in: Option<Id<StagingBuffer>>, ) -> Result<(Id<StagingBuffer>, NonNull<u8>), QueueWriteError>

Available on crate feature wgpu-28 only.

pub fn queue_write_staging_buffer( &self, queue_id: Id<Queue>, buffer_id: Id<Buffer>, buffer_offset: u64, staging_buffer_id: Id<StagingBuffer>, ) -> Result<(), QueueWriteError>

Available on crate feature wgpu-28 only.

pub fn queue_validate_write_buffer( &self, queue_id: Id<Queue>, buffer_id: Id<Buffer>, buffer_offset: u64, buffer_size: NonZero<u64>, ) -> Result<(), QueueWriteError>

Available on crate feature wgpu-28 only.

pub fn queue_write_texture( &self, queue_id: Id<Queue>, destination: &TexelCopyTextureInfo<Id<Texture>>, data: &[u8], data_layout: &TexelCopyBufferLayout, size: &Extent3d, ) -> Result<(), QueueWriteError>

Available on crate feature wgpu-28 only.

pub fn queue_submit( &self, queue_id: Id<Queue>, command_buffer_ids: &[Id<CommandBuffer>], ) -> Result<u64, (u64, QueueSubmitError)>

Available on crate feature wgpu-28 only.

pub fn queue_get_timestamp_period(&self, queue_id: Id<Queue>) -> f32

Available on crate feature wgpu-28 only.

pub fn queue_on_submitted_work_done( &self, queue_id: Id<Queue>, closure: Box<dyn FnOnce() + Send>, ) -> u64

Available on crate feature wgpu-28 only.

pub fn queue_compact_blas( &self, queue_id: Id<Queue>, blas_id: Id<Blas>, id_in: Option<Id<Blas>>, ) -> (Id<Blas>, Option<u64>, Option<CompactBlasError>)

Available on crate feature wgpu-28 only.
§

impl Global

pub fn device_create_blas( &self, device_id: Id<Device>, desc: &CreateBlasDescriptor<Option<Cow<'_, str>>>, sizes: BlasGeometrySizeDescriptors, id_in: Option<Id<Blas>>, ) -> (Id<Blas>, Option<u64>, Option<CreateBlasError>)

Available on crate feature wgpu-28 only.

pub fn device_create_tlas( &self, device_id: Id<Device>, desc: &CreateTlasDescriptor<Option<Cow<'_, str>>>, id_in: Option<Id<Tlas>>, ) -> (Id<Tlas>, Option<CreateTlasError>)

Available on crate feature wgpu-28 only.

pub fn blas_drop(&self, blas_id: Id<Blas>)

Available on crate feature wgpu-28 only.

pub fn tlas_drop(&self, tlas_id: Id<Tlas>)

Available on crate feature wgpu-28 only.

pub fn blas_prepare_compact_async( &self, blas_id: Id<Blas>, callback: Option<Box<dyn FnOnce(Result<(), BlasPrepareCompactError>) + Send>>, ) -> Result<u64, BlasPrepareCompactError>

Available on crate feature wgpu-28 only.

pub fn ready_for_compaction( &self, blas_id: Id<Blas>, ) -> Result<bool, InvalidResourceError>

Available on crate feature wgpu-28 only.
§

impl Global

pub fn new( name: &str, instance_desc: &InstanceDescriptor, telemetry: Option<Telemetry>, ) -> Global

Available on crate feature wgpu-28 only.

pub unsafe fn from_hal_instance<A>( name: &str, hal_instance: <A as Api>::Instance, ) -> Global
where A: Api,

Available on crate feature wgpu-28 only.
§Safety

Refer to the creation of wgpu-hal Instance for every backend.

pub unsafe fn instance_as_hal<A>(&self) -> Option<&<A as Api>::Instance>
where A: Api,

Available on crate feature wgpu-28 only.
§Safety
  • The raw instance handle returned must not be manually destroyed.

pub unsafe fn from_instance(instance: Instance) -> Global

Available on crate feature wgpu-28 only.
§Safety
  • The raw handles obtained from the Instance must not be manually destroyed

pub fn generate_report(&self) -> GlobalReport

Available on crate feature wgpu-28 only.
§

impl Global

pub unsafe fn instance_create_surface( &self, display_handle: RawDisplayHandle, window_handle: RawWindowHandle, id_in: Option<Id<Surface>>, ) -> Result<Id<Surface>, CreateSurfaceError>

Available on crate features wgpu-28 and raw-window-handle only.

Creates a new surface targeting the given display/window handles.

Internally attempts to create hal surfaces for all enabled backends.

Fails only if creation for surfaces for all enabled backends fails in which case the error for each enabled backend is listed. Vice versa, if creation for any backend succeeds, success is returned. Surface creation errors are logged to the debug log in any case.

id_in:

  • If Some, the id to assign to the surface. A new one will be generated otherwise.
§Safety
  • display_handle must be a valid object to create a surface upon.
  • window_handle must remain valid as long as the returned SurfaceId is being used.

pub unsafe fn instance_create_surface_from_drm( &self, fd: i32, plane: u32, connector_id: u32, width: u32, height: u32, refresh_rate: u32, id_in: Option<Id<Surface>>, ) -> Result<Id<Surface>, CreateSurfaceError>

Available on crate feature wgpu-28 and Unix and non-Apple and non-target_family=wasm only.

Creates a new surface from the given drm configuration.

§Safety
  • All parameters must point to valid DRM values.
§Platform Support

This function is only available on non-apple Unix-like platforms (Linux, FreeBSD) and currently only works with the Vulkan backend.

pub fn surface_drop(&self, id: Id<Surface>)

Available on crate feature wgpu-28 only.

pub fn enumerate_adapters(&self, backends: Backends) -> Vec<Id<Adapter>>

Available on crate feature wgpu-28 only.

pub fn request_adapter( &self, desc: &RequestAdapterOptions<Id<Surface>>, backends: Backends, id_in: Option<Id<Adapter>>, ) -> Result<Id<Adapter>, RequestAdapterError>

Available on crate feature wgpu-28 only.

pub unsafe fn create_adapter_from_hal( &self, hal_adapter: DynExposedAdapter, input: Option<Id<Adapter>>, ) -> Id<Adapter>

Available on crate feature wgpu-28 only.
§Safety

hal_adapter must be created from this global internal instance handle.

pub fn adapter_get_info(&self, adapter_id: Id<Adapter>) -> AdapterInfo

Available on crate feature wgpu-28 only.

pub fn adapter_get_texture_format_features( &self, adapter_id: Id<Adapter>, format: TextureFormat, ) -> TextureFormatFeatures

Available on crate feature wgpu-28 only.

pub fn adapter_features(&self, adapter_id: Id<Adapter>) -> Features

Available on crate feature wgpu-28 only.

pub fn adapter_limits(&self, adapter_id: Id<Adapter>) -> Limits

Available on crate feature wgpu-28 only.

pub fn adapter_downlevel_capabilities( &self, adapter_id: Id<Adapter>, ) -> DownlevelCapabilities

Available on crate feature wgpu-28 only.

pub fn adapter_get_presentation_timestamp( &self, adapter_id: Id<Adapter>, ) -> PresentationTimestamp

Available on crate feature wgpu-28 only.

pub fn adapter_drop(&self, adapter_id: Id<Adapter>)

Available on crate feature wgpu-28 only.
§

impl Global

pub fn adapter_request_device( &self, adapter_id: Id<Adapter>, desc: &DeviceDescriptor<Option<Cow<'_, str>>>, device_id_in: Option<Id<Device>>, queue_id_in: Option<Id<Queue>>, ) -> Result<(Id<Device>, Id<Queue>), RequestDeviceError>

Available on crate feature wgpu-28 only.

pub unsafe fn create_device_from_hal( &self, adapter_id: Id<Adapter>, hal_device: DynOpenDevice, desc: &DeviceDescriptor<Option<Cow<'_, str>>>, device_id_in: Option<Id<Device>>, queue_id_in: Option<Id<Queue>>, ) -> Result<(Id<Device>, Id<Queue>), RequestDeviceError>

Available on crate feature wgpu-28 only.
§Safety
  • hal_device must be created from adapter_id or its internal handle.
  • desc must be a subset of hal_device features and limits.
§

impl Global

pub fn surface_get_current_texture( &self, surface_id: Id<Surface>, texture_id_in: Option<Id<Texture>>, ) -> Result<SurfaceOutput, SurfaceError>

Available on crate feature wgpu-28 only.

pub fn surface_present( &self, surface_id: Id<Surface>, ) -> Result<SurfaceStatus, SurfaceError>

Available on crate feature wgpu-28 only.

pub fn surface_texture_discard( &self, surface_id: Id<Surface>, ) -> Result<(), SurfaceError>

Available on crate feature wgpu-28 only.

Trait Implementations§

§

impl Debug for Global

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Drop for Global

§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl !Freeze for Global

§

impl !RefUnwindSafe for Global

§

impl Send for Global

§

impl Sync for Global

§

impl Unpin for Global

§

impl UnsafeUnpin for Global

§

impl !UnwindSafe for Global

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T

§

impl<T> WasmNotSendSync for T

§

impl<T> WasmNotSync for T
where T: Sync,

§

impl<T> WasmNotSync for T
where T: Sync,