bindings/minigpu_bindings library

Classes

GPUDevice

Extensions

GPUDeviceImport on GPUDevice

Properties

HEAP16 ↔ JSInt16Array
getter/setter pair
HEAP32 ↔ JSInt32Array
getter/setter pair
HEAP8 ↔ JSInt8Array
getter/setter pair
HEAPF32 ↔ JSFloat32Array
getter/setter pair
HEAPF64 ↔ JSFloat64Array
getter/setter pair
HEAPU16 ↔ JSUint16Array
getter/setter pair
HEAPU32 ↔ JSUint32Array
getter/setter pair
HEAPU8 ↔ JSUint8Array
getter/setter pair
isMinigpuModuleLoaded → bool
True once globalThis.MinigpuModule is available.
no setter
jsGpuDevice → GPUDevice?
no setter

Functions

allocateUTF8(String str) → JSString
ccall(JSString name, JSString returnType, JSArray<JSAny?> argTypes, JSArray<JSAny?> args, JSObject opts) → JSPromise<JSAny?>
ensureMinigpuModuleLoaded() → Future<void>
Load (or adopt) the minigpu wasm module once. Safe to await repeatedly. Throws on fetch/instantiation failure — callers surface that as "no GPU on this platform" rather than a silent hang.
mgpuCreateBuffer(int elements, int dataType) → MGPUBuffer
mgpuCreateComputeShader() → MGPUComputeShader
mgpuDestroyBuffer(MGPUBuffer buffer) → void
mgpuDestroyComputeShader(MGPUComputeShader shader) → void
mgpuDestroyContext() → Future<void>
mgpuDispatch(MGPUComputeShader shader, int groupsX, int groupsY, int groupsZ) → Future<void>
mgpuGetWGPUBufferHandle(MGPUBuffer buf) → int
Returns the Emscripten integer handle for a WGPUBuffer inside buf. Pass to getWebGpuJsObject from webgpu_interop.dart to get the JS GPUBuffer.
mgpuGetWGPUDeviceHandle() → int
Returns the Emscripten integer handle for the WGPUDevice. Pass to getWebGpuJsObject from webgpu_interop.dart to get the JS GPUDevice.
mgpuHasKernel(MGPUComputeShader shader) → bool
mgpuImportExternalTexture(JSAny videoFrame) → JSObject?
Import a VideoFrame (or HTMLVideoElement) as a GPUExternalTexture.
mgpuInitializeContext() → Future<void>
mgpuLandExternalTexture({required JSObject externalTexture, required int dstBufferHandle, required int width, required int height, required int downscale}) → bool
Run the external-texture landing pass: externalTexture -> packed RGBA8 array<u32> in the buffer behind dstBufferHandle, the same destination layout the native D3D11 path writes.
mgpuLoadKernel(MGPUComputeShader shader, String kernelString) → void
mgpuReadAsyncDouble(MGPUBuffer buffer, Float64List outputData, {int readElements = 0, int elementOffset = 0}) → Future<void>
mgpuReadAsyncFloat(MGPUBuffer buffer, Float32List outputData, {int readElements = 0, int elementOffset = 0}) → Future<void>
mgpuReadAsyncInt16(MGPUBuffer buffer, Int16List outputData, {int readElements = 0, int elementOffset = 0}) → Future<void>
mgpuReadAsyncInt32(MGPUBuffer buffer, Int32List outputData, {int readElements = 0, int elementOffset = 0}) → Future<void>
mgpuReadAsyncInt64(MGPUBuffer buffer, TypedData outputData, {int readElements = 0, int elementOffset = 0}) → Future<void>
mgpuReadAsyncInt8(MGPUBuffer buffer, Int8List outputData, {int readElements = 0, int elementOffset = 0}) → Future<void>
Asynchronous read functions for multiple types. Each function allocates native memory, calls ccall with async:true, then copies the data from the WebAssembly heap into the given Dart TypedData.
mgpuReadAsyncUint16(MGPUBuffer buffer, Uint16List outputData, {int readElements = 0, int elementOffset = 0}) → Future<void>
mgpuReadAsyncUint32(MGPUBuffer buffer, Uint32List outputData, {int readElements = 0, int elementOffset = 0}) → Future<void>
mgpuReadAsyncUint64(MGPUBuffer buffer, TypedData outputData, {int readElements = 0, int elementOffset = 0}) → Future<void>
mgpuReadAsyncUint8(MGPUBuffer buffer, Uint8List outputData, {int readElements = 0, int elementOffset = 0}) → Future<void>
mgpuSetBuffer(MGPUComputeShader shader, int tag, MGPUBuffer buffer) → void
mgpuSetLogLevel(int level) → void
Minimum native log verbosity (0=DEBUG 1=INFO 2=WARN 3=ERROR, -1 silences all). The wasm default is INFO, which narrates ~7 buffer ops per encoded frame straight onto the browser console via stderr printChar. Callable only once the module is loaded — MinigpuWeb stages the level and applies it right after ensureMinigpuModuleLoaded, before context init, so even the adapter/device bring-up logs honor it.
mgpuWriteDouble(MGPUBuffer buffer, Float64List inputData, int size) → void
mgpuWriteFloat(MGPUBuffer buffer, Float32List inputData, int size) → Future<void>
mgpuWriteInt16(MGPUBuffer buffer, Int16List inputData, int size) → void
mgpuWriteInt32(MGPUBuffer buffer, Int32List inputData, int size) → void
mgpuWriteInt64(MGPUBuffer buffer, Int64List inputData, int size) → void
mgpuWriteInt8(MGPUBuffer buffer, Int8List inputData, int size) → void
mgpuWriteUint16(MGPUBuffer buffer, Uint16List inputData, int size) → void
mgpuWriteUint32(MGPUBuffer buffer, Uint32List inputData, int size) → void
mgpuWriteUint64(MGPUBuffer buffer, Uint64List inputData, int size) → void
mgpuWriteUint8(MGPUBuffer buffer, Uint8List inputData, int size) → void