webgpuReleaseGeometry function
Destroys one geometry buffer and stops tracking it. See webgpuReleaseTexture.
Takes buffer as an Object and finds it by identity, deliberately: an
is test against an interop type asks a question about JavaScript rather
than about a Dart class, and membership in the list this device fills is the
better question anyway — it also rejects a buffer from another device.
Implementation
bool webgpuReleaseGeometry(Object buffer, List<GPUBuffer> tracked) {
if (buffer is! WebGpuGeometry) return false;
final at = tracked.indexWhere((GPUBuffer it) => identical(it, buffer.buffer));
if (at < 0) return false;
tracked.removeAt(at).destroy();
return true;
}