/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../../../../chunks/_rollupPluginBabelHelpers","../../../../../core/maybe","../definitions","../Utils","./WGLBrush","../../../../webgl/enums"],(function(e,t,n,r,i,a){"use strict";const o=()=>r.createProgramDescriptor("overlay",{geometry:[{location:0,name:"a_pos",count:2,type:a.DataType.FLOAT}],tex:[{location:1,name:"a_uv",count:2,type:a.DataType.UNSIGNED_SHORT}]});let s=function(r){function i(){var e;return(e=r.apply(this,arguments)||this)._desc={vsPath:"overlay/overlay",fsPath:"overlay/overlay",attributes:new Map([["a_pos",0],["a_uv",1]])},e}e._inheritsLoose(i,r);var s=i.prototype;return s.dispose=function(){},s.prepareState=function({context:e}){e.setBlendingEnabled(!0),e.setColorMask(!0,!0,!0,!0),e.setBlendFunctionSeparate(a.BlendFactor.ONE,a.BlendFactor.ONE_MINUS_SRC_ALPHA,a.BlendFactor.ONE,a.BlendFactor.ONE_MINUS_SRC_ALPHA),e.setStencilWriteMask(0),e.setStencilTestEnabled(!0),e.setStencilFunction(a.CompareFunction.GREATER,255,255)},s.draw=function(e,r){const{context:i,painter:s,requestRender:u}=e;if(!r.isReady)return;const{computedOpacity:c,dvsMat3:l,isWrapAround:d,texture:p}=r;e.timeline.begin(this.name);const _=s.materialManager.getProgram(this._desc);if(t.isSome(u)&&!_.isCompiled)return void u();const m=o(),f=r.getVAO(i,m.bufferLayouts,m.attributes);if(!f)return;i.bindVAO(f),i.useProgram(_),i.bindTexture(p,n.TEXTURE_BINDING_BITMAP),_.setUniformMatrix3fv("u_dvsMat3",l),_.setUniform1i("u_texture",n.TEXTURE_BINDING_BITMAP),_.setUniform1f("u_opacity",c);const y=d?10:4;i.drawArrays(a.PrimitiveType.TRIANGLE_STRIP,0,y),i.bindVAO(),e.timeline.end(this.name)},i}(i);return s}));
