@loaders.gl/tiles 3.3.4 → 3.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/tiles",
3
- "version": "3.3.4",
3
+ "version": "3.3.5",
4
4
  "description": "Common components for different tiles loaders.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -33,8 +33,8 @@
33
33
  "build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
34
34
  },
35
35
  "dependencies": {
36
- "@loaders.gl/loader-utils": "3.3.4",
37
- "@loaders.gl/math": "3.3.4",
36
+ "@loaders.gl/loader-utils": "3.3.5",
37
+ "@loaders.gl/math": "3.3.5",
38
38
  "@math.gl/core": "^3.5.1",
39
39
  "@math.gl/culling": "^3.5.1",
40
40
  "@math.gl/geospatial": "^3.5.1",
@@ -44,5 +44,5 @@
44
44
  "peerDependencies": {
45
45
  "@loaders.gl/core": "^3.2.0"
46
46
  },
47
- "gitHead": "1d1a722ea9a04665acbe41359dfd01bf6d43a214"
47
+ "gitHead": "8aaa7fea4b7d72536d9d1f7d79688ec6702b2904"
48
48
  }
@@ -341,6 +341,13 @@ export class Tile3D {
341
341
  this._selectedFrame = 0;
342
342
  }
343
343
 
344
+ /**
345
+ * Memory usage of tile on GPU
346
+ */
347
+ _getGpuMemoryUsageInBytes(): number {
348
+ return this.content.gpuMemoryUsageInBytes || this.content.byteLength || 0;
349
+ }
350
+
344
351
  /*
345
352
  * If skipLevelOfDetail is off try to load child tiles as soon as possible so that their parent can refine sooner.
346
353
  * Tiles are prioritized by screen space error.
@@ -734,6 +741,8 @@ export class Tile3D {
734
741
  // The content may be tileset json
735
742
  if (this._isTileset()) {
736
743
  this.hasTilesetContent = true;
744
+ } else {
745
+ this.gpuMemoryUsageInBytes = this._getGpuMemoryUsageInBytes();
737
746
  }
738
747
  }
739
748
 
@@ -871,12 +871,12 @@ export class Tileset3D {
871
871
  this.stats.get(TILES_IN_MEMORY).incrementCount();
872
872
 
873
873
  // Good enough? Just use the raw binary ArrayBuffer's byte length.
874
- this.gpuMemoryUsageInBytes += tile.content.byteLength || 0;
874
+ this.gpuMemoryUsageInBytes += tile.gpuMemoryUsageInBytes || 0;
875
875
  this.stats.get(TILES_GPU_MEMORY).count = this.gpuMemoryUsageInBytes;
876
876
  }
877
877
 
878
878
  _unloadTile(tile) {
879
- this.gpuMemoryUsageInBytes -= (tile.content && tile.content.byteLength) || 0;
879
+ this.gpuMemoryUsageInBytes -= tile.gpuMemoryUsageInBytes || 0;
880
880
 
881
881
  this.stats.get(TILES_IN_MEMORY).decrementCount();
882
882
  this.stats.get(TILES_UNLOADED).incrementCount();