/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{FeatureTechnique as t}from"../FeatureTechnique.js";import{isHittest as e,getSelectionDefines as s,getFeatureUniforms as r,resolveDynamicUniforms as i,isHighlight as o,getFeaturePipelineState as a}from"../featureTechniqueUtils.js";import{getAntialiasingControls as n}from"./utils.js";import{GradientStrokeShader as p}from"../shaders/GradientStrokeShader.js";class h extends t{constructor(){super(...arguments),this.type=16,this.shaders={geometry:new p},this.symbologyPlane=1}_getShaderOptions(t,o,a){const{painter:p,pixelRatio:h}=t,l=o.instance.getInput();return{shader:this.shaders.geometry,uniforms:{...i(t,o.target,l.uniforms),...r(t,o.target),antialiasingControls:n(h),mosaicInfo:p.textureManager.getMosaicInfo(t,o.textureKey),technique:{isColorPass:a}},defines:{...s(t)},optionalAttributes:l.optionalAttributes,useComputeBuffer:e(t)}}render(t,s){const{painter:r}=t;if(e(t)||o(t)){const e=a(t);return r.setPipelineState(e),r.setShader(this._getShaderOptions(t,s,1)),void r.submitDraw(t,s)}t.context.setClearDepth(1),t.context.clear(256);const i={color:!1,depth:{write:{zNear:0,zFar:1},test:513},stencil:{write:!1,test:{compare:514,mask:255,op:{fail:7680,zFail:7680,zPass:7680}}}};r.setShader(this._getShaderOptions(t,s,0)),r.setPipelineState(i),r.submitDraw(t,s);const n={color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:{write:!1,test:515},stencil:{write:!1,test:{compare:514,mask:255,op:{fail:7680,zFail:7680,zPass:7680}}}};r.setShader(this._getShaderOptions(t,s,1)),r.setPipelineState(n),r.submitDraw(t,s)}}export{h as GradientStrokeTechnique};
