/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{PrimitiveType as e,PixelType as r}from"./enums.js";import{DisposableFramebufferObject as t}from"./FramebufferObject.js";import i from"./Texture.js";import{TextureDescriptor as o}from"./TextureDescriptor.js";import{VertexArrayObject as n}from"./VertexArrayObject.js";import{Pos2usLocations as s,Pos2us as a}from"./VertexAttributeLayouts.js";import{VertexBuffer as m}from"./VertexBuffer.js";import{WebGLDriverTestModule as p}from"./WebGLDriverTestModule.js";class u extends p{constructor(e){super(),this._rctx=e;const r="\n    precision highp float;\n\n    attribute vec2 position;\n    varying vec2 v_uv;\n\n    void main() {\n      v_uv = position;\n      gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);\n    }\n    ",t="\n    precision highp float;\n\n    varying vec2 v_uv;\n\n    uniform sampler2D u_texture;\n\n    void main() {\n      gl_FragColor = texture2D(u_texture, v_uv);\n    }\n    ";this._program=e.programCache.get(r,t,s)}dispose(){super.dispose()}_test(s){const p=this._rctx;if(!p.gl)return!0;const u=new o(1);u.wrapMode=33071,u.samplingMode=9728;const d=new t(p,u),g=new m(p,a,new Uint16Array([0,0,1,0,0,1,1,1])),f=new n(p,g),l=new o;l.samplingMode=9729,l.wrapMode=33071;const v=new i(p,l,c);p.useProgram(s),p.bindTexture(v,0),s.setUniform1i("u_texture",0);const w=p.boundFramebuffer,{x:h,y:x,width:b,height:_}=p.getViewport();p.bindFramebuffer(d),p.setViewport(0,0,1,1),p.setClearColor(0,0,0,0),p.setBlendingEnabled(!1),p.clear(16384),p.bindVAO(f),p.drawArrays(e.TRIANGLE_STRIP,0,4);const j=new Uint8Array(4);return d.readPixels(0,0,1,1,6408,r.UNSIGNED_BYTE,j),f.dispose(),d.dispose(),v.dispose(),p.setViewport(h,x,b,_),p.bindFramebuffer(w),255!==j[0]}}const c=new Image;c.src="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A",c.width=5,c.height=5,c.decode();export{u as SVGPremultipliedAlpha};
