webgpuReleaseTexture function

bool webgpuReleaseTexture(
  1. WebGpuTexture backend,
  2. List<WebGpuTexture> tracked
)

Destroys one texture and stops tracking it, or answers false for a handle this device does not hold — a double release, or one from another device.

A GPUTexture is a real allocation with an explicit destroy, exactly as a WebGLTexture is and unlike flutter_gpu's Texture, so this is the only thing that frees one before the whole device goes. A resize remakes six or seven full-screen targets; without this they stay until the tab does.

Implementation

bool webgpuReleaseTexture(WebGpuTexture backend, List<WebGpuTexture> tracked) {
  final at = tracked.indexWhere((WebGpuTexture it) => identical(it, backend));
  if (at < 0) return false;
  tracked.removeAt(at).texture.destroy();
  return true;
}