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Β§
- adapter π
- assertions
- Macros for validation internal to the wgpu.
- backend π
Backend,Backends, and backend-specific options.- binding π
- Bind groups and the bindings in them.
- buffer π
- cast_
utils π - counters π
- device π
- env π
- error
- Shared types for WebGPU errors. See also: https://gpuweb.github.io/gpuweb/#errors-and-debugging
- features π
- instance
- Types for dealing with Instances.
- limits π
Limitsand downlevel-related types.- math
- Utility math functions.
- origin_
extent π - ray_
tracing π - render π
- Types for configuring render passes and render pipelines (except for vertex attributes).
- shader π
- surface π
- texture π
- tokens π
- transfers π
- vertex π
- Types for defining vertex attributes and their buffers.
MacrosΒ§
- bytemuck_
wrapper - Wrapper to unsafely define a wrapper type that can be used with
bytemuckβs traits. - link_
to_ πwgpu_ docs - link_
to_ πwgpu_ item - Create a Markdown link definition referring to an item in the
wgpucrate. - strict_
assert - This is equivalent to
core::assertif thestrict_assertsfeature is activated, otherwise equal tocore::debug_assert. - strict_
assert_ eq - This is equivalent to
core::assert_eqif thestrict_assertsfeature is activated, otherwise equal tocore::debug_assert_eq. - strict_
assert_ ne - This is equivalent to
core::assert_neif thestrict_assertsfeature is activated, otherwise equal tocore::debug_assert_ne.
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(). - Backend
Options - Options that are passed to a given backend.
- 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
Someor 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_indirectcommands. - 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_indirectcommands. - Draw
Indirect Args - Argument buffer layout for
draw_indirectcommands. - Dx12
Backend Options - Configuration for the DX12 backend.
- 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
Featuresin 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.
- GlBackend
Options - Configuration for the OpenGL/OpenGLES backend.
- HalCounters
wgpu-halβs part ofInternalCounters.- Image
Subresource Range - Subresource range within an image
- Immediate
Range - A range of immediate data memory to pass to a shader stage.
- 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.
- Load
OpDont Care - Token of the user agreeing to use
LoadOp::DontCare. - Memory
Block Report - Describes a memory block in the
AllocatorReport. - Multisample
State - Describes the multi-sampling state of a render pipeline.
- Noop
Backend Options - Configuration for the noop backend.
- 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.
- 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
Surfacefor 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.
- Dx12
Compiler - Selects which DX12 shader compiler to use.
- Dx12
Swapchain Kind - Selects which kind of swapchain to use on DX12.
- Dx12
UseFrame Latency Waitable Object - Whether and how to use a waitable handle obtained from
GetFrameLatencyWaitableObject. - DxcShader
Model - DXC shader model.
- External
Texture Format - Format of an
ExternalTexture. This indicates the number of underlying planes used by theExternalTextureas 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.
- GlFence
Behavior - Dictate the behavior of fences in OpenGL.
- Gles3
Minor Version - Selects which OpenGL ES 3 minor version to request.
- 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.
- Mipmap
Filter Mode - Texel mixing mode when sampling between texels.
- Poll
Error - Error states after a device poll.
- Poll
Status - Status of device poll operation.
- Poll
Type - Passed to
Device::pollto 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
Textureholds. - 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_rowaligned to this number. - IMMEDIATES_
ALIGNMENT - Ranges of writes to immediate data must be at least this aligned.
- 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.
- MAXIMUM_
SUBGROUP_ MAX_ SIZE - The maximum allowed value for
AdapterInfo::subgroup_max_size. - MINIMUM_
SUBGROUP_ MIN_ SIZE - The minimum allowed value for
AdapterInfo::subgroup_min_size. - 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.
Type AliasesΒ§
- Buffer
Address - Integral type used for
Bufferoffsets and sizes. - Buffer
Size - Integral type used for
BufferSlicesizes. - Dynamic
Offset - Integral type used for dynamic bind group offsets.
- Shader
Location - Integral type used for binding locations in shaders.