* @ignore * * Hot-path note: `getUnit` / `peekUnit` / `freeTextureUnit` are * called per-texture per-draw, so the `(source, repeat)` lookup is * inlined here rather than going through a helper that allocates a * `{source, repeat}` object on every call.
(texture)
| 102 | * `{source, repeat}` object on every call. |
| 103 | */ |
| 104 | freeTextureUnit(texture) { |
| 105 | const source = texture.sources.get(texture.activeAtlas); |
| 106 | const repeat = normalizeRepeat(texture.repeat); |
| 107 | const perRepeat = this.units.get(source); |
| 108 | const unit = perRepeat?.get(repeat); |
| 109 | // was a texture unit allocated ? |
| 110 | if (typeof unit !== "undefined") { |
| 111 | this.usedUnits.delete(unit); |
| 112 | perRepeat.delete(repeat); |
| 113 | if (perRepeat.size === 0) { |
| 114 | this.units.delete(source); |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * @ignore |
no test coverage detected