core/gpu/GPUTimestampProfiler.js
Classes
class GPUTimestampProfiler
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: GPUTimestampProfiler Precise GPU timing using timestamp queries. Requires the optional feature. Classes GPUTimestampProfiler Precise GPU timing using timestamp queries. Requires the optional feature. Method Signature Summary Return both paired pass durations and raw timestamp values. Raw values let a caller measure commands encoded between two timestamped passes, such as a native clearBuffer operation, without replacing it with a slower compute clear. <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


createVertexBuffer(device, data, options = {})

createIndexBuffer(device, data, options = {})

createUniformBuffer(device, byteSize, options = {})

createStorageBuffer(device, byteSizeOrData, options = {})

updateBuffer(device, buffer, data, offsetBytes = 0)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


createCanvasContext(gpuDevice, canvas, options = {})


core/gpu/GpuDebug.js
Functions
labelResource(resource, label)
async withErrorScope(device, fn)
Notes & Examples
Shared GPU device


core/gpu/GpuDevice.js
Classes
class GpuDevice
Functions
detectGpuPlatform()
async getGpuDevice(options)
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Method Signature Summary Resolve adapter info cross browser. Chrome 132+: adapter.info (property), device.adapterInfo Chrome <131: adapter.requestAdapterInfo() (async, deprecated then removed) Firefox 141+: adapter.info (follows spec) Safari 26+: adapter.info (follows spec) Gracefully destroy the GPU device and all associated resources. After calling this, the device is unusable — device.lost will fire with reason='destroyed'. Best practice: call before page unload or when switching to a new device after recovery. See: https://toji.dev/webgpu best practices/device loss.html Functions Detect GPU platform/browser for per browser workarounds. WebGPU browser support (Feb 2026): Chrome/Edge 113+ — Win (D3D12), Mac (Metal), ChromeOS (Vulkan) Chrome 121+ — Android 12+ Qualcomm/ARM (Vulkan) Chrome 144+ — Linux Intel Gen12+ (Vulkan), expanding to AMD/NVIDIA See: https://developer.chrome.com/blog/new in webgpu 144 webgpu on linux Firefox 141+ — Windows (wgpu/Rust backend) Firefox 145+ — macOS ARM64 (wgpu/Rust); Linux/Android expected 2026 Safari 26+ — macOS Tahoe, iOS 26, iPadOS 26, visionOS 26 (Metal) Samsung Internet 24+ — Android (Chromium/Dawn) GPU API backends per OS (Chromium/Dawn): Windows → D3D12 (SharedTextureMemory D3D11 swap chain bug) macOS → Metal Linux → Vulkan (rest of Chromium stays on OpenGL) Android → Vulkan (OpenGL ES compat mode via Chrome 135+ flag) ChromeOS → Vulkan See: https://caniuse.com/webgpu https://github.com/gpuweb/gpuweb/wiki/Implementation Status <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper


https://github.com/gpuweb/gpuweb/wiki/Implementation Status <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/GpuFormats.js
Functions
getPreferredCanvasFormat()
isDepthFormatSupported(device, format)
Constants
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Constants <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/GpuFrameBudgetBroker.js
Classes
class GpuFrameBudgetBroker
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Dependency safe frame admission for long compute submissions. The broker never reorders command buffers. Callers await admission, then submit immediately to the one WebGPU queue, preserving queue dependencies. Render critical work bypasses the budget; interactive/background compute is spread across animation frames so a long producer cannot monopolize the GPU. Classes Dependency safe frame admission for long compute submissions. The broker never reorders command buffers. Callers await admission, then submit immediately to the one WebGPU queue, preserving queue dependencies. Render critical work bypasses the budget; interactive/background compute is spread across animation frames so a long producer cannot monopolize the GPU. Method Signature Summary Bound queue lead created outside submit(), such as GPUQueue.writeBuffer, then give the compositor a paint opportunity before more work is issued. <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem


First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/GpuInit.js
Functions
async initGpuState(options)
isWebGpuSupported()
waitForCanvasReady(canvas, minSize = 1)
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Initialize WebGPU and populate GPU state object. Parameters: (Object) — Initialization options (Object) — GPU state object to populate (string) — Canvas selector (default: " canvas") (string) — Device label (string) — Alpha mode (default: "opaque") (string) — DPR mode (default: "auto") (Function) — Optional logger Returns: { device, queue, context, format } Check if WebGPU is supported. Wait for canvas to be properly sized before GPU init. Parameters: (HTMLCanvasElement) — Canvas element (number) — Minimum size in pixels (default: 1) <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual


API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


recordBufferCreate(byteSize, usageKind = "other")


core/gpu/GpuPassGraph.js
Functions
createGpuPassGraph()
Notes & Examples
Shared GPU device


core/gpu/GpuRecovery.js
Classes
class GpuRecovery
Functions
createRecoveryOverlay(container)
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: GpuRecovery.js — Automatic GPU device loss recovery (cross browser) Handles the full lifecycle of device loss and recovery: 1. Detects device loss (unexpected crash vs intentional destroy) 2. Attempts automatic recovery with exponential backoff 3. Reconfigures canvas context with the new device 4. Fires callbacks so the app can re upload resources 5. Shows user notification if recovery fails Based on: https://toji.dev/webgpu best practices/device loss.html Browser support: Chrome 113+ (Win/Mac/ChromeOS), 121+ (Android), 144+ (Linux) Firefox 141+ (Windows), 145+ (macOS ARM64) — wgpu/Rust backend Safari 26+ (macOS Tahoe, iOS 26, iPadOS 26, visionOS 26) — Metal backend Chrome crash limits: 1st crash: adapter available immediately 2nd crash within 2 min: adapter blocked for that page 3rd crash within 2 min: all pages blocked 3 6 crashes in 5 min: GPU process stops entirely Firefox/Safari: crash limits are different/unknown — recovery still works. device.lost reason values: Chrome: 'destroyed' (intentional) or 'unknown' (crash) Firefox/Safari: may use 'destroyed' or '' — we check for 'destroyed' only Classes Method Signature Summary Attach device.lost listener Handle device loss event Attempt to get a new adapter + device with exponential backoff Simulate a device loss for testing. Calls device.destroy() which triggers device.lost with reason='destroyed'. We set a flag so our handler treats it as unexpected. See: https://toji.dev/webgpu best practices/device loss.html testing Check if recovery is currently in progress Stop monitoring and clean up Functions Create a user facing recovery notification overlay. Shows status during recovery and a "please refresh" message on failure.


monitoring and clean up Functions Create a user facing recovery notification overlay. Shows status during recovery and a "please refresh" message on failure. Parameters: (HTMLElement) — Parent element to attach overlay to Returns: } overlay controller <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/GpuSampler.js
Functions
getDefaultSampler(device)
getPointSampler(device)
getLinearSampler(device)
Notes & Examples
Shared GPU device


createColorTexture(device, width, height, options = {})

createSampledTexture2D(device, width, height, options = {})

createDepthTexture(device, width, height, options = {})

resizeAttachmentTexture(device, handle, width, height)


async loadTextureFromUrl(device, url, options = {})

createTextureFromKtx2Data(device, data, options = {})

async createTextureFromKtx2DataWithDecoder(device, data, options = {})

async loadKtx2TextureFromUrl(device, url, options = {})

inspectKtx2TextureData(data, options = {})

async inspectKtx2TextureFromUrl(url, options = {})

async createTextureFromImage(device, image, options = {})

async createTextureFromImageBitmap(device, bitmap, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Re exports , , , <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


async uploadBufferWithStaging(device, dstBuffer, data, dstOffsetBytes = 0, label = "gpustagingupload")

async readBufferToUint8Array(device, srcBuffer, byteOffset, byteLength, label = "gpureadbackbuffer")

async readTexture2D(device, srcTexture, width, height, { bytesPerPixel, mipLevel = 0, label = "gpureadbacktexture2d", })

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Upload data to a GPU buffer via a transient staging buffer. Useful for large or streaming uploads when you want explicit control over copy operations rather than relying solely on queue.writeBuffer. Read back the contents of a GPU buffer into a Uint8Array. Intended for debugging and tooling, not per frame critical paths. Read a 2D texture into a buffer for debugging. Caller must provide bytesPerPixel for the chosen format. Returns an object with the raw data and layout information. <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/IndirectDispatchGen.js
Classes
class IndirectDispatchGen
class MultiPassDispatchGen
Constants
Re-exports
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: IndirectDispatchGen.js GPU Driven Indirect Dispatch Generation Problem: CPU deciding which chunks to process creates a bottleneck. The GPU knows best which chunks need work (from dirty flags, visibility, etc.) but standard dispatch requires CPU to specify workgroup counts. Solution: GPU side stream compaction + indirect dispatch. 1. GPU scans all chunks, compacts active ones into a list 2. GPU writes workgroup counts to indirect buffer 3. CPU issues dispatchWorkgroupsIndirect() no readback needed Key Technique: Hierarchical atomics for efficient compaction Each workgroup uses local atomic to count active items Leader thread reserves global block via global atomic Threads scatter their items to reserved slots Performance: Eliminates CPU GPU sync for conditional dispatch Classes Method Signature Summary Initialize GPU resources Upload chunk flags to GPU Set a single chunk's flags Generate compacted job list and indirect dispatch args Get the indirect buffer for dispatchWorkgroupsIndirect Get the compacted job list buffer Read back job count (for debugging) Destroy GPU resources Generates multiple indirect dispatches for different job types (e.g., separate geometry, lighting, physics passes) Method Signature Summary Initialize all passes Upload shared chunk flags Generate all passes Get indirect buffer for a specific pass Get job list buffer for a specific pass Destroy all resources Constants — Workgroup size for generator shader — Maximum jobs that can be generated per dispatch — Indirect dispatch buffer size (3 × u32 = 12 bytes) Re exports <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native ,


Re exports <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


ktx2VkFormatInfo(vkFormat = 0, supportedFeatures = null)

ktx2PayloadPlan(containerOrData, options = {})

getKtx2SectionPayloadView(data, section = 'sgd')

createKtx2PayloadDecodeRequest(data, options = {})

ktx2DirectUploadPlan(containerOrData, options = {})

getKtx2LevelPayloadView(data, level = 0)


class UniformBufferWriter extends MappedBufferWriter

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Mapped Buffer Writer Eliminates double copy overhead from writeBuffer() Based on WebGPU optimization best practices from webgpufundamentals.org Saves one CPU→GPU copy per upload (10 20% faster uploads) Method Signature Summary Get or create a mapped staging buffer Write data to target buffer using mapped staging buffer Saves one copy compared to writeBuffer() Quick write for small data (uses writeBuffer for convenience) Uniform Buffer Writer Optimized for frequent uniform updates Method Signature Summary Write uniform at specific index <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual


core/gpu/OptimizationIntegration.js
Classes
class OptimizedGPUDevice
Constants
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Enhanced GPU Device wrapper with all optimizations Method Signature Summary Optimized uniform buffer update (uses mapped buffers) Quick uniform update (uses writeBuffer for small data) Schedule GPU work with intelligent batching Flush all pending GPU work Get or create render bundle for repeated geometry Get statistics from all optimization systems Log performance statistics Constants — Quick optimization helper functions <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/PipelineCache.js
Classes
class PipelineCache
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Next gen pipeline cache with IndexedDB persistence and background compilation Eliminates ALL pipeline creation stalls Classes Method Signature Summary <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/ProgressiveWorkBudget.js
Functions
planProgressiveWorkBudget(options = {})
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Plans optional refinement from measured spare GPU time. It never delays the host frame, submits work, or changes correctness critical work. <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/ShaderCompilationQueue.js
Classes
class ShaderCompilationQueue
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Async Shader Compilation Queue Priority based background compilation Eliminates frame stalls from shader compilation Classes Method Signature Summary Queue shader for compilation Priority: 0 = low, 1 = normal, 2 = high, 3 = critical Precompile common shaders during idle time <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


profiledComputePass(profiler, encoder, name, fn)

createSimulationProfiler(device, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes SimulationProfiler.js GPU Timestamp Profiling for Simulation Systems Provides detailed GPU timing information for: Voxel collision passes Rope physics passes Rope rendering passes Particle simulation passes Uses WebGPU timestamp queries for accurate GPU side timing. Method Signature Summary Start a new profiling frame Write a timestamp at current position Mark the start of a profiled section Mark the end of a profiled section Resolve timestamps and copy to read buffer Read back timing results (async) Get average timing for a section Get min/max/avg stats for a section Get all section stats Get formatted report string Reset all history Functions Profiled compute pass helper Wraps a compute pass with automatic start/end timestamps Create a simulation profiler instance Constants — Pre defined section names for consistency <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native


limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/SparsePageRuntime.js
Classes
class SparsePageRuntime
Functions
createSparsePageRuntime(options)
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Device independent, revisioned sparse residency contract shared by field, voxel derived, and texture pages. A commit is atomic: validation, fallback closure, slot allocation, and eviction all finish before publication. Method Signature Summary Functions <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/TextureAtlasManager.js
Classes
class TextureAtlasManager
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Texture Atlas Manager Dynamic texture packing for GPU memory optimization Reduces texture bindings and improves cache coherency Classes Method Signature Summary Allocate space in atlas for a texture Returns { atlas, x, y, width, height, uvTransform } Upload texture data to allocated space Get allocation for a texture ID <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/VGPUBindGroupManager.js
Classes
class VGPUBindGroupManager
Re-exports
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Automatic Bind Group Manager Material system that auto generates bind groups from shader Classes Method Signature Summary Create bind group layout from shader source Create bind group automatically from shader and resources Create a material from shader Get existing material Create instance of a material with specific resources Clear all cached layouts and bind groups Re exports , <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/VGPUBindless.js
Classes
class VGPUBindless
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Bindless Preparation Storage buffer texture arrays for bindless style rendering Method Signature Summary Register a texture and get its bindless index Unregister a texture Get texture index Register a buffer and get its bindless index Unregister a buffer Get buffer index Create bind group layout for bindless access Get bind group for bindless access Note: This returns a simplified bind group until WebGPU supports texture arrays Generate WGSL helper code for bindless access Get stats <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/VGPUComputeUtils.js
Classes
class VGPUComputeUtils
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Method Signature Summary Compute exclusive prefix sum (scan) Compute histogram of float values Radix sort key value pairs (32 bit keys) Find min/max values in a buffer Fill buffer with constant value <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/VGPUDebugDraw.js
Classes
class VGPUDebugDraw
class DebugDrawScope
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Debug Draw System with dynamic buffer sizing Method Signature Summary Ensure CPU line array has sufficient capacity Ensure GPU line buffer has sufficient capacity Draw a line Draw a ray (line from origin in direction) Draw an arrow Draw an axis aligned box Draw a wireframe sphere Draw a circle in a plane Draw coordinate axes Draw a grid on XZ plane Draw a frustum Add persistent primitive (returns ID for removal) Clear per frame primitives Render debug primitives Get category color Set category color Scoped debug drawing (auto clears when scope ends) Method Signature Summary <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: )


loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/VGPUHiZCulling.js
Classes
class VGPUHiZCulling
class BoundingBoxBuilder
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Hierarchical Z Occlusion Culling System Method Signature Summary Ensure object buffers have sufficient capacity Build HiZ pyramid from depth buffer Upload bounding boxes for occlusion testing Buffers grow automatically to fit the data. Perform occlusion culling Get visibility buffer for reading results Get HiZ texture (for debugging) Resize HiZ buffers Helper to build bounding box data for HiZ culling Grows dynamically no fixed maximum. Method Signature Summary Add a bounding box Add from center and half extents <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/VGPUIndirectRenderer.js
Classes
class VGPUIndirectRenderer
class IndirectInstanceBuilder
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes GPU driven indirect renderer with dynamic buffer sizing Method Signature Summary Ensure instance buffers have sufficient capacity Ensure mesh info buffer has sufficient capacity Upload instance data (transforms and bounding spheres) Buffers grow automatically to fit the data. Upload mesh information Upload which mesh each instance uses Extract frustum planes from view projection matrix Perform GPU culling pass Get the indirect draw buffer for use with drawIndirect Get the draw count buffer (for multi draw indirect count if supported) Get visible instance indices buffer (for instanced rendering) Read back stats (async uses readback queue) Helper to build instance data for indirect rendering Grows dynamically no fixed maximum. Method Signature Summary Add an instance <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives.


requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/VGPUMemoryTracker.js
Classes
class VGPUMemoryTracker
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Memory Budget Tracker Track GPU memory usage, warn on budget exceeded Also provides GPU memory probing to detect available VRAM Classes Method Signature Summary Wrap device.createBuffer and device.createTexture so ALL allocations are tracked automatically, even from code that bypasses VirtualGPU. Auto track a resource (skip if already tracked via explicit trackBuffer/trackTexture) Register a buffer allocation Register a texture allocation Unregister a resource Update per frame (for history tracking) Get current memory usage (reuses cached object to avoid GC pressure) Get formatted usage string Get detailed stats Get largest resources (for debugging leaks) Get memory usage trend (increasing/decreasing/stable) Find potential memory leaks (resources older than threshold with no recent access) Set callback for warning threshold Set callback for critical threshold Set callback for over budget Reset all tracking Initialize GPU info from device/adapter limits Get GPU info (limits and probed values) Probe GPU VRAM by allocating progressively larger buffers Uses binary search to find maximum allocatable size Quick probe just get max single allocation (fast) Full probe estimate total VRAM (slower, fills memory) Get probed VRAM info (null if not probed yet) Check if VRAM has been probed Get system RAM info Uses navigator.deviceMemory (approximate) and performance.memory (Chrome only) Probe system RAM by allocating ArrayBuffers until allocation fails This gives a more accurate picture of available RAM than navigator.deviceMemory Get probed RAM info (null if not probed yet) Check if RAM has been probed Get detailed JS memory breakdown (requires cross origin isolation) Includes memory from


probed RAM info (null if not probed yet) Check if RAM has been probed Get detailed JS memory breakdown (requires cross origin isolation) Includes memory from workers and iframes Get comprehensive memory capabilities info Detect WASM SIMD support (v128 type) Detect WASM Threads support Get all capabilities as a compact object Get storage quota and usage (IndexedDB, Cache API, etc.) This can give hints about available disk/memory Get WebGL memory info (if WebGL context available) Uses WEBGL debug renderer info extension Get memory pressure state (experimental) Some browsers support this via navigator.deviceMemory or onmemorypressure Monitor memory changes over time Returns a function to stop monitoring Start tracking an object for leak detection When the object is garbage collected, we'll know Check which tracked objects are still alive (potential leaks) Schedule memory measurement during browser idle time Cancel a pending idle measurement Create a GPU timing helper for timestamp queries Requires 'timestamp query' feature to be enabled on device Get timestampWrites config for render/compute pass Resolve timing after pass ends Read the timing result (call after queue.submit) Destroy timing resources Get comprehensive memory snapshot for debugging Get full system info for profiler display Estimate VRAM usage from buffer manager (for buffers not tracked individually) Get formatted system memory info Get comprehensive memory report (VRAM + RAM + JS) <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each


limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in p


core/gpu/VGPUMultiQueue.js
Classes
class VGPUMultiQueue
Re-exports
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Multi Queue Abstraction Separate graphics/compute/transfer queues when available Method Signature Summary Get a specific queue Get the graphics queue (primary) Get the compute queue Get the transfer/copy queue Submit work to a specific queue Submit graphics work Submit compute work Submit transfer/copy work Create a fence for synchronization Wait for a fence to complete Signal a fence from a queue Create a cross queue dependency Execute async compute work Execute async transfer work Get queue statistics Flush all queues Re exports , <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU ·


Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/VGPUQualityScaler.js
Classes
class VGPUQualityScaler
class VGPUDynamicViewport
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Quality Scaler Dynamic resolution/quality based on frame time budget Method Signature Summary Update with current frame time Get current resolution scale (0 1) Get render resolution for a base resolution Force a specific scale Use discrete quality levels instead of continuous scaling Get current quality level Set quality level by name Get all quality level names Configure quality levels Get performance stats Reset stats Set target FPS Set callbacks Viewport manager for dynamic resolution Method Signature Summary Update render targets for new scale Update base resolution Get current render texture Get current render view Get depth texture Get depth view Get current dimensions <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap


Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/VGPUReadbackQueue.js
Classes
class VGPUReadbackQueue
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes GPU Readback Queue Async buffer/texture reads with callbacks Batches staging buffers for efficient GPU→CPU data transfer Method Signature Summary Queue a buffer read with callback Queue a texture read with callback Flush all pending reads (call once per frame) Get pending request count <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/VGPURenderGraph.js
Classes
class VGPURenderGraph
class RenderGraphBuilder
Re-exports
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Main Render Graph class Method Signature Summary Register an external resource (not managed by the graph) Add a render pass to the graph Compile the render graph Cull unused passes Compute resource lifetimes Allocate transient resources Build execution order Batch resource barriers Execute the compiled render graph Reset the graph for next frame End frame return transient resources to pool Get debug info about the graph Generate DOT graph for visualization Builder pattern for ergonomic graph construction Method Signature Summary Re exports , <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing ·


in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/VGPURenderStats.js
Classes
class VGPURenderStats
class VGPUStatsOverlay
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Render Statistics Draw call counts, triangle counts, state changes per frame Method Signature Summary Begin a new frame End the current frame Record a draw call Record a compute dispatch Record a pipeline change Record a bind group change Record a vertex buffer change Record an index buffer change Record render pass begin Record compute pass begin Record texture bind Record buffer bind Record blit/copy operation Record clear operation Get current frame stats Get previous frame stats Get average stats over all frames Get formatted stats string Get stats history for graphing Get multiple stats as time series Reset all stats Get frame count Stats overlay for debug display Method Signature Summary Create and show overlay Hide overlay Toggle visibility <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this


caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/VGPUResourceBarriers.js
Classes
class VGPUResourceBarriers
Re-exports
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Resource Barriers Helper Explicit sync points for complex resource dependencies Method Signature Summary Track resource state Get current resource state Transition a resource to a new state Batch transition multiple resources Flush pending transitions (insert barriers) Create a barrier scope for automatic state management Check if transition causes a hazard Create a dependency graph for resources Reset all resource states Get debug info Re exports , <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


createAutoSizedUniformBuffer(device, shaderSource, structName, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Shader Reflection Parse WGSL to extract bindings, uniforms, entry points Classes Method Signature Summary Analyze WGSL shader source and extract metadata Get bind group layout entries from reflection Get all bind groups used in shader Functions Get the required buffer size for a uniform struct in a shader. Automatically calculates correct WGSL alignment. Parameters: (string) — WGSL shader source code (string) — Name of the struct to get size for Returns: Required buffer size in bytes Get buffer sizes for all uniform bindings in a shader. Parameters: (string) — WGSL shader source code Returns: Map of binding name required size Create a uniform buffer with automatically calculated size from shader struct. Parameters: (GPUDevice) — WebGPU device (string) — WGSL shader source code (string) — Name of the struct (Object) — Buffer options (label, usage flags) Returns: Created buffer with correct size Validate that a buffer meets the minimum size requirement for a shader struct. Parameters: (GPUBuffer) — Buffer to validate (string) — WGSL shader source code (string) — Name of the struct Returns: True if buffer is large enough Get all struct sizes in a shader for debugging. Parameters: (string) — WGSL shader source code Returns: Map of struct name { size, alignment, members } <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature


by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/VGPUStreamingManager.js
Classes
class VGPUStreamingManager
Re-exports
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: VGPUStreamingManager Progressive resource loading and streaming Features: Priority based loading queue with distance/importance weighting Async texture streaming with mip level progression Mesh LOD streaming Memory budget management Placeholder resources while loading Automatic eviction of unused resources Usage: const streaming = new VGPUStreamingManager(vgpu); await streaming.init({ memoryBudget: 512 1024 1024 }); const textureHandle = streaming.requestTexture('path/to/texture.png', { priority: 1.0 }); const texture = streaming.getTexture(textureHandle); // Returns placeholder until loaded Classes Main Streaming Manager Method Signature Summary Request a texture to be streamed Request a mesh to be streamed Request a buffer to be streamed Get a texture by handle (returns placeholder if not loaded) Get a mesh by handle Check if a resource is fully loaded Get loading progress (0 1) Set distance for priority calculation Update camera position for priority calculations Process streaming queue call once per frame Unload a specific resource Get streaming statistics Preload resources (useful for loading screens) Re exports , <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features


a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/VGPUTextureAtlas.js
Classes
class VGPUTextureAtlas
class VGPUSpriteBatch
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Texture Atlas Manager Dynamic packing for sprites/UI, automatic UV remapping Classes Method Signature Summary Add a texture to the atlas Add multiple textures efficiently (batch upload) Remove a texture from the atlas Get region info by name Get UV coordinates for a region Get the atlas texture Get the atlas texture view Check if region exists Get all region names Generate UV buffer for a list of region names Create a GPU buffer with UV data for all regions Get atlas utilization stats Clear the atlas Sprite batch renderer using texture atlas Method Signature Summary <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/VGPUTimelineSemaphores.js
Classes
class VGPUTimelineSemaphores
Re-exports
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes GPU Timeline Semaphores Advanced sync for multi engine scenarios Method Signature Summary Create a timeline semaphore Get semaphore by ID Signal a semaphore to a specific value Wait for semaphore to reach a value Get current semaphore value Create a GPU signaled semaphore operation This wraps onSubmittedWorkDone for GPU CPU signaling Insert a GPU signal after command buffer submission Create a barrier that waits for multiple semaphores Create a frame synchronization primitive Destroy a semaphore Get debug info Cleanup Re exports , <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU ·


core/gpu/VirtualGPU.js
Classes
class VirtualGPU
Functions
async getVGPU(options)
vgpu()
initVGPU(deviceOrOptions)
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Method Signature Summary Create a VirtualGPU instance Wrap an existing GpuDevice Get comprehensive stats Connect to game's EngineProfiler for unified stats Sync stats to connected EngineProfiler Begin a new frame (call at frame start) End a frame (call at frame end, resolves profiler) Log stats to console Destroy all resources Create a texture atlas Create a sprite batch for an atlas Create a dynamic viewport for resolution scaling Create a stats overlay for debugging Create or get the render graph instance Create a render graph builder for ergonomic graph construction Create an indirect renderer for GPU driven rendering Buffers grow dynamically no fixed maximums needed. Create an instance builder for indirect rendering Grows dynamically no fixed maximum. Create HiZ culling system for occlusion culling Object buffers grow dynamically no fixed maximums. Create a bounding box builder for HiZ culling Grows dynamically no fixed maximum. Create a streaming manager for progressive resource loading Create debug draw system for visualization Get or create a shared debug draw instance Functions Get or create the global vGPU instance Get existing vGPU instance (throws if not initialized) Initialize vGPU from existing GpuDevice or raw GPUDevice Parameters: (GpuDevice GPUDevice Object) — GpuDevice wrapper, raw GPUDevice, or {device, queue, adapter} <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native


the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/WGSLPreprocessor.js
Classes
class WGSLPreprocessor
Functions
createPreprocessor()
Constants
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes WGSL Preprocessor include, define, ifdef support for shader modularity Method Signature Summary Register an include file Set a global define (applied to all processed shaders) Remove a global define Process WGSL source code with preprocessor directives Get all registered include names Clear all includes and defines Functions Create a preprocessor with common includes registered Constants <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


validateBuffer(buffer, layout, expectedCount = 1)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: WGSLStructLayout.js Unified WGSL/JS Struct Layout Generator Parses WGSL struct definitions and generates: Correct buffer sizes with WebGPU alignment JS field offset maps for TypedArray access Accessor helper classes for reading/writing struct data This ensures WGSL and JS stay perfectly in sync define once in WGSL, use the generated layout in JS. Usage: const layout = parseWGSLStruct( ); // layout.size = 16 (bytes) // layout.fields = { dt: {offset: 0, size: 4}, particleCount: {offset: 4, size: 4}, ... } const accessor = createStructAccessor(layout); const data = new Float32Array(layout.size / 4); accessor.set(data, 'dt', 0.016); accessor.set(data, 'particleCount', 1000); // auto converts to u32 Functions Parse a WGSL struct definition and compute field layout Parameters: (string) — WGSL struct code Returns: Layout object with name, size, align, fields Create an accessor object for reading/writing struct fields Parameters: (Object) — Layout from parseWGSLStruct Returns: Accessor with get/set methods Define a struct layout from WGSL and return both layout and accessor Parameters: (string) — WGSL struct definition Returns: } Generate JS object literal layout definition from WGSL struct Useful for documentation or code generation Parameters: (string) — No description in source JSDoc. Returns: JS code Validate that a buffer matches the expected struct layout Parameters: (GPUBuffer ArrayBuffer TypedArray) — No description in source JSDoc. (Object) — No description in source JSDoc. (number) — Expected number of structs Returns: } Constants <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its


} Constants <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


createUniformBuffer(device, structCode, label = 'Uniform Buffer')

createStorageBuffer(device, structCode, count = 1, label = 'Storage Buffer')

validateBufferSize(bufferSize, structCode, label = '')

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Calculate the total size of a WGSL struct with proper alignment Parameters: (string) — WGSL struct definition Returns: Total size in bytes (aligned to 16 for uniform buffers) Create a uniform buffer with automatically calculated size Parameters: (GPUDevice) — WebGPU device (string) — WGSL struct definition (string) — Buffer label for debugging Returns: Correctly sized uniform buffer Create a storage buffer with automatically calculated size Parameters: (GPUDevice) — WebGPU device (string) — WGSL struct definition (number) — Number of struct instances (string) — Buffer label for debugging Returns: Correctly sized storage buffer Get the Float32Array size needed to fill a struct buffer Parameters: (string) — WGSL struct definition Returns: Number of f32 elements needed Validate a buffer size against a struct definition Parameters: (number) — Current buffer size (string) — WGSL struct definition (string) — Optional label for error message Returns: } <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss


requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/WebGpuCanvasBootstrap.js
Functions
async initWebGpuCanvas(options = {})
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/gpu/index.js
Re-exports
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: engine/core/gpu/index.js GPU Utilities Barrel Export Re exports , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


core/index.js

core/index.js
Re-exports
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Re exports , , , , , , , , , , , , , , , , , , , , , , <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


animationActiveDuration(iterationDuration, iterationCount = 1)

animationWrapTime(time, duration, options = {})

animationPlaybackStateReport(value = {}, options = {})

animationTimeScaleReport(time, options = {})

animationOpenUsdLayerOffsetReport(timeCode, options = {})

animationOpenUsdTimeSampleBracket(times, timeCode, options = {})

animationOpenUsdSampleValue(times, values, timeCode, options = {})

animationKeyframeBracket(times, time, options = {})

animationCubicSplineSample(v0, outTangent0, v1, inTangent1, t, duration = 1, options = {})

animationSampleChannel(times, values, time, options = {})

animationSampleChannelInto(times, values, time, out, outOffset = 0, options = {})

animationClipSampleTimeReport(time, options = {})

animationKeyframeReductionReport(times, values, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: AnimationTimeMath.js pure animation timing, keyframe, and sampler reports. Functions Validate and normalize the serializable state of one animation player. <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


audioAutomationLinearRampValue(startValue, endValue, startTime, endTime, time)

audioAutomationExponentialRampValue(startValue, endValue, startTime, endTime, time)

audioAutomationSetTargetValue(initialValue, targetValue, startTime, timeConstant, time)

audioAutomationValueCurveAtTime(curve, startTime, duration, time, options = {})

audioAdsrEnvelopeValue(time, options = {})

audioBiquadComputedFrequency(frequency = 350, detune = 0, sampleRate = 48000)

audioBiquadCoefficients(type = 'lowpass', options = {})

audioBiquadFrequencyResponse(coefficients, frequencyHz, sampleRate = coefficients?.sampleRate ?? 48000)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: AudioAutomationMath.js pure AudioParam automation, envelope, and biquad helper math. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


audioApplyGain(signal, gain = 1, options = {})

audioWindowedRmsReport(signal, windowSize, hopSize = windowSize)

audioSilenceReport(signal, options = {})

audioNoiseFloorReport(signal, options = {})

audioTransientReport(signal, options = {})

audioSpectralEntropyReport(spectrum, options = {})

audioAnalyserByteToDb(byteValue, minDb = DEFAULTAUDIOMINDB, maxDb = DEFAULTAUDIOMAXDB)

audioDecibelsToAnalyserByte(db, minDb = DEFAULTAUDIOMINDB, maxDb = DEFAULTAUDIOMAXDB)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: AudioMath.js pure PCM/audio domain math helpers. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


rayTriangleIntersect(origin, dir, tri, tMax = INFT)

traverseBVH(origin, dir, nodes, triIndices, triangles)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes BVH Node 32 bytes aligned for GPU If triCount == 0: internal node, leftChild Or FirstTri = left child index If triCount 0: leaf node, leftChild Or FirstTri = first triangle index Method Signature Summary Build BVH from triangle mesh Uses Surface Area Heuristic for optimal splits Method Signature Summary Build BVH from triangles Update node AABB from its triangles Recursively subdivide node using SAH Find best split plane using Surface Area Heuristic Evaluate SAH cost for a split Compute surface area of AABB Functions Möller Trumbore ray triangle intersection Parameters: (number[]) — Ray origin [x, y, z] (number[]) — Ray direction [x, y, z] (normalized) (Object) — Triangle {v0, v1, v2} (number) — Maximum t value Returns: {t, u, v, normal} or null Traverse BVH and find closest intersection Parameters: (number[]) — Ray origin (number[]) — Ray direction (normalized) (Array) — BVH nodes (Array) — Triangle index array (Array) — Triangle data Returns: {t, triIdx, u, v, normal} or null Serialize BVH for GPU buffer upload Parameters: (Object) — BVH from builder {nodes, triIndices, triangles} Returns: {nodeBuffer, triIndexBuffer, triangleBuffer} Create raycastable mesh from vertices and indices Parameters: (Float32Array Array) — Vertex positions [x,y,z, x,y,z, ...] (Uint32Array Array) — Triangle indices [i0,i1,i2, ...] Returns: Raycastable mesh object Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants


library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


durationReport(startMs, endMs, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: BenchmarkMath.js reusable benchmark rate, memory, compression, and cost estimates. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


arc(center, radius, startAngle, endAngle, tubeRadius = 1.0)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Cubic Bezier curve defined by 4 control points Method Signature Summary Evaluate curve at parameter t using De Casteljau's algorithm Numerically stable, works for any degree Evaluate using polynomial form (faster for many evaluations) B(t) = (1 t)³P0 + 3(1 t)²tP1 + 3(1 t)t²P2 + t³P3 First derivative (tangent direction, not normalized) B'(t) = 3(1 t)²(P1 P0) + 6(1 t)t(P2 P1) + 3t²(P3 P2) Second derivative (for curvature) B''(t) = 6(1 t)(P2 2P1+P0) + 6t(P3 2P2+P1) Get normalized tangent at t Get normal vector at t (perpendicular to tangent) Get curvature at t κ = B' × B'' / B' ³ Subdivide curve at t into two curves Approximate arc length using Gaussian quadrature Build arc length lookup table for uniform parameterization Convert arc length parameter to curve parameter Sample curve uniformly by arc length Get bounding box Serialize to flat array for GPU upload Create from flat array Method Signature Summary Elevate to cubic (exact conversion) Method Signature Summary Add a curve segment Create smooth spline through points (Catmull Rom style) Evaluate spline at global parameter [0, numCurves] Get total number of curves Sample entire spline Functions Create a straight line as a degenerate Bezier Parameters: (number[]) — No description in source JSDoc. (number[]) — No description in source JSDoc. (number) — No description in source JSDoc. Create an arc approximation using Bezier Parameters: (number[]) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No


in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


bezierDistanceCapsule(p, curve, segments = 16)

bezierDistanceBatch(points, curve, segments = 16)

bezierClosestNewton(p, curve, initialT = 0.5, iterations = 8)

bezierDistanceHybrid(p, curve, capsuleSegments = 8, newtonIterations = 4)

multiCurveDistance(p, curves, segments = 16)

multiCurveDistanceSmooth(p, curves, smoothness = 0.5)

curvesToSegments(curves, segmentsPerCurve = 8)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes GPU accelerated Bezier distance field computation Method Signature Summary Initialize with curves Compute distance at a single point (CPU fallback) Functions Signed distance to a capsule (line segment with radius) Parameters: (number[]) — Query point (number[]) — Segment start (number[]) — Segment end (number) — Radius Returns: Signed distance (negative inside) Find closest point parameter on capsule Parameters: (number[]) — No description in source JSDoc. (number[]) — No description in source JSDoc. (number[]) — No description in source JSDoc. Returns: t in [0, 1] Distance to Bezier using capsule chain approximation Fast but may miss fine details for highly curved sections Parameters: (number[]) — Query point (CubicBezier) — Bezier curve (number) — Number of capsule segments (16 typical) Returns: } Distance and closest t Batch distance query for multiple points Parameters: (number[][]) — No description in source JSDoc. (CubicBezier) — No description in source JSDoc. (number) — No description in source JSDoc. Returns: Distances Find closest point on Bezier using Newton Raphson iteration Minimizes B(t) p ² by finding roots of d/dt B(t) p ² Parameters: (number[]) — Query point (CubicBezier) — No description in source JSDoc. (number) — Starting guess for t (number) — Max iterations (8 typical) Returns: } Hybrid: Capsule for initial guess, Newton for refinement Best balance of speed and accuracy Parameters: (number[]) — No description in source JSDoc. (CubicBezier) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source