debugSamplerCount property

int get debugSamplerCount

Every GPU object this device owns and would have to release: the textures and geometry it handed out, the frame arenas and fallbacks it made for itself, and the modules, layouts, samplers, bind groups and _pipelines it cached.

Not zero on a fresh device, unlike the WebGL2 backend's count of the same name, and the difference is a fact about the two APIs rather than about the two implementations: this one allocates three arena buffers and a zeroed block before it is asked for anything. What it is for is the same — a leak is a number that climbs while a frame repeats — and it falls to zero after dispose just the same. How many distinct sampler objects this device has made.

Diagnostic, and the number that says whether _samplerFor is doing its job: a frame binding a hundred textures with SamplerDescriptor.linearRepeat should leave this at one. Read by webgpu_draw_test.dart, which is the only way to tell a cache hit from an allocation that happened to look the same.

Implementation

int get debugSamplerCount => _samplers.length;