Expand description
This library describes the API surface of WebGPU that is agnostic of the backend. This API is used for targeting both Web and Native.
Re-exports§
pub use instance::*;
Modules§
- assertions
- Macros for validation internal to the wgpu.
- cast_
utils 🔒 - counters 🔒
- env 🔒
- error
- Shared types for WebGPU errors. See also: https://gpuweb.github.io/gpuweb/#errors-and-debugging
- features 🔒
- instance
- Types for dealing with Instances
- math
- Utilitary math functions.
- tokens 🔒
- transfers 🔒
Macros§
- bytemuck_
wrapper - Wrapper to unsafely define a wrapper type that can be used with
bytemuck
’s traits. - strict_
assert strict_asserts
- This is equivalent to
core::assert
if thestrict_asserts
feature is activated, otherwise equal tocore::debug_assert
. - strict_
assert_ eq strict_asserts
- This is equivalent to
core::assert_eq
if thestrict_asserts
feature is activated, otherwise equal tocore::debug_assert_eq
. - strict_
assert_ ne strict_asserts
- This is equivalent to
core::assert_ne
if thestrict_asserts
feature is activated, otherwise equal tocore::debug_assert_ne
. - with_
limits 🔒 - Invoke a macro for each of the limits.
Structs§
- Acceleration
Structure Flags - Flags for acceleration structures
- Acceleration
Structure Geometry Flags - Flags for acceleration structure geometries
- Adapter
Info - Information about an adapter.
- Allocation
Report - Describes an allocation in the
AllocatorReport
. - Allocator
Report - A report that can be generated for informational purposes using
Allocator::generate_report()
. - Backends
- Represents the backends that wgpu will use.
- Bind
Group Layout Entry - Describes a single binding inside a bind group.
- Blas
Triangle Geometry Size Descriptor - Descriptor for all size defining attributes of a single triangle geometry inside a bottom level acceleration structure.
- Blend
Component - Describes a blend component of a
BlendState
. - Blend
State - Describe the blend state of a render pipeline,
within
ColorTargetState
. - Buffer
Descriptor - Describes a
Buffer
. - Buffer
Texture Copy Info - Information about a copy between a buffer and a texture.
- Buffer
Transition - A buffer transition for use with
CommandEncoder::transition_resources
. - Buffer
Usages - Different ways that you can use a buffer.
- Buffer
Uses - Similar to
BufferUsages
, but used only forCommandEncoder::transition_resources
. - Color
- RGBA double precision color.
- Color
Target State - Describes the color state of a render pipeline.
- Color
Writes - Color write mask. Disabled color channels will not be written to.
- Command
Buffer Descriptor - Describes a
CommandBuffer
. - Command
Encoder Descriptor - Describes a
CommandEncoder
. - Copy
External Image Dest Info - View of a texture which can be used to copy to a texture, including color space and alpha premultiplication information.
- Core
Counters wgpu-core
’s part ofInternalCounters
.- Create
Blas Descriptor - Descriptor for creating a bottom level acceleration structure.
- Create
Shader Module Descriptor Passthrough - Descriptor for a shader module given by any of several sources.
These shaders are passed through directly to the underlying api.
At least one shader type that may be used by the backend must be
Some
or a panic is raised. - Create
Tlas Descriptor - Descriptor for creating a top level acceleration structure.
- Depth
Bias State - Describes the biasing setting for the depth target.
- Depth
Stencil State - Describes the depth/stencil state in a render pipeline.
- Device
Descriptor - Describes a
Device
. - Dispatch
Indirect Args - Argument buffer layout for
dispatch_indirect
commands. - Downlevel
Capabilities - Lists various ways the underlying platform does not conform to the WebGPU standard.
- Downlevel
Flags - Binary flags listing features that may or may not be present on downlevel adapters.
- Downlevel
Limits - Represents the sets of additional limits on an adapter, which take place when running on downlevel backends.
- Draw
Indexed Indirect Args - Argument buffer layout for
draw_indexed_indirect
commands. - Draw
Indirect Args - Argument buffer layout for
draw_indirect
commands. - Experimental
Features - Token of the user agreeing to access experimental features.
- Extent3d
- Extent of a texture related operation.
- External
Texture Descriptor - Describes an
ExternalTexture
. - External
Texture Transfer Function - Parameters describing a gamma encoding transfer function in the form tf = { k * linear | linear < b { a * pow(linear, 1/g) - (a-1) | linear >= b
- Feature
Bits - Bits from
Features
in array form - Features
- Features that are not guaranteed to be supported.
- FeaturesWGPU
- Features that are not guaranteed to be supported.
- Features
WebGPU - Features that are not guaranteed to be supported.
- HalCounters
wgpu-hal
’s part ofInternalCounters
.- Image
Subresource Range - Subresource range within an image
- Internal
Counter - An internal counter for debugging purposes
- Internal
Counters - All internal counters, exposed for debugging purposes.
- Limits
- Represents the sets of limits an adapter/device supports.
- Memory
Block Report - Describes a memory block in the
AllocatorReport
. - Multisample
State - Describes the multi-sampling state of a render pipeline.
- Operations
- Pair of load and store operations for an attachment aspect.
- Origin2d
- Origin of a copy from a 2D image.
- Origin3d
- Origin of a copy to/from a texture.
- Pipeline
Statistics Types - Flags for which pipeline data should be recorded in a query.
- Presentation
Timestamp - Nanosecond timestamp used by the presentation engine.
- Primitive
State - Describes the state of primitive assembly and rasterization in a render pipeline.
- Push
Constant Range - A range of push constant memory to pass to a shader stage.
- Query
SetDescriptor - Describes how to create a
QuerySet
. - Render
Bundle Depth Stencil - Describes the depth/stencil attachment for render bundles.
- Render
Bundle Descriptor - Describes a
RenderBundle
. - Request
Adapter Options - Options for requesting adapter.
- Sampler
Descriptor - Describes a
Sampler
. - Shader
Runtime Checks - Describes how shader bound checks should be performed.
- Shader
Stages - Describes the shader stages that a binding will be visible from.
- Stencil
Face State - Describes stencil state in a render pipeline.
- Stencil
State - State of the stencil operation (fixed-pipeline stage).
- Surface
Capabilities - Defines the capabilities of a given surface and adapter.
- Surface
Configuration - Configures a
Surface
for presentation. - Texel
Copy Buffer Info - View of a buffer which can be used to copy to/from a texture.
- Texel
Copy Buffer Layout - Layout of a texture in a buffer’s memory.
- Texel
Copy Texture Info - View of a texture which can be used to copy to/from a buffer/texture.
- Texture
Descriptor - Describes a
Texture
. - Texture
Format Feature Flags - Feature flags for a texture format.
- Texture
Format Features - Features supported by a given texture format
- Texture
Selector - Specifies a particular set of subresources in a texture.
- Texture
Transition - A texture transition for use with
CommandEncoder::transition_resources
. - Texture
Usages - Different ways that you can use a texture.
- Texture
Uses - Similar to
TextureUsages
, but used only forCommandEncoder::transition_resources
. - Texture
View Descriptor - Describes a
TextureView
. - Vertex
Attribute - Vertex inputs (attributes) to shaders.
Enums§
- Acceleration
Structure Copy - What a copy between acceleration structures should do
- Acceleration
Structure Type - What type the data of an acceleration structure is
- Acceleration
Structure Update Mode - Update mode for acceleration structure builds.
- Address
Mode - How edges should be handled in texture addressing.
- Astc
Block - ASTC block dimensions
- Astc
Channel - ASTC RGBA channel
- Backend
- Backends supported by wgpu.
- Binding
Type - Type of a binding in a bind group layout.
- Blas
Geometry Size Descriptors - Descriptor for all size defining attributes of all geometries inside a bottom level acceleration structure.
- Blend
Factor - Alpha blend factor.
- Blend
Operation - Alpha blend operation.
- Buffer
Binding Type - Specific type of a buffer binding.
- Buffer
Texture Copy Info Error - Errors that can occur while populating
BufferTextureCopyInfo
. - Compare
Function - Comparison function used for depth and stencil operations.
- Composite
Alpha Mode - Specifies how the alpha channel of the textures should be handled during compositing.
- Device
Lost Reason - Corresponds to a
GPUDeviceLostReason
. - Device
Type - Supported physical device types.
- External
Texture Format - Format of an
ExternalTexture
. This indicates the number of underlying planes used by theExternalTexture
as well as each plane’s format. - Face
- Face of a vertex.
- Filter
Mode - Texel mixing mode when sampling between texels.
- Front
Face - Vertex winding order which classifies the “front” face of a triangle.
- Index
Format - Format of indices used with pipeline.
- LoadOp
- Operation to perform to the output attachment at the start of a render pass.
- Memory
Hints - Hints to the device about the memory allocation strategy.
- Poll
Error - Error states after a device poll
- Poll
Status - Status of device poll operation.
- Poll
Type - Passed to
Device::poll
to control how and if it should block. - Polygon
Mode - Type of drawing mode for polygons
- Power
Preference - Power Preference when choosing a physical adapter.
- Predefined
Color Space - Color spaces supported on the web.
- Present
Mode - Timing and queueing with which frames are actually displayed to the user.
- Primitive
Topology - Primitive type the input mesh is composed of.
- Query
Type - Type of query contained in a
QuerySet
. - Request
Adapter Error - Error when
Instance::request_adapter()
fails. - Sampler
Binding Type - Specific type of a sampler binding.
- Sampler
Border Color - Color variation to use when sampler addressing mode is
AddressMode::ClampToBorder
- Shader
Model - Collections of shader features a device supports if they support less than WebGPU normally allows.
- Stencil
Operation - Operation to perform on the stencil value.
- Storage
Texture Access - Specific type of a sample in a texture binding.
- StoreOp
- Operation to perform to the output attachment at the end of a render pass.
- Surface
Status - Status of the received surface image.
- Texture
Aspect - Selects a subset of the data a
Texture
holds. - Texture
Data Order - Order in which texture data is laid out in memory.
- Texture
Dimension - Dimensionality of a texture.
- Texture
Format - Format in which a texture’s texels are stored in GPU memory.
- Texture
Sample Type - Specific type of a sample in a texture binding.
- Texture
View Dimension - Dimensions of a particular texture view.
- Trace
- Controls API call tracing and specifies where the trace is written.
- Vertex
Format - Vertex Format for a
VertexAttribute
(input). - Vertex
Step Mode - Whether a vertex buffer is indexed by vertex or by instance.
Constants§
- COPY_
BUFFER_ ALIGNMENT - Buffer to buffer copy as well as buffer clear offsets and sizes must be aligned to this number.
- COPY_
BYTES_ PER_ ROW_ ALIGNMENT - Buffer-texture copies must have
bytes_per_row
aligned to this number. - INSTANCE_
BUFFER_ ALIGNMENT - Alignment requirement for instance buffers used in acceleration structure builds (
build_acceleration_structures_unsafe_tlas
) - MAP_
ALIGNMENT - Minimum alignment of buffer mappings.
- PUSH_
CONSTANT_ ALIGNMENT - Ranges of writes to push constant storage must be at least this aligned.
- QUERY_
RESOLVE_ BUFFER_ ALIGNMENT - An offset into the query resolve buffer has to be aligned to this.
- QUERY_
SET_ MAX_ QUERIES - Maximum queries in a
QuerySetDescriptor
. - QUERY_
SIZE - Size in bytes of a single piece of query data.
- TRANSFORM_
BUFFER_ ALIGNMENT - Alignment requirement for transform buffers used in acceleration structure builds
- VERTEX_
ALIGNMENT - Vertex buffer offsets and strides have to be a multiple of this number.
- VERTEX_
STRIDE_ ALIGNMENT Deprecated - Vertex buffer strides have to be a multiple of this number.
Traits§
- Wasm
NotSend Non-WebAssembly, or fragile-send-sync-non-atomic-wasm
and non-atomics
- Wasm
NotSend Sync - Wasm
NotSync Non-WebAssembly, or fragile-send-sync-non-atomic-wasm
and non-atomics
Functions§
- default_
depth 🔒serde
Type Aliases§
- Buffer
Address - Integral type used for
Buffer
offsets and sizes. - Buffer
Size - Integral type used for
BufferSlice
sizes. - Dynamic
Offset - Integral type used for dynamic bind group offsets.
- Shader
Location - Integral type used for binding locations in shaders.