Async GPU validation errors (not caught by try-catch)
Configure/reconfigure the canvas context Must be called after canvas resize or when context becomes invalid
Intentionally tear down the GPU device, freeing the device, its queue, and
the canvas-context configuration. An app that recreates a renderer per model
otherwise leaks one live GPUDevice (and its VRAM) per reload. The device's
lost promise resolves with reason 'destroyed', which the loss handler
above deliberately ignores (intentional teardown, not a fault). After this
isInitialized() reports false, so the renderer's per-frame guard skips
rendering until a fresh init(). Idempotent — safe to call more than once.
Ensure context is valid before rendering Returns true if context is ready, false if we need to skip this frame
Vendor/architecture snapshot copied from GPUAdapterInfo during init(),
or null when the runtime does not expose adapter info (pre-Chrome-128
browsers, or a throwing getter). Deliberately NOT cleared by destroy():
a device-loss report can race teardown, and two retained strings leak
nothing.
Get current frame's texture safely Returns null if texture is not available (context needs reconfiguration)
Max 2D texture dimension reported by the GPU adapter. WebGPU's spec floor is 8192; iGPUs and most desktop GPUs report 8192 or 16384. Render targets / depth textures must not exceed this in either axis or the device fails validation.
Whether this device's adapter supports GPU timestamp queries (issue
#2670 perf-verdict gate — see frame-timing-gpu.ts). Reflects what was
actually granted on this.device, not merely what the adapter
advertised, so it stays correct on the rare path where requestDevice()
with requiredFeatures was rejected and init() degraded to one of the
later stages (limits-only, or the bare request) with the feature never
granted. False before init() has run, same as every other
device-derived getter here.
Initialize WebGPU device and canvas context
Mark context as needing reconfiguration (call after WebGPU errors)
Check if context needs reconfiguration (canvas resized or context invalid)
Register the callback fired when this device is lost for a non-intentional
reason (see deviceLostHandler). Only one handler is kept; the renderer
owns it and fans out to its own subscribers. Set before init() so a loss
during the very first frames is not missed.
@ifc-lite/renderer - WebGPU renderer