MinigpuPlatform class abstract

Constructors

MinigpuPlatform()

Properties

drainSpinBudgetMs int?
Yield-spin budget (ms) the LOADED native binary implements before the event drain degrades to coarse sleeping, or null where it can't be asked (web, or a binary predating the export).
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedAdapterName String?
Name of the adapter Dawn actually selected, or null when the context is not initialized / the platform does not expose it.
no setter
shaderCacheDirectory String?
Directory the cache is using, or null when it is not using one.
no setter
shaderCacheStats ShaderCacheStats?
Cache counters for this process, or null where there is no cache.
no setter

Methods

clearShaderCache() int
Deletes every cached entry; returns how many files were removed.
configureShaderCache({bool? enabled, String? directory, int? maxBytes, String? extraKey}) bool
Configures the persistent shader cache. Returns true when the change was stored before any context was initialized (so it affects the next device), false when a context is already live or the platform has no shader cache. See Minigpu.configureShaderCache for the full contract.
createBuffer(int bufferSize, BufferDataType dataType) PlatformBuffer
createComputeShader() PlatformComputeShader
createD3D11DeviceOnDawnAdapter() int
Create a D3D11 device on the same DXGI adapter as Dawn's D3D12 device. Returns the ID3D11Device* address (non-zero) or 0 on failure. Windows-only; returns 0 on all other platforms.
createSecondaryPlatform(String adapterFilter) MinigpuPlatform?
Creates an INDEPENDENT platform context bound to the adapter whose name contains adapterFilter (case-insensitive substring, e.g. "3090") — its own device, queue, and task FIFO. Buffers and shaders created from the returned platform live on that adapter and must not be mixed with another context's resources in a single dispatch. Returns null on platforms without multi-adapter support (web).
createSharedOutputTexture(int width, int height) PlatformSharedOutputTexture?
Create a cross-API shared output texture (Windows: D3D12<->D3D11 zero-copy via NT shared handle). Returns null on unsupported platforms.
destroyContext() Future<void>
drainWorkQueue() → void
BLOCKS until every GPU task already queued has run.
importVideoFrame(ExternalVideoBuffer buf) PlatformVideoTexture?
Import a video frame into GPU texture memory. Returns null if unsupported or on failure.
initializeContext() Future<void>
isExternalContentTypeSupported(ExternalContentType type) bool
Returns true if the given content type can be imported on this platform.
isExternalPixelFormatSupported(ExternalPixelFormat format) bool
Returns true if the given pixel format can be imported on this platform.
listAdapters() List<GpuAdapterInfo>
Enumerates hardware adapters with their dedicated-VRAM totals and current usage. Empty on platforms without adapter enumeration (web).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
preferDisplayAdapter([bool enable = true]) bool
Pre-init hint (Windows): bind Dawn to the adapter driving the PRIMARY display so screen capture (Desktop Duplication / WGC), GPU processing and any D3D11 encoder created on Dawn's adapter share one GPU — same-adapter zero-copy import — even on multi-output hybrid systems where the discrete GPU also drives a monitor. The MGPU_ADAPTER_NAME env var still overrides.
queryVramBytes() int
Returns dedicated VRAM usage in bytes for the primary GPU. Returns -1 on platforms where the query is unavailable.
registerInstance() MinigpuPlatform
setLogCallback(void callback(int level, String message)?, {int level = 1}) → void
Install a log callback for the native minigpu/Dawn layer.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance MinigpuPlatform
Returns the current instance; creates if not yet initialized.
no setter