Crate wgpu

source ·
Expand description

A cross-platform graphics and compute library based on WebGPU.

To start using the API, create an Instance.


Utility structures and functions that are built on top of the main wgpu API.


Macro to load raw SPIR-V data statically, for use with Features::SPIRV_SHADER_PASSTHROUGH.
Macro to load a WGSL module statically.
Macro to produce an array of VertexAttribute.


Handle to a physical graphics and/or compute device.
Information about an adapter.
Represents the backends that wgpu will use.
Handle to a binding group.
Describes a group of bindings and the resources to be bound.
An element of a BindGroupDescriptor, consisting of a bindable resource and the slot to bind it to.
Handle to a binding group layout.
Describes a single binding inside a bind group.
Describes a blend component of a BlendState.
Describe the blend state of a render pipeline, within ColorTargetState.
Handle to a GPU-accessible buffer.
Error occurred when trying to async map a buffer.
Describes the segment of a buffer to bind.
Slice into a Buffer.
Different ways that you can use a buffer.
Read only view into a mapped buffer.
Write only view into mapped buffer.
RGBA double precision color.
Describes the color state of a render pipeline.
Color write mask. Disabled color channels will not be written to.
Handle to a command buffer on the GPU.
Encodes a series of GPU operations.
In-progress recording of a compute pass.
Describes the attachments of a compute pass.
Handle to a compute pipeline.
Describes a compute pipeline.
Instance::create_surface() or a related function failed.
Describes the biasing setting for the depth target.
Describes the depth/stencil state in a render pipeline.
Open connection to a graphics and/or compute device.
Lists various ways the underlying platform does not conform to the WebGPU standard.
Binary flags listing features that may or may not be present on downlevel adapters.
Extent of a texture related operation.
Features that are not guaranteed to be supported.
Describes the fragment processing in a render pipeline.
Opaque globally-unique identifier
View of a buffer which can be used to copy to/from a texture.
View of a texture which can be used to copy to/from a buffer/texture.
Layout of a texture in a buffer’s memory.
Subresource range within an image
Context for all other wgpu objects. Instance of wgpu.
Represents the sets of limits an adapter/device supports.
Describes the multi-sampling state of a render pipeline.
Pair of load and store operations for an attachment aspect.
Origin of a copy to/from a texture.
Handle to a pipeline layout.
Flags for which pipeline data should be recorded.
Describes the state of primitive assembly and rasterization in a render pipeline.
A range of push constant memory to pass to a shader stage.
Handle to a query set.
Handle to a command queue on a device.
A write-only view into a staging buffer
Pre-prepared reusable bundle of GPU operations.
Describes the depth/stencil attachment for render bundles.
Encodes a series of GPU operations into a reusable “render bundle”.
In-progress recording of a render pass.
Describes a color attachment to a RenderPass.
Describes a depth/stencil attachment to a RenderPass.
Describes the attachments of a render pass.
Handle to a rendering (graphics) pipeline.
Describes a render (graphics) pipeline.
Options for requesting adapter.
Requesting a device failed.
Handle to a sampler.
Handle to a compiled shader module.
Descriptor for a shader module given by SPIR-V binary, for use with Device::create_shader_module_spirv.
Describes the shader stages that a binding will be visible from.
Describes stencil state in a render pipeline.
State of the stencil operation (fixed-pipeline stage).
Identifier for a particular call to Queue::submit. Can be used as part of an argument to Device::poll to block for a particular submission to finish.
Handle to a presentable surface.
Defines the capabilities of a given surface and adapter.
Configures a Surface for presentation.
Surface texture that can be rendered to. Result of a successful call to Surface::get_current_texture.
Handle to a texture on the GPU.
Feature flags for a texture format.
Features supported by a given texture format
Different ways that you can use a texture.
Handle to a texture view.
Vertex inputs (attributes) to shaders.
Describes how the vertex buffer is interpreted.
Describes the vertex processing in a render pipeline.


How edges should be handled in texture addressing.
ASTC block dimensions
ASTC RGBA channel
Backends supported by wgpu.
Resource that can be bound to a pipeline.
Specific type of a binding.
Alpha blend factor.
Alpha blend operation.
Specific type of a buffer binding.
Comparison function used for depth and stencil operations.
Specifies how the alpha channel of the textures should be handled during compositing.
Supported physical device types.
Error type
Filter for error scopes.
Face of a vertex.
Texel mixing mode when sampling between texels.
Vertex winding order which classifies the “front” face of a triangle.
Format of indices used with pipeline.
Operation to perform to the output attachment at the start of a renderpass.
Passed to Device::poll to control how and if it should block.
Type of buffer mapping.
Type of drawing mode for polygons
Power Preference when choosing a physical adapter.
Behavior of the presentation engine based on frame rate.
Primitive type the input mesh is composed of.
Type of query contained in a QuerySet.
Specific type of a sampler binding.
Color variation to use when sampler addressing mode is AddressMode::ClampToBorder
Collections of shader features a device supports if they support less than WebGPU normally allows.
Source of a shader module.
Operation to perform on the stencil value.
Specific type of a sample in a texture binding.
Result of an unsuccessful call to Surface::get_current_texture.
Status of the recieved surface image.
Kind of data the texture holds.
Dimensionality of a texture.
Underlying texture data format.
Specific type of a sample in a texture binding.
Dimensions of a particular texture view.
Vertex Format for a VertexAttribute (input).
Whether a vertex buffer is indexed by vertex or by instance.


Buffer to buffer copy as well as buffer clear offsets and sizes must be aligned to this number.
Buffer-Texture copies must have bytes_per_row aligned to this number.
Size to align mappings.
Alignment all push constants need
An offset into the query resolve buffer has to be aligned to this.
Maximum queries in a query set
Size of a single piece of query data.
Vertex buffer strides have to be aligned to this number.


Type for the callback of uncaptured error handler

Type Definitions

Integral type used for buffer offsets.
Integral type used for buffer slice sizes.
Integral type used for dynamic bind group offsets.
View of a buffer which can be used to copy to/from a texture.
View of a texture which can be used to copy to/from a buffer/texture.
Object debugging label.
Passed to Device::poll to control how and if it should block.
Additional information required when requesting an adapter.
Integral type used for binding locations in shaders.