/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{getOrCreateMapValue as e}from"../../../../core/MapUtils.js";import{Sampler as r,SamplerDescriptor as s}from"../../../webgl/Sampler.js";class t{constructor(e){this.gl=e,this._samplers=new Map}addFromTexture(t){if(!t)return null;const i=t.descriptor,{samplingMode:n,wrapMode:p}=i,a="number"==typeof p,l=a?p:p.s,c=a?p:p.t,m=t.descriptor.context.gl.getExtension("EXT_texture_filter_anisotropic")?i.maxAnisotropy:void 0,u=new s(n,o(n),l,c,m);return e(this._samplers,u.key,()=>new r(this.gl,u))}dispose(){this._samplers.forEach(e=>e.dispose),this._samplers.clear()}}function o(e){switch(e){case 9985:case 9987:return 9729;default:return 9728}}export{t as SamplerRepository};
