flutter3d_wgpu 1.0.0-rc.2
flutter3d_wgpu: ^1.0.0-rc.2 copied to clipboard
The compute sidecar for flutter3d: a compute-only GraphicsDevice over wgpu-native through dart:ffi, so compute steps run on the GPU when the drawing device has none.
1.0.0-rc.2 #
Since the 2026-10-14 upload, the sidecar says which backend it chose. A readback no longer holds the caller, staging buffers and bind groups are kept, the encoder checks ranges and dispatches as every backend's does, and what it cannot draw is refused in the hardware layer's words. Nothing that went up on 2026-10-14 broke.
-
A device wgpu loses is told on
lost. wgpu-native's device-lost callback is wired through the C surface, and the sidecar hears it atbeginFrame, at a failed read and at a failed submit: oneDeviceLosswith reasonunknownand wgpu's words, andisLostturns true. Before, only the sidecar's owndisposewas told. -
The device request reaches the adapter.
WgpuSidecar.opentakes aDeviceRequest: its power preference picks the adapter,validationswitches on the API's validation layer andlabelnames the device. With no request, orPowerPreference.none, the API's default adapter is asked for; the sidecar asked for the discrete GPU whatever was wanted. The C surface is at ABI 4. -
The sidecar decides its backend and says which. It opened wgpu with every backend enabled, so a Windows machine computed on Direct3D 12 or on Vulkan depending on its drivers, and nothing recorded which. Now the platform's own backends are tried in order, each alone (Direct3D 12 then Vulkan on Windows, Metal on Apple platforms, Vulkan then OpenGL elsewhere),
WgpuSidecar.opentakes abackendand afallbackAdapter(WARP on Direct3D 12, what CI computes on), andWgpuSidecar.adapterInfo(new) answers aWgpuAdapterInfowith theWgpuBackendit runs on. A backend asked for and missing is refused, never replaced. The C side is ABI 3 (f3d_wgpu_open_on,f3d_wgpu_adapter_backend,f3d_wgpu_adapter_is_fallback). -
A readback that does not hold the caller.
readBufferstarts the copy, maps its staging buffer without waiting and polls the device on later turns of the event loop, where it waited on the queue in the calling turn: a frame's read now holds the UI isolate for its encoding, 0.09 ms in place of 2.19 ms for 2 MiB on an M-series Mac, and lands in 0.74 ms in place of 2.20 ms.readBufferSyncstill waits. The C side is ABI 2 (f3d_wgpu_read_begin,f3d_wgpu_read_poll). -
Staging buffers and bind groups are kept. A read copies through a staging buffer from a pool the device keeps, and a kernel keeps the last eight bind groups it made, keyed by resource ids that are never reused, and lets go of those of a buffer or texture released; each was made per read and per dispatch.
-
The encoder checks ranges and dispatches, as every backend's does: a storage offset off the 256-byte alignment, which wgpu would have refused late, is a
RangeErrorat the call. -
Its own dispose is a loss. The sidecar reported no loss at all; its
disposereportsDeviceLossReason.destroyedonlost(new) andisLostfollows. -
What it cannot draw is refused in the HAL's words: a render pass, pipeline or geometry is a
DeviceResourceException, where it was anUnsupportedError. Its registration takes the HAL'sDeviceRequest. -
Breaking:
wgpu_native_hook.dartis no library of this package. The fetch of the pinned wgpu-native is the build hook's own file,hook/wgpu_native.dart; nothing an application imports changes. -
The limits say the sidecar draws nothing: no colour attachment, one sample, no vertex buffer, attribute or inter-stage variable, where it answered WebGPU's defaults for all of them. A sampler handed to
bindTextureis checked by its features. -
backendIdiswgpu. It followed the display name,the wgpu sidecar; an id is fixed for good. -
The compute sidecar.
WgpuSidecar.openmakes a compute-onlyGraphicsDeviceover wgpu-native throughdart:ffi: storage buffers, RGBA8 textures and storage textures, a bundle's.f3dmat computekernels loaded throughflutter3d_shaders' WGSL, compute passes and readback. Everything that draws is refused by name.registerWgpuSidecaradds it to aDeviceRegistryasComputePlacement.sidecar. The four conformance kernels give the CPU's bytes on it. -
The pinned wgpu-native, in one file.
hook/wgpu_native.dartis the fetch this package's build hook uses: the release, its checksums and the unpacking.flutter3d_physics_nativekeeps a copy under its ownhook/, held to the same bytes, and does not depend on this package. -
Zero copy's first half.
WgpuSidecar.metalTextureOfanswers theMTLTexturebehind a sidecar texture on Metal. The sidecar does not reportDeviceFeature.sharedTextures, since it cannot import one back, so aSharedTexturebetween it and Impeller copies through host memory.