API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classWebGpuBackend

@codexo/exojs / rendering / stable

WebGPU implementation of RenderBackend. Manages the GPU device, canvas context configuration, format selection, managed-texture cache (sized + format-aware), pre-warmed render pipelines per (blend-mode × format) combination, the scissor stack, and a mipmap-generation compute path. Dispatches draws to per-drawable WebGPU renderers registered in the RendererRegistry. Detects device loss via the platform's `device.lost` Promise and automatically attempts recovery: drops dead GPU state, requests a fresh adapter+device with exponential backoff (up to 5 tries), then fires WebGpuBackend.onDeviceRestored. While recovering, draw submissions silently no-op so user code survives transient outages without explicit error handling. Initialization is async (WebGpuBackend.initialize); the Application class drives that during `start()` and automatically falls back to WebGl2Backend when adapter acquisition fails on `'auto'`.

12
props
24
methods
2
events
Import
import { WebGpuBackend } from '@codexo/exojs'

WebGPU implementation of RenderBackend. Manages the GPU device, canvas context configuration, format selection, managed-texture cache (sized + format-aware), pre-warmed render pipelines per (blend-mode × format) combination, the scissor stack, and a mipmap-generation compute path. Dispatches draws to per-drawable WebGPU renderers registered in the RendererRegistry.

Detects device loss via the platform's `device.lost` Promise and automatically attempts recovery: drops dead GPU state, requests a fresh adapter+device with exponential backoff (up to 5 tries), then fires WebGpuBackend.onDeviceRestored. While recovering, draw submissions silently no-op so user code survives transient outages without explicit error handling.

Initialization is async (WebGpuBackend.initialize); the Application class drives that during `start()` and automatically falls back to WebGl2Backend when adapter acquisition fails on `'auto'`.

Constructors 1
new(app: Application): WebGpuBackend
Methods 24
acquireRenderTexture(width: number, height: number): RenderTexture
clear(color?: Color): this
composeWithAlphaMask(content: RenderTexture | Texture, mask: RenderTexture | Texture, x: number, y: number, width: number, height: number, blendMode: BlendModes): this
createColorAttachment(): GPURenderPassColorAttachment
destroy(): void
draw(drawable: Drawable): this
execute(pass: BackendRenderPass): this
flush(): this
getScissorRect(): PixelClipBoundsState | null
getTextureBinding(texture: RenderTexture | Texture): object
initialize(): Promise<WebGpuBackend>
popScissorRect(): this
popStencilClip(): this
pushScissorRect(bounds: Rectangle): this
pushStencilClip(shape: Geometry, transform: Matrix): this
releaseRenderTexture(texture: RenderTexture): this
resetStats(): this
resize(width: number, height: number): this
setBlendMode(_blendMode: BlendModes | null): this
setClearColor(color: Color): this
setRenderTarget(target: RenderTarget | null): this
setView(view: View | null): this
shouldPremultiplyTextureSample(texture: RenderTexture | Texture): boolean
submit(commandBuffer: GPUCommandBuffer): void
Properties 12
backendType: WebGpu
rendererRegistry: RendererRegistry<WebGpuBackend>
clearColor: Color
clearRequested: boolean
context: GPUCanvasContext
device: GPUDevice
deviceLost: boolean
format: GPUTextureFormat
renderTarget: RenderTarget
renderTargetFormat: GPUTextureFormat
stats: RenderStats
view: View
Events 2
onDeviceLost: Signal<[GPUDeviceLostInfo]>
onDeviceRestored: Signal<[]>
Source