/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import e from"../../core/Error.js";import has from"../../core/has.js";import r from"../../core/Logger.js";const n=()=>r.getLogger("esri.views.webgl.checkWebGLError");function t(e){switch(e.getError()){case e.NO_ERROR:return null;case e.INVALID_ENUM:return"Invalid Enum. An unacceptable value has been specified for an enumerated argument.";case e.INVALID_VALUE:return"Invalid Value. A numeric argument is out of range.";case e.INVALID_OPERATION:return"Invalid Operation. The specified command is not allowed for the current state.";case e.INVALID_FRAMEBUFFER_OPERATION:return"Invalid Framebuffer operation. The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it.";case e.OUT_OF_MEMORY:return"Out of memory. Not enough memory is left to execute the command.";case e.CONTEXT_LOST_WEBGL:return"WebGL context has been lost";default:return"Unknown error"}}const o=!!has("enable-feature:webgl-debug");function a(){return o}function c(){return o}function u(r,o=a()){if(o){const o=t(r);if(o){const r=(new Error).stack;n().error(new e("webgl-error","WebGL error occurred",{message:o,stack:r}))}}}export{u as checkWebGLError,t as getErrorMessage,o as hasFeatureFlagWebGLDebug,a as webglDebugEnabled,c as webglValidateShadersEnabled};
