UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 1.62 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import"../../../../core/has.js";import{NestedMap as e}from"../../../../core/NestedMap.js";import{ScreenSpaceGeometry as r}from"../effects/ScreenSpaceGeometry.js";import{VaoCache as s}from"../materials/renderers/VaoCache.js";import{AppleAmdDriverHelper as t}from"../../../webgl/AppleAmdDriverHelper.js";import{RenderingContext as i}from"../../../webgl/RenderingContext.js";class o extends i{constructor(s,t){super(s,t),this._vaoCaches=new e,this._appleAmdDriverHelper=null,this._refCount=1,this._newCache=t.newCache,this.screen=new r(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches?.forAll((e=>e.dispose())),this._vaoCaches?.clear(),--this._refCount>0||this.dispose()}ref(){++this._refCount}dispose(){super.dispose(),this._appleAmdDriverHelper?.dispose(),this.screen.destroy(),this._vaoCaches.forAll((e=>e.dispose())),this._vaoCaches.clear()}get newCache(){return this._newCache}getVaoCache(e,r){const t=Array.from(e).join("."),i=JSON.stringify(r),o=this._vaoCaches.get(t,i);if(o)return o;const a=new s(this,e,r);return this._vaoCaches.set(t,i,a),a}bindTechnique(e,r,s,t){return this.useProgram(e.program),this.setPipelineState(e.getPipeline()),e.program.bind(r),s&&(e.program.bindPass(s,r),t&&e.program.bindDraw(r,s,t)),e.program}runAppleAmdDriverHelper(){this.driverTest.drawArraysRequiresIndicesTypeReset.result&&(this._appleAmdDriverHelper??=new t(this),this._appleAmdDriverHelper.run())}get test(){}}export{o as RenderingContext};