Struct wgpu_core::hub::Global

source ·
pub struct Global<G: GlobalIdentityHandlerFactory> {
    pub instance: Instance,
    pub surfaces: Registry<Surface, SurfaceId, G>,
    /* private fields */
}

Fields§

§instance: Instance§surfaces: Registry<Surface, SurfaceId, G>

Implementations§

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.

Assign id_in an error with the given label.

See create_buffer_error for more context and explaination.

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

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

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.

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.

Check device_id for freeable resources and completed buffer mappings.

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

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.

Safety

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

Safety
  • The raw instance handle returned must not be manually destroyed.
Safety
  • The raw handles obtained from the Instance must not be manually destroyed
Safety

The visual must be valid and able to be used to make a swapchain with.

Safety

hal_adapter must be created from this global internal instance handle.

Safety
  • hal_device must be created from adapter_id or its internal handle.
  • desc must be a subset of hal_device features and limits.
Safety
  • The raw texture handle must not be manually destroyed
Safety
  • The raw adapter handle must not be manually destroyed
Safety
  • The raw device handle must not be manually destroyed

Trait Implementations§

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.