releaseSampler method

  1. @override
void releaseSampler(
  1. SamplerDescriptor sampler
)

Drops the GPUSampler made for sampler, and every cached bind group that holds it, so the object can be collected: WebGPU has no destroy for a sampler. The next bind of an equal description makes a new one.

Implementation

@override
void releaseSampler(SamplerDescriptor sampler) {
  final gone = _samplers.remove(sampler);
  if (gone == null) return;
  _bindGroups.removeWhere((_BindGroupKey key, _) => key.holds(gone));
}