Bind a canvas element to the runtime.
The HTML canvas/
Clear canvas
Copy raw bytes into buffer ptr.
The raw bytes
The target gpu buffer ptr
The beginning offset
Number of bytes
Create a sampled-token readback ring.
Each submission copies a contiguous int32 token vector from a GPU buffer to a per-slot MAP_READ staging buffer and starts slot-local mapAsync.
Create a PackedFunc that runs the given shader via createComputePipeline
The function information already parsed as a record.
The shader data(in WGSL)
The shader
Create a PackedFunc that runs the given shader asynchronously via createComputePipelineAsync
The function information already parsed as a record.
The shader data(in WGSL)
The shader
Dispose context.
Dispose a previously created sampled-token readback ring.
Draw image from data in storage buffer.
The GPU ptr
The height of the image.
The width of the image.
Flush all pending GPU commands by finishing and submitting the accumulated command encoder.
Must be called before:
Get the device API according to its name *
The name of the API.
The corresponding device api.
Obtain the runtime information in readable format.
Submit pending commands without waiting for GPU completion.
Whether a command buffer was submitted.
Submit a sampled-token readback batch from a GPU buffer.
Ring handle returned by createSampledTokenReadbackRing.
Source GPU pointer containing int32 tokens.
Source token offset (in token units, not bytes).
Number of int32 token ids to copy.
Optionalinto: Int32Array
Host array to copy the batch into instead of a new one; see SampledTokenReadbackRing.submit.
Monotonic batch sequence id.
Submit token ranges, including offsets into their allocations.
Optionalinto: Int32ArrayWait for all pending GPU tasks to complete
Wait until at least one batch becomes ready, then return all currently contiguous ready batches.
WebGPU context Manages all the webgpu resources here.