nitro_webgpu library
WebGPU for Flutter, powered by wgpu-native.
Classes
- Gpu
- Entry point: instance management and adapter acquisition.
- GpuAdapter
- A physical GPU (or software) adapter.
- GpuAdapterInfo
-
Adapter identity, from
wgpuAdapterGetInfo. - GpuBackend
-
Backend selection bits for
GpuInstanceOptions.backends. - GpuBindGroup
- A bind group.
- GpuBindGroupLayout
- A bind group layout (from GpuComputePipeline.getBindGroupLayout, GpuRenderPipeline.getBindGroupLayout, or GpuDevice.createBindGroupLayout).
- GpuBinding
- One resource binding for GpuDevice.createBindGroup.
- GpuBlendState
-
A custom blend state — one equation per color/alpha component pair.
Feeds
pass.setBlendConstantvia theconstantfactors. - GpuBuffer
- A GPU buffer.
- GpuBufferBinding
- Binds a buffer (uniform or storage, per the pipeline's layout).
- GpuBufferUsage
-
Buffer usage bits. These ARE the WebGPU spec values (identical to the JS
GPUBufferUsageconstants), so they pass through to wgpu unchanged. - GpuColor
-
An RGBA color with double components in
0, 1. - GpuColorAttachmentInfo
- One color attachment for GpuCommandEncoder.beginRenderPass.
- GpuColorWriteMask
-
Channel mask bits for a pipeline's
colorWriteMask. - GpuCommandBuffer
- A finished, submittable list of GPU commands.
- GpuCommandEncoder
- Records GPU commands. Call finish to produce a GpuCommandBuffer; the encoder is consumed by it.
- GpuCompilationMessage
-
One diagnostic from
NitroWebgpu.shaderModuleGetCompilationInfo. - GpuComputePassEncoder
- Records a compute pass. Call end before GpuCommandEncoder.finish.
- GpuComputePipeline
- A compute pipeline (auto layout).
- GpuDepthAttachmentInfo
-
The depth attachment for GpuCommandEncoder.beginRenderPass. The view
must be a GpuTextureFormat.depth24Plus / GpuTextureFormat.depth32Float
texture matching the pipeline's
depthFormat. - GpuDevice
- A logical WebGPU device.
- GpuDeviceLostEvent
- Delivered on GpuDevice.onLost.
- GpuErrorEvent
- An error captured by GpuDevice.popErrorScope or delivered on GpuDevice.onUncapturedError.
- GpuInputAxis
- A two-sided axis: reads -1 while negative is active, +1 for positive, 0 for neither or both.
- GpuInputBinding
- One trigger for an action: any held key in keys, or any pressed mouse button in the buttons bitmask, activates it.
- GpuInputMap
-
The custom mapper: your gameplay names on the left, whatever keys and
mouse buttons should trigger them on the right. Game code polls
inputs.action('fire')and never mentions a key again — rebinding is swapping this map (it's a plain field on GpuInputs, so a settings screen can replace it at runtime). - GpuInputs
- Live input state fed by a WebGpuInputArea and polled from a frame callback — the natural shape for GPU content, where a loop already runs every frame and per-event rebuilds would only cost performance:
- GpuLayoutEntry
- One entry for GpuDevice.createBindGroupLayout.
- GpuLimits
-
The full standard
WGPULimitsset. - GpuPipelineLayout
- A pipeline layout (see GpuDevice.createPipelineLayout).
- GpuQuerySet
- A timestamp query set (see GpuDevice.createTimestampQuerySet).
- GpuQueue
- A device's command queue.
- GpuRenderBundle
- A pre-recorded, replayable bundle of render commands.
- GpuRenderBundleEncoder
-
Records a reusable bundle of render commands (see
GpuDevice.createRenderBundleEncoder). Call finish to produce a
GpuRenderBundle replayable via
pass.executeBundle. - GpuRenderPassEncoder
- Records a render pass. Call end before GpuCommandEncoder.finish.
- GpuRenderPipeline
- A render pipeline (see GpuDevice.createRenderPipeline).
- GpuRenderTarget
- The render target a WebGpuView frame renders into: a borrowed texture view plus its pixel size and format (create pipelines with targetFormat).
- GpuRequiredLimits
- Requested device limits; -1 leaves a limit at its default.
- GpuSampler
- A texture sampler (see GpuDevice.createSampler).
- GpuSamplerBinding
- Binds a sampler.
- GpuShaderModule
- A compiled WGSL shader module.
- GpuShaderStage
-
Shader stage visibility bits (spec values, identical to JS
GPUShaderStage). - GpuStencilFace
- A stencil face state (used for the back-face override).
- GpuTexture
- A 2D GPU texture.
- GpuTextureBinding
- Binds a texture view for sampling in shaders.
- GpuTextureUsage
- Texture usage bits. These ARE the WebGPU spec values.
- GpuTextureView
- A view onto a GpuTexture.
- GpuTimestampWrites
- Where a pass writes its begin/end GPU timestamps.
- GpuVertexAttr
- One vertex attribute for GpuVertexLayout.
- GpuVertexLayout
- The layout of one vertex buffer slot.
- WebGpu
- App-lifetime shared GPU context so simple apps never manage adapter/device lifecycles by hand. The device is created on first use and lives until process exit — the right default for UI apps, where a single device serves every view.
- WebGpuBuilder
-
Boots (or reuses) the shared GPU device and rebuilds with it — the
loading and error states every hand-rolled
initStateboot duplicates, as one widget: - WebGpuInputArea
-
Binds pointer and keyboard input to a GpuInputs object for the GPU
content it wraps — typically a
WebGpuView. The child renders untouched; input lands as plain field writes on inputs, so no widget rebuilds and no frame drops, no matter how fast events arrive. - WebGpuShaderView
- A full-screen animated shader as a single widget — the fastest way to put GPU pixels on screen:
- WebGpuShaderViewController
- Imperative control over a WebGpuShaderView:
- WebGpuView
- Embeds WebGPU-rendered content in the widget tree.
- WebGpuViewController
- Imperative control over a WebGpuView — pause and resume the frame loop, or render single frames on demand:
Enums
- GpuAdapterType
- Physical adapter category. Raw value = index + 1.
- GpuAddressMode
- Texture coordinate wrapping. Raw values 1–3.
- GpuBackendType
- Which native graphics API an adapter runs on. Raw value = index.
- GpuBindingType
- Resource types for explicit bind group layout entries.
- GpuBlendFactor
-
Blend factor (raw
WGPUBlendFactor). - GpuBlendMode
- Color blend presets for render pipelines. Raw value = index.
- GpuBlendOperation
-
Blend equation operator (raw
WGPUBlendOperation). - GpuBufferMapState
-
A buffer's mapping state. Tracked by the wrapper (the native
wgpuBufferGetMapStateis an unimplemented stub in wgpu-native v29). - GpuCompareFunction
- Depth/stencil comparison. Raw value = index + 1.
- GpuCullMode
-
Face culling (raw
WGPUCullMode). - GpuDeviceLostReason
- Why a device was lost. Raw values 1–4.
- GpuErrorFilter
- Error-scope filter. Raw value = index + 1.
- GpuErrorType
- WebGPU error categories. Raw value = index + 1.
- GpuFeature
-
Optional device features (raw
WGPUFeatureName). Query support with GpuAdapter.features; request viarequestDevice(requiredFeatures:). - GpuFilterMode
- Texel filtering for samplers. Raw value = index + 1.
- GpuFrontFace
-
Which winding is front-facing (raw
WGPUFrontFace). - GpuIndexFormat
- Index buffer element type.
- GpuLoadOp
- What happens to an attachment at the start of a render pass.
- GpuPowerPreference
- Power preference for Gpu.requestAdapter. Raw value = index.
- GpuPrimitiveTopology
-
Primitive assembly (raw
WGPUPrimitiveTopology). - GpuQueryType
-
A query set's kind (raw
WGPUQueryType). - GpuSamplerBindingType
-
Sampler binding flavor (raw
WGPUSamplerBindingType). - GpuStencilOperation
-
Stencil operations (raw
WGPUStencilOperation). - GpuStoreOp
- What happens to an attachment at the end of a render pass.
- GpuTextureDimension
-
Texture dimensionality (raw
WGPUTextureDimension). - GpuTextureFormat
-
Texture formats supported by the curated layer (raw
WGPUTextureFormat). - GpuTextureSampleType
-
How a texture binding is sampled in shaders
(raw
WGPUTextureSampleType). - GpuTextureViewDimension
-
Texture view dimensionality (raw
WGPUTextureViewDimension). - GpuVertexFormat
-
Vertex attribute data types (raw
WGPUVertexFormat). - GpuVertexStepMode
- Whether a vertex buffer advances per vertex or per instance.
- ShaderViewLanguage
- The language of a WebGpuShaderView fragment.
Extensions
- GpuTextureFormatInfo on GpuTextureFormat
- Per-format texel-block metadata and copy-layout math.
Exceptions / Errors
- GpuValidationException
- Thrown by checked creates (GpuDevice.createShaderModule, GpuDevice.createComputePipeline) when WebGPU validation fails.