androidx.webgpu


Interfaces

DeviceLostCallback
GPURequestCallback

A generic callback interface for asynchronous GPU requests.

UncapturedErrorCallback

Classes

AdapterType

Describes the physical characteristics of a graphics adapter.

AddressMode

Defines how texture coordinates outside the 0, 1 range are handled.

BackendType

Specifies the underlying graphics API used by the WebGPU implementation.

BlendFactor

Defines the factors used in blend operations.

BlendOperation

Defines the operation to perform when blending color values.

BufferBindingType

Specifies the type of a buffer binding in a bind group layout.

BufferMapState

Describes the current mapping state of a buffer.

BufferUsage

Defines the valid usages for a buffer.

CallbackMode

Controls how and when asynchronous operation callbacks are invoked.

ColorWriteMask

A bitmask that controls which color channels are written to a render target.

CompareFunction

Defines the comparison function used for depth and stencil tests.

CompilationInfoRequestStatus

Indicates the status of a shader compilation info request.

CompilationMessageType

Specifies the severity of a shader compilation message.

ComponentSwizzle

Defines how component values are remapped when sampling a texture.

CompositeAlphaMode

Defines how the alpha channel of a surface's texture is handled during compositing.

CreatePipelineAsyncStatus

Indicates the status of an asynchronous pipeline creation request.

CullMode

Defines which primitive faces are culled during rasterization.

DeviceLostReason

Specifies the reason why a device was lost.

ErrorFilter

Defines the types of errors to be captured in an error scope.

ErrorType

Specifies the type of a WebGPU error.

FeatureLevel

Specifies a feature level for adapter requests.

FeatureName

An enumeration of optional features that a device may support.

FilterMode

Defines the texture filtering mode for magnification and minification.

FrontFace

Defines which vertex winding order corresponds to the front face of a primitive.

GPUAdapter

Represents a physical graphics adapter.

GPUAdapterInfo

Provides detailed information about a graphics adapter.

GPUBindGroup

A collection of resources to be bound to a pipeline.

GPUBindGroupDescriptor

Describes a bind group, which is a collection of resources to be bound to a pipeline.

GPUBindGroupEntry

Describes a single resource binding within a bind group.

GPUBindGroupEntry.Builder

Builder for GPUBindGroupEntry.

GPUBindGroupLayout

The layout of a bind group, defining the types of its resources.

GPUBindGroupLayoutDescriptor

Describes the layout of a bind group, specifying the types of resources it contains.

GPUBindGroupLayoutEntry

Describes a single binding within a bind group layout.

GPUBindGroupLayoutEntry.Builder

Builder for GPUBindGroupLayoutEntry.

GPUBlendComponent

Defines the blending behavior for a single color component (color or alpha).

GPUBlendState

Defines the blending configuration for a color attachment.

GPUBuffer

A block of memory accessible by the GPU.

GPUBufferBindingLayout

Describes the layout of a buffer binding.

GPUBufferDescriptor

Describes a buffer to be created.

GPUColor

Represents an RGBA color value.

GPUColorTargetState

Describes the state of a single color target in a render pipeline.

GPUCommandBuffer

A recorded sequence of GPU commands.

GPUCommandBufferDescriptor

Describes a command buffer.

GPUCommandEncoder

An object used to record GPU commands.

GPUCommandEncoderDescriptor

Describes a command encoder.

GPUCompatibilityModeLimits
GPUCompatibilityModeLimits.Builder

Builder for GPUCompatibilityModeLimits.

GPUCompilationInfo

Contains information about a shader compilation, including messages.

GPUCompilationMessage

Describes a single message generated during shader compilation.

GPUComputePassDescriptor

Describes a compute pass.

GPUComputePassEncoder

An object used to record commands for a compute pass.

GPUComputePipeline

A pipeline for compute operations.

GPUComputePipelineDescriptor

Describes a compute pipeline.

GPUComputeState

Describes the compute shader stage of a pipeline.

GPUConstantEntry

Defines a key-value pair for a pipeline-overridable constant.

GPUDepthStencilState

Describes the depth and stencil state for a render pipeline.

GPUDepthStencilState.Builder

Builder for GPUDepthStencilState.

GPUDevice

A logical graphics device.

GPUDeviceDescriptor

Describes a device to be created.

GPUDeviceDescriptor.Builder

Builder for GPUDeviceDescriptor.

GPUExtent3D

Defines a three-dimensional extent (width, height, depth/layers).

GPUExternalTexture
GPUExternalTextureBindingEntry
GPUExternalTextureBindingLayout
GPUFragmentState

Describes the fragment shader stage of a render pipeline.

GPUInstance

A top-level object representing a WebGPU instance.

GPUInstanceDescriptor

Describes an instance to be created.

GPUInstanceLimits

Defines limits for an instance.

GPULimits

Defines the resource limits for a device.

GPULimits.Builder

Builder for GPULimits.

GPUMultisampleState

Describes the multisampling state for a render pipeline.

GPUOrigin3D

Defines a three-dimensional origin point (x, y, z).

GPUPassTimestampWrites

Describes the timestamp queries to be written during a pass.

GPUPipelineLayout

The layout of a pipeline, defining the bind groups it uses.

GPUPipelineLayoutDescriptor

Describes a pipeline layout.

GPUPrimitiveState

Describes the primitive assembly and rasterization state for a render pipeline.

GPUPrimitiveState.Builder

Builder for GPUPrimitiveState.

GPUQuerySet

A set of queries for occlusion or timestamp measurements.

GPUQuerySetDescriptor

Describes a query set.

GPUQueue

A queue for submitting command buffers to the GPU.

GPUQueueDescriptor

Describes a queue.

GPURenderBundle

A pre-recorded sequence of rendering commands.

GPURenderBundleDescriptor

Describes a render bundle.

GPURenderBundleEncoder

An object used to record commands for a render bundle.

GPURenderBundleEncoderDescriptor

Describes a render bundle encoder.

GPURenderBundleEncoderDescriptor.Builder

Builder for GPURenderBundleEncoderDescriptor.

GPURenderPassColorAttachment

Describes a color attachment for a render pass.

GPURenderPassColorAttachment.Builder

Builder for GPURenderPassColorAttachment.

GPURenderPassDepthStencilAttachment

Describes a depth-stencil attachment for a render pass.

GPURenderPassDepthStencilAttachment.Builder

Builder for GPURenderPassDepthStencilAttachment.

GPURenderPassDescriptor

Describes a render pass.

GPURenderPassDescriptor.Builder

Builder for GPURenderPassDescriptor.

GPURenderPassEncoder

An object used to record commands for a render pass.

GPURenderPassMaxDrawCount

An extension for specifying the maximum draw count in a render pass.

GPURenderPipeline

A pipeline for rendering operations.

GPURenderPipelineDescriptor

Describes a render pipeline.

GPURenderPipelineDescriptor.Builder

Builder for GPURenderPipelineDescriptor.

GPURequestAdapterOptions

Options for requesting a graphics adapter.

GPURequestAdapterOptions.Builder

Builder for GPURequestAdapterOptions.

GPURequestAdapterWebXROptions

Extension for WebXR interop options when requesting an adapter.

GPUSampler

An object that controls how textures are sampled in a shader.

GPUSamplerBindingLayout

Describes the layout of a sampler binding.

GPUSamplerDescriptor

Describes a sampler.

GPUSamplerDescriptor.Builder

Builder for GPUSamplerDescriptor.

GPUShaderModule

A compiled shader module.

GPUShaderModuleDescriptor

Describes a shader module.

GPUShaderSourceSPIRV

Extension for providing SPIR-V shader source code.

GPUShaderSourceWGSL

Extension for providing WGSL shader source code.

GPUStencilFaceState

Describes the stencil state for a single face of a primitive.

GPUStencilFaceState.Builder

Builder for GPUStencilFaceState.

GPUStorageTextureBindingLayout

Describes the layout of a storage texture binding.

GPUSupportedFeatures

A list of supported optional features.

GPUSupportedInstanceFeatures

A list of supported optional instance features.

GPUSupportedWGSLLanguageFeatures

A list of supported optional WGSL language features.

GPUSurface

An object representing a platform-specific surface for rendering.

GPUSurfaceCapabilities

Describes the capabilities of a surface for a given adapter.

GPUSurfaceColorManagement

Extension for configuring color space and tone mapping for a surface.

GPUSurfaceConfiguration

Describes the configuration for a surface.

GPUSurfaceConfiguration.Builder

Builder for GPUSurfaceConfiguration.

GPUSurfaceDescriptor

Describes a surface to be created.

GPUSurfaceSourceAndroidNativeWindow

Extension for creating a surface from an Android ANativeWindow.

GPUSurfaceTexture

Contains a texture to render to for a surface, along with status information.

GPUTexelCopyBufferInfo

Describes a buffer used in a texel copy operation.

GPUTexelCopyBufferLayout

Describes the layout of texel data within a buffer.

GPUTexelCopyTextureInfo

Describes a texture used in a texel copy operation.

GPUTexture

A GPU texture object.

GPUTextureBindingLayout

Describes the layout of a texture binding.

GPUTextureBindingViewDimension
GPUTextureComponentSwizzle

Defines the mapping of source texture components to the color channels of a texture view, allowing for reordering or forcing values.

GPUTextureComponentSwizzle.Builder

Builder for GPUTextureComponentSwizzle.

GPUTextureComponentSwizzleDescriptor

An extension chained to a texture view descriptor to define a custom component swizzle.

GPUTextureDescriptor

Describes a texture to be created.

GPUTextureDescriptor.Builder

Builder for GPUTextureDescriptor.

GPUTextureView

A view into a texture, defining a specific sub-resource or reinterpretation of the texture's data.

GPUTextureViewDescriptor

Describes a texture view.

GPUTextureViewDescriptor.Builder

Builder for GPUTextureViewDescriptor.

GPUVertexAttribute

Describes a single vertex attribute.

GPUVertexBufferLayout

Describes the layout of a single vertex buffer.

GPUVertexState

Describes the vertex shader stage of a render pipeline.

IndexFormat

Specifies the data type of an index buffer.

InstanceFeatureName

An enumeration of optional features that an instance may support.

LoadOp

Defines the operation to perform on a render attachment at the beginning of a pass.

MapAsyncStatus

Indicates the status of an asynchronous buffer map operation.

MapMode

Specifies the access mode for a buffer mapping.

MipmapFilterMode

Defines the filtering mode used between mipmap levels.

OptionalBool

Represents a boolean value that can also be undefined.

PopErrorScopeStatus

Indicates the status of a pop error scope operation.

PowerPreference

Defines the power consumption preference when requesting an adapter.

PredefinedColorSpace

Defines standard color spaces for surfaces.

PresentMode

Defines the behavior of frame presentation for a surface.

PrimitiveTopology

Defines how vertices are interpreted to form geometric primitives.

QueryType

Specifies the type of a query set.

QueueWorkDoneStatus

Indicates the status of a queue work done callback.

RequestAdapterStatus

Indicates the status of an adapter request.

RequestDeviceStatus

Indicates the status of a device request.

SType

Identifies the type of a structure in an extensible structure chain.

SamplerBindingType

Specifies the type of a sampler binding in a bind group layout.

ShaderStage

A bitmask that specifies the shader stages where a resource is accessible.

Status

A status code returned synchronously from an operation.

StencilOperation

Defines the operation to perform on the stencil buffer.

StorageTextureAccess

Defines the access mode for a storage texture binding.

StoreOp

Defines the operation to perform on a render attachment at the end of a pass.

SurfaceGetCurrentTextureStatus

Status codes for retrieving the current texture from a surface.

TextureAspect

Specifies which aspect of a texture is being referenced.

TextureDimension

Defines the dimensionality of a texture.

TextureFormat

An enumeration of all supported texture formats.

TextureSampleType

Specifies the data type of a sampled texture in a bind group layout.

TextureUsage

Defines the valid usages for a texture.

TextureViewDimension

Defines the dimensionality of a texture view.

ToneMappingMode

Defines the tone mapping mode for a surface.

VertexFormat

Specifies the data format of a vertex attribute.

VertexStepMode

Defines how frequently a vertex buffer is advanced.

WGSLLanguageFeatureName

An enumeration of optional WGSL language features.

Exceptions

CompilationInfoRequestException
CreatePipelineAsyncException
DawnException

Exception for errors originating from the Dawn WebGPU library that do not fit into more specific WebGPU error categories.

DeviceLostException

Exception thrown when a GPUDevice is lost and can no longer be used.

InternalException

Exception for Internal type errors.

MapAsyncException
OutOfMemoryException

Exception for OutOfMemory type errors.

PopErrorScopeException
QueueWorkDoneException
RequestAdapterException
RequestDeviceException
SurfaceGetCurrentTextureException
UnknownException

Exception for Unknown type errors.

ValidationException

Exception for Validation type errors.

WebGpuException
WebGpuRuntimeException

Base class for exceptions that can happen at runtime.

Objects

Top-level functions summary

suspend T
<T : Any?> awaitGPURequest(block: (callback: GPURequestCallback<T>) -> Unit)

Top-level functions

awaitGPURequest

suspend fun <T : Any?> awaitGPURequest(block: (callback: GPURequestCallback<T>) -> Unit): T