UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 655 B
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{MemCachePool as t}from"../../../../../core/MemCachePool.js";import{VertexArrayObject as e}from"../../lib/VertexArrayObject.js";import{VertexBuffer as r}from"../../../../webgl/VertexBuffer.js";class o{constructor(e,r){this._rctx=e,this._layout=r,this._cache=new t(e.newCache,"VAOCache")}dispose(){this._cache.destroy()}newVao(t){const o=t.toString();let c=this._cache.pop(o);return c||(c=new e(this._rctx,new r(this._rctx,this._layout)),c.buffer()?.setSize(t),c)}deleteVao(t){if(null==t)return;const e=t.getByteLength("geometry").toString();this._cache.put(e,t)}}export{o as VaoCache};