@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.58 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import e from"../../../../../core/Logger.js";import{disposeMaybe as i}from"../../../../../core/maybe.js";import{isDepthOnlyOutput as r}from"../shaderLibrary/ShaderOutput.js";import{Default3D as t}from"../../lib/DefaultVertexAttributeLocations.js";import{Program as o}from"../../lib/Program.js";import{PrimitiveType as s,SpecialDrawBuffers as n}from"../../../../webgl/enums.js";import{makePipelineState as a,defaultColorWrite as p,premultipliedAlpha as l}from"../../../../webgl/renderState.js";const m=()=>e.getLogger("esri.views.3d.webgl.ShaderTechnique");class g{constructor(e,r,n,a=t){this.locations=a,this.primitiveType=s.TRIANGLES,this.key=r.key,this._program=new o(e.rctx,n.get().build(r),a),this._pipeline=this.initializePipeline(r),this.reload=async t=>{t&&await n.reload(),this.key.equals(r.key)||m().warn("Configuration was changed after construction, cannot reload shader.",n),i(this._program),this._program=new o(e.rctx,n.get().build(r),a),this._pipeline=this.initializePipeline(r)}}destroy(){this._program=i(this._program),this._pipeline=null}get program(){return this._program}get compiled(){return this.program.compiled}ensureAttributeLocations(e){this.program.assertCompatibleVertexAttributeLocations(e)}getPipeline(e,i){return this._pipeline}initializePipeline(e){return a({blending:l,colorWrite:p})}}function h(e,i){return r(e)?{buffers:[n.NONE]}:i??null}export{g as ShaderTechnique,h as depthOnlyOutputBuffersOr};