/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{DisplayList as s}from"./FeatureDisplayList.js";import{GpuMeshState as e}from"./cpuMapped/GpuMeshState.js";class t{constructor(){this.meshes=new Map,this.displayList=null}get usedMemory(){return this.displayList?.usedMemory??0}destroy(){for(const s of this.meshes.values())s.destroy();this.meshes.clear(),this.displayList=null}uploadGeometry(e,t,i,o){for(const[s,r]of o.meshes)this._ensureMesh(s,r.layout).upload(r);this.displayList=s.fromDisplayEntities(o.entities,e,t,i)}uploadVisibility(s){for(const[e,t]of s.meshes)this._ensureMesh(e,t.layout).uploadVisibility(t)}getMesh(s){return this.meshes.get(s)}_ensureMesh(s,t){let i=this.meshes.get(s);return null==i&&(i=new e(t),this.meshes.set(s,i)),i}}export{t as TileGpuState};
