Struct wgpu_core::global::Global

source ·
pub struct Global {
    pub(crate) surfaces: Registry<Arc<Surface>>,
    pub(crate) hub: Hub,
    pub instance: Instance,
}

Fields§

§surfaces: Registry<Arc<Surface>>§hub: Hub§instance: Instance

Implementations§

source§

impl Global

source

pub fn command_encoder_clear_buffer( &self, command_encoder_id: CommandEncoderId, dst: BufferId, offset: BufferAddress, size: Option<BufferAddress>, ) -> Result<(), ClearError>

source

pub fn command_encoder_clear_texture( &self, command_encoder_id: CommandEncoderId, dst: TextureId, subresource_range: &ImageSubresourceRange, ) -> Result<(), ClearError>

source§

impl Global

source

pub fn command_encoder_create_compute_pass( &self, encoder_id: CommandEncoderId, desc: &ComputePassDescriptor<'_>, ) -> (ComputePass, Option<CommandEncoderError>)

Creates a compute pass.

If creation fails, an invalid pass is returned. Any operation on an invalid pass will return an error.

If successful, puts the encoder into the Locked state.

source

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

source§

impl Global

source

pub fn compute_pass_set_bind_group( &self, pass: &mut ComputePass, index: u32, bind_group_id: Option<BindGroupId>, offsets: &[DynamicOffset], ) -> Result<(), ComputePassError>

source

pub fn compute_pass_set_pipeline( &self, pass: &mut ComputePass, pipeline_id: ComputePipelineId, ) -> Result<(), ComputePassError>

source

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

source

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

source

pub fn compute_pass_dispatch_workgroups_indirect( &self, pass: &mut ComputePass, buffer_id: BufferId, offset: BufferAddress, ) -> Result<(), ComputePassError>

source

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

source

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

source

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

source

pub fn compute_pass_write_timestamp( &self, pass: &mut ComputePass, query_set_id: QuerySetId, query_index: u32, ) -> Result<(), ComputePassError>

source

pub fn compute_pass_begin_pipeline_statistics_query( &self, pass: &mut ComputePass, query_set_id: QuerySetId, query_index: u32, ) -> Result<(), ComputePassError>

source

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

source§

impl Global

source

pub fn command_encoder_write_timestamp( &self, command_encoder_id: CommandEncoderId, query_set_id: QuerySetId, query_index: u32, ) -> Result<(), QueryError>

source

pub fn command_encoder_resolve_query_set( &self, command_encoder_id: CommandEncoderId, query_set_id: QuerySetId, start_query: u32, query_count: u32, destination: BufferId, destination_offset: BufferAddress, ) -> Result<(), QueryError>

source§

impl Global

source

pub fn command_encoder_build_acceleration_structures_unsafe_tlas<'a>( &self, command_encoder_id: CommandEncoderId, blas_iter: impl Iterator<Item = BlasBuildEntry<'a>>, tlas_iter: impl Iterator<Item = TlasBuildEntry>, ) -> Result<(), BuildAccelerationStructureError>

source

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

source§

impl Global

source

pub fn command_encoder_create_render_pass( &self, encoder_id: CommandEncoderId, desc: &RenderPassDescriptor<'_>, ) -> (RenderPass, Option<CommandEncoderError>)

Creates a render pass.

If creation fails, an invalid pass is returned. Any operation on an invalid pass will return an error.

If successful, puts the encoder into the Locked state.

source

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

source§

impl Global

source

fn resolve_render_pass_buffer_id( &self, scope: PassErrorScope, buffer_id: Id<Buffer>, ) -> Result<Arc<Buffer>, RenderPassError>

source

fn resolve_render_pass_query_set( &self, scope: PassErrorScope, query_set_id: Id<QuerySet>, ) -> Result<Arc<QuerySet>, RenderPassError>

source

pub fn render_pass_set_bind_group( &self, pass: &mut RenderPass, index: u32, bind_group_id: Option<BindGroupId>, offsets: &[DynamicOffset], ) -> Result<(), RenderPassError>

source

pub fn render_pass_set_pipeline( &self, pass: &mut RenderPass, pipeline_id: RenderPipelineId, ) -> Result<(), RenderPassError>

source

pub fn render_pass_set_index_buffer( &self, pass: &mut RenderPass, buffer_id: BufferId, index_format: IndexFormat, offset: BufferAddress, size: Option<BufferSize>, ) -> Result<(), RenderPassError>

source

pub fn render_pass_set_vertex_buffer( &self, pass: &mut RenderPass, slot: u32, buffer_id: BufferId, offset: BufferAddress, size: Option<BufferSize>, ) -> Result<(), RenderPassError>

source

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

source

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

source

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<(), RenderPassError>

source

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

source

pub fn render_pass_set_push_constants( &self, pass: &mut RenderPass, stages: ShaderStages, offset: u32, data: &[u8], ) -> Result<(), RenderPassError>

source

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

source

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<(), RenderPassError>

source

pub fn render_pass_draw_indirect( &self, pass: &mut RenderPass, buffer_id: BufferId, offset: BufferAddress, ) -> Result<(), RenderPassError>

source

pub fn render_pass_draw_indexed_indirect( &self, pass: &mut RenderPass, buffer_id: BufferId, offset: BufferAddress, ) -> Result<(), RenderPassError>

source

pub fn render_pass_multi_draw_indirect( &self, pass: &mut RenderPass, buffer_id: BufferId, offset: BufferAddress, count: u32, ) -> Result<(), RenderPassError>

source

pub fn render_pass_multi_draw_indexed_indirect( &self, pass: &mut RenderPass, buffer_id: BufferId, offset: BufferAddress, count: u32, ) -> Result<(), RenderPassError>

source

pub fn render_pass_multi_draw_indirect_count( &self, pass: &mut RenderPass, buffer_id: BufferId, offset: BufferAddress, count_buffer_id: BufferId, count_buffer_offset: BufferAddress, max_count: u32, ) -> Result<(), RenderPassError>

source

pub fn render_pass_multi_draw_indexed_indirect_count( &self, pass: &mut RenderPass, buffer_id: BufferId, offset: BufferAddress, count_buffer_id: BufferId, count_buffer_offset: BufferAddress, max_count: u32, ) -> Result<(), RenderPassError>

source

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

source

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

source

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

source

pub fn render_pass_write_timestamp( &self, pass: &mut RenderPass, query_set_id: QuerySetId, query_index: u32, ) -> Result<(), RenderPassError>

source

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

source

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

source

pub fn render_pass_begin_pipeline_statistics_query( &self, pass: &mut RenderPass, query_set_id: QuerySetId, query_index: u32, ) -> Result<(), RenderPassError>

source

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

source

pub fn render_pass_execute_bundles( &self, pass: &mut RenderPass, render_bundle_ids: &[RenderBundleId], ) -> Result<(), RenderPassError>

source§

impl Global

source

pub fn command_encoder_copy_buffer_to_buffer( &self, command_encoder_id: CommandEncoderId, source: BufferId, source_offset: BufferAddress, destination: BufferId, destination_offset: BufferAddress, size: BufferAddress, ) -> Result<(), CopyError>

source

pub fn command_encoder_copy_buffer_to_texture( &self, command_encoder_id: CommandEncoderId, source: &TexelCopyBufferInfo, destination: &TexelCopyTextureInfo, copy_size: &Extent3d, ) -> Result<(), CopyError>

source

pub fn command_encoder_copy_texture_to_buffer( &self, command_encoder_id: CommandEncoderId, source: &TexelCopyTextureInfo, destination: &TexelCopyBufferInfo, copy_size: &Extent3d, ) -> Result<(), CopyError>

source

pub fn command_encoder_copy_texture_to_texture( &self, command_encoder_id: CommandEncoderId, source: &TexelCopyTextureInfo, destination: &TexelCopyTextureInfo, copy_size: &Extent3d, ) -> Result<(), CopyError>

source§

impl Global

source§

impl Global

source

pub fn adapter_is_surface_supported( &self, adapter_id: AdapterId, surface_id: SurfaceId, ) -> bool

source

pub fn surface_get_capabilities( &self, surface_id: SurfaceId, adapter_id: AdapterId, ) -> Result<SurfaceCapabilities, GetSurfaceSupportError>

source

fn fetch_adapter_and_surface<F: FnOnce(&Adapter, &Surface) -> B, B>( &self, surface_id: SurfaceId, adapter_id: AdapterId, get_supported_callback: F, ) -> B

source

pub fn device_features(&self, device_id: DeviceId) -> Features

source

pub fn device_limits(&self, device_id: DeviceId) -> Limits

source

pub fn device_downlevel_properties( &self, device_id: DeviceId, ) -> DownlevelCapabilities

source

pub fn device_create_buffer( &self, device_id: DeviceId, desc: &BufferDescriptor<'_>, id_in: Option<BufferId>, ) -> (BufferId, Option<CreateBufferError>)

source

pub fn create_buffer_error( &self, id_in: Option<BufferId>, desc: &BufferDescriptor<'_>, )

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.

source

pub fn create_render_bundle_error( &self, id_in: Option<RenderBundleId>, desc: &RenderBundleDescriptor<'_>, )

source

pub fn create_texture_error( &self, id_in: Option<TextureId>, desc: &TextureDescriptor<'_>, )

Assign id_in an error with the given label.

See create_buffer_error for more context and explanation.

source

pub fn buffer_destroy(&self, buffer_id: BufferId) -> Result<(), DestroyError>

source

pub fn buffer_drop(&self, buffer_id: BufferId)

source

pub fn device_create_texture( &self, device_id: DeviceId, desc: &TextureDescriptor<'_>, id_in: Option<TextureId>, ) -> (TextureId, Option<CreateTextureError>)

source

pub unsafe fn create_texture_from_hal( &self, hal_texture: Box<dyn DynTexture>, device_id: DeviceId, desc: &TextureDescriptor<'_>, id_in: Option<TextureId>, ) -> (TextureId, Option<CreateTextureError>)

§Safety
  • hal_texture must be created from device_id corresponding raw handle.
  • hal_texture must be created respecting desc
  • hal_texture must be initialized
source

pub unsafe fn create_buffer_from_hal<A: HalApi>( &self, hal_buffer: A::Buffer, device_id: DeviceId, desc: &BufferDescriptor<'_>, id_in: Option<BufferId>, ) -> (BufferId, Option<CreateBufferError>)

§Safety
  • hal_buffer must be created from device_id corresponding raw handle.
  • hal_buffer must be created respecting desc
  • hal_buffer must be initialized
source

pub fn texture_destroy(&self, texture_id: TextureId) -> Result<(), DestroyError>

source

pub fn texture_drop(&self, texture_id: TextureId)

source

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

source

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

source

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

source

pub fn sampler_drop(&self, sampler_id: SamplerId)

source

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

source

pub fn bind_group_layout_drop(&self, bind_group_layout_id: BindGroupLayoutId)

source

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

source

pub fn pipeline_layout_drop(&self, pipeline_layout_id: PipelineLayoutId)

source

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

source

pub fn bind_group_drop(&self, bind_group_id: BindGroupId)

source

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

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.

source

pub unsafe fn device_create_shader_module_spirv( &self, device_id: DeviceId, desc: &ShaderModuleDescriptor<'_>, source: Cow<'_, [u32]>, id_in: Option<ShaderModuleId>, ) -> (ShaderModuleId, Option<CreateShaderModuleError>)

§Safety

This function passes SPIR-V binary to the backend as-is and can potentially result in a driver crash.

source

pub fn shader_module_drop(&self, shader_module_id: ShaderModuleId)

source

pub fn device_create_command_encoder( &self, device_id: DeviceId, desc: &CommandEncoderDescriptor<Label<'_>>, id_in: Option<CommandEncoderId>, ) -> (CommandEncoderId, Option<DeviceError>)

source

pub fn command_encoder_drop(&self, command_encoder_id: CommandEncoderId)

source

pub fn command_buffer_drop(&self, command_buffer_id: CommandBufferId)

source

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

source

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

source

pub fn render_bundle_drop(&self, render_bundle_id: RenderBundleId)

source

pub fn device_create_query_set( &self, device_id: DeviceId, desc: &QuerySetDescriptor<'_>, id_in: Option<QuerySetId>, ) -> (QuerySetId, Option<CreateQuerySetError>)

source

pub fn query_set_drop(&self, query_set_id: QuerySetId)

source

pub fn device_create_render_pipeline( &self, device_id: DeviceId, desc: &RenderPipelineDescriptor<'_>, id_in: Option<RenderPipelineId>, implicit_pipeline_ids: Option<ImplicitPipelineIds<'_>>, ) -> (RenderPipelineId, Option<CreateRenderPipelineError>)

source

pub fn render_pipeline_get_bind_group_layout( &self, pipeline_id: RenderPipelineId, index: u32, id_in: Option<BindGroupLayoutId>, ) -> (BindGroupLayoutId, Option<GetBindGroupLayoutError>)

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.

source

pub fn render_pipeline_drop(&self, render_pipeline_id: RenderPipelineId)

source

pub fn device_create_compute_pipeline( &self, device_id: DeviceId, desc: &ComputePipelineDescriptor<'_>, id_in: Option<ComputePipelineId>, implicit_pipeline_ids: Option<ImplicitPipelineIds<'_>>, ) -> (ComputePipelineId, Option<CreateComputePipelineError>)

source

pub fn compute_pipeline_get_bind_group_layout( &self, pipeline_id: ComputePipelineId, index: u32, id_in: Option<BindGroupLayoutId>, ) -> (BindGroupLayoutId, Option<GetBindGroupLayoutError>)

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.

source

pub fn compute_pipeline_drop(&self, compute_pipeline_id: ComputePipelineId)

source

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

§Safety

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

source

pub fn pipeline_cache_drop(&self, pipeline_cache_id: PipelineCacheId)

source

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

source

pub fn device_poll( &self, device_id: DeviceId, maintain: Maintain<SubmissionIndex>, ) -> Result<bool, WaitIdleError>

Check device_id for freeable resources and completed buffer mappings.

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

source

fn poll_single_device( device: &Device, maintain: Maintain<SubmissionIndex>, ) -> Result<DevicePoll, WaitIdleError>

source

fn poll_all_devices_of_api( &self, force_wait: bool, closures: &mut UserClosures, ) -> Result<bool, WaitIdleError>

Poll all devices belonging to the specified backend.

If force_wait is true, block until all buffer mappings are done.

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

source

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

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.

source

pub fn device_start_capture(&self, device_id: DeviceId)

source

pub fn device_stop_capture(&self, device_id: DeviceId)

source

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

source

pub fn device_drop(&self, device_id: DeviceId)

source

pub fn device_set_device_lost_closure( &self, device_id: DeviceId, device_lost_closure: DeviceLostClosure, )

device_lost_closure might never be called.

source

pub fn device_destroy(&self, device_id: DeviceId)

source

pub fn device_get_internal_counters( &self, device_id: DeviceId, ) -> InternalCounters

source

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

source

pub fn queue_drop(&self, queue_id: QueueId)

source

pub fn buffer_map_async( &self, buffer_id: BufferId, offset: BufferAddress, size: Option<BufferAddress>, op: BufferMapOperation, ) -> Result<SubmissionIndex, BufferAccessError>

op.callback is guaranteed to be called.

source

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

source

pub fn buffer_unmap(&self, buffer_id: BufferId) -> BufferAccessResult

source§

impl Global

source

pub fn queue_write_buffer( &self, queue_id: QueueId, buffer_id: BufferId, buffer_offset: BufferAddress, data: &[u8], ) -> Result<(), QueueWriteError>

source

pub fn queue_create_staging_buffer( &self, queue_id: QueueId, buffer_size: BufferSize, id_in: Option<StagingBufferId>, ) -> Result<(StagingBufferId, NonNull<u8>), QueueWriteError>

source

pub fn queue_write_staging_buffer( &self, queue_id: QueueId, buffer_id: BufferId, buffer_offset: BufferAddress, staging_buffer_id: StagingBufferId, ) -> Result<(), QueueWriteError>

source

pub fn queue_validate_write_buffer( &self, queue_id: QueueId, buffer_id: BufferId, buffer_offset: u64, buffer_size: BufferSize, ) -> Result<(), QueueWriteError>

source

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

source

pub fn queue_submit( &self, queue_id: QueueId, command_buffer_ids: &[CommandBufferId], ) -> Result<SubmissionIndex, (SubmissionIndex, QueueSubmitError)>

source

pub fn queue_get_timestamp_period(&self, queue_id: QueueId) -> f32

source

pub fn queue_on_submitted_work_done( &self, queue_id: QueueId, closure: SubmittedWorkDoneClosure, ) -> SubmissionIndex

source§

impl Global

source

pub fn device_create_blas( &self, device_id: DeviceId, desc: &BlasDescriptor<'_>, sizes: BlasGeometrySizeDescriptors, id_in: Option<BlasId>, ) -> (BlasId, Option<u64>, Option<CreateBlasError>)

source

pub fn device_create_tlas( &self, device_id: DeviceId, desc: &TlasDescriptor<'_>, id_in: Option<TlasId>, ) -> (TlasId, Option<CreateTlasError>)

source

pub fn blas_destroy(&self, blas_id: BlasId) -> Result<(), DestroyError>

source

pub fn blas_drop(&self, blas_id: BlasId)

source

pub fn tlas_destroy(&self, tlas_id: TlasId) -> Result<(), DestroyError>

source

pub fn tlas_drop(&self, tlas_id: TlasId)

source§

impl Global

source

pub fn new(name: &str, instance_desc: InstanceDescriptor) -> Self

source

pub unsafe fn from_hal_instance<A: HalApi>( name: &str, hal_instance: A::Instance, ) -> Self

§Safety

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

source

pub unsafe fn instance_as_hal<A: HalApi>(&self) -> Option<&A::Instance>

§Safety
  • The raw instance handle returned must not be manually destroyed.
source

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

§Safety
  • The raw handles obtained from the Instance must not be manually destroyed
source

pub fn generate_report(&self) -> GlobalReport

source§

impl Global

source

pub fn surface_drop(&self, id: SurfaceId)

source

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

source

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

source

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

§Safety

hal_adapter must be created from this global internal instance handle.

source

pub fn adapter_get_info(&self, adapter_id: AdapterId) -> AdapterInfo

source

pub fn adapter_get_texture_format_features( &self, adapter_id: AdapterId, format: TextureFormat, ) -> TextureFormatFeatures

source

pub fn adapter_features(&self, adapter_id: AdapterId) -> Features

source

pub fn adapter_limits(&self, adapter_id: AdapterId) -> Limits

source

pub fn adapter_downlevel_capabilities( &self, adapter_id: AdapterId, ) -> DownlevelCapabilities

source

pub fn adapter_get_presentation_timestamp( &self, adapter_id: AdapterId, ) -> PresentationTimestamp

source

pub fn adapter_drop(&self, adapter_id: AdapterId)

source§

impl Global

source

pub fn adapter_request_device( &self, adapter_id: AdapterId, desc: &DeviceDescriptor<'_>, trace_path: Option<&Path>, device_id_in: Option<DeviceId>, queue_id_in: Option<QueueId>, ) -> Result<(DeviceId, QueueId), RequestDeviceError>

source

pub unsafe fn create_device_from_hal( &self, adapter_id: AdapterId, hal_device: DynOpenDevice, desc: &DeviceDescriptor<'_>, trace_path: Option<&Path>, device_id_in: Option<DeviceId>, queue_id_in: Option<QueueId>, ) -> Result<(DeviceId, QueueId), RequestDeviceError>

§Safety
  • hal_device must be created from adapter_id or its internal handle.
  • desc must be a subset of hal_device features and limits.
source§

impl Global

source

pub fn surface_get_current_texture( &self, surface_id: SurfaceId, texture_id_in: Option<TextureId>, ) -> Result<SurfaceOutput, SurfaceError>

source

pub fn surface_present( &self, surface_id: SurfaceId, ) -> Result<Status, SurfaceError>

source

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

source§

impl Global

source

pub unsafe fn buffer_as_hal<A: HalApi, F: FnOnce(Option<&A::Buffer>) -> R, R>( &self, id: BufferId, hal_buffer_callback: F, ) -> R

§Safety
  • The raw buffer handle must not be manually destroyed
source

pub unsafe fn texture_as_hal<A: HalApi, F: FnOnce(Option<&A::Texture>) -> R, R>( &self, id: TextureId, hal_texture_callback: F, ) -> R

§Safety
  • The raw texture handle must not be manually destroyed
source

pub unsafe fn texture_view_as_hal<A: HalApi, F: FnOnce(Option<&A::TextureView>) -> R, R>( &self, id: TextureViewId, hal_texture_view_callback: F, ) -> R

§Safety
  • The raw texture view handle must not be manually destroyed
source

pub unsafe fn adapter_as_hal<A: HalApi, F: FnOnce(Option<&A::Adapter>) -> R, R>( &self, id: AdapterId, hal_adapter_callback: F, ) -> R

§Safety
  • The raw adapter handle must not be manually destroyed
source

pub unsafe fn device_as_hal<A: HalApi, F: FnOnce(Option<&A::Device>) -> R, R>( &self, id: DeviceId, hal_device_callback: F, ) -> R

§Safety
  • The raw device handle must not be manually destroyed
source

pub unsafe fn device_fence_as_hal<A: HalApi, F: FnOnce(Option<&A::Fence>) -> R, R>( &self, id: DeviceId, hal_fence_callback: F, ) -> R

§Safety
  • The raw fence handle must not be manually destroyed
source

pub unsafe fn surface_as_hal<A: HalApi, F: FnOnce(Option<&A::Surface>) -> R, R>( &self, id: SurfaceId, hal_surface_callback: F, ) -> R

§Safety
  • The raw surface handle must not be manually destroyed
source

pub unsafe fn command_encoder_as_hal_mut<A: HalApi, F: FnOnce(Option<&mut A::CommandEncoder>) -> R, R>( &self, id: CommandEncoderId, hal_command_encoder_callback: F, ) -> R

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

Trait Implementations§

source§

impl Debug for Global

source§

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

Formats the value using the given formatter. Read more
source§

impl Drop for Global

source§

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 !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
source§

impl<T> Downcast<T> for T

source§

fn downcast(&self) -> &T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.
source§

impl<T> Upcast<T> for T

source§

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

source§

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

source§

impl<T> WasmNotSendSync for T

source§

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