{
  "version": 3,
  "sources": ["../src/constants/webgl-constants.ts", "../src/context/polyfills/polyfill-webgl1-extensions.ts", "../src/utils/load-script.ts", "../src/context/helpers/webgl-context-data.ts", "../src/context/debug/spector.ts", "../src/context/debug/webgl-developer-tools.ts", "../src/context/parameters/webgl-parameter-tables.ts", "../src/context/parameters/unified-parameter-api.ts", "../src/context/state-tracker/deep-array-equal.ts", "../src/context/state-tracker/webgl-state-tracker.ts", "../src/context/helpers/create-browser-context.ts", "../src/context/helpers/webgl-extensions.ts", "../src/adapter/device-helpers/webgl-device-info.ts", "../src/adapter/converters/webgl-vertex-formats.ts", "../src/adapter/converters/webgl-texture-table.ts", "../src/adapter/device-helpers/webgl-device-features.ts", "../src/adapter/device-helpers/webgl-device-limits.ts", "../src/adapter/resources/webgl-framebuffer.ts", "../src/adapter/webgl-canvas-context.ts", "../src/adapter/webgl-presentation-context.ts", "../src/utils/uid.ts", "../src/adapter/resources/webgl-buffer.ts", "../src/adapter/helpers/parse-shader-compiler-log.ts", "../src/adapter/resources/webgl-shader.ts", "../src/adapter/converters/device-parameters.ts", "../src/adapter/converters/sampler-parameters.ts", "../src/adapter/resources/webgl-sampler.ts", "../src/context/state-tracker/with-parameters.ts", "../src/adapter/resources/webgl-texture-view.ts", "../src/adapter/converters/shader-formats.ts", "../src/adapter/resources/webgl-texture.ts", "../src/adapter/helpers/set-uniform.ts", "../src/adapter/helpers/webgl-topology-utils.ts", "../src/adapter/resources/webgl-render-pipeline.ts", "../src/adapter/converters/webgl-shadertypes.ts", "../src/adapter/helpers/get-shader-layout-from-glsl.ts", "../src/adapter/resources/webgl-shared-render-pipeline.ts", "../src/adapter/resources/webgl-command-buffer.ts", "../src/adapter/resources/webgl-render-pass.ts", "../src/adapter/resources/webgl-command-encoder.ts", "../src/utils/fill-array.ts", "../src/adapter/resources/webgl-vertex-array.ts", "../src/adapter/resources/webgl-transform-feedback.ts", "../src/adapter/resources/webgl-query-set.ts", "../src/adapter/resources/webgl-fence.ts", "../src/adapter/helpers/format-utils.ts", "../src/adapter/helpers/webgl-texture-utils.ts", "../src/adapter/webgl-device.ts", "../src/adapter/webgl-adapter.ts", "../src/index.ts"],
  "sourcesContent": ["// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable key-spacing, max-len, no-inline-comments, camelcase */\n\n/**\n * Standard WebGL, WebGL2 and extension constants (OpenGL constants)\n * @note (Most) of these constants are also defined on the WebGLRenderingContext interface.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants\n * @privateRemarks Locally called `GLEnum` instead of `GL`, because `babel-plugin-inline-webl-constants`\n *  both depends on and processes this module, but shouldn't replace these declarations.\n */\n// eslint-disable-next-line no-shadow\nenum GLEnum {\n  // Clearing buffers\n  // Constants passed to clear() to clear buffer masks.\n\n  /** Passed to clear to clear the current depth buffer. */\n  DEPTH_BUFFER_BIT = 0x00000100,\n  /** Passed to clear to clear the current stencil buffer. */\n  STENCIL_BUFFER_BIT = 0x00000400,\n  /** Passed to clear to clear the current color buffer. */\n  COLOR_BUFFER_BIT = 0x00004000,\n\n  // Rendering primitives\n  // Constants passed to drawElements() or drawArrays() to specify what kind of primitive to render.\n\n  /** Passed to drawElements or drawArrays to draw single points. */\n  POINTS = 0x0000,\n  /** Passed to drawElements or drawArrays to draw lines. Each vertex connects to the one after it. */\n  LINES = 0x0001,\n  /** Passed to drawElements or drawArrays to draw lines. Each set of two vertices is treated as a separate line segment. */\n  LINE_LOOP = 0x0002,\n  /** Passed to drawElements or drawArrays to draw a connected group of line segments from the first vertex to the last. */\n  LINE_STRIP = 0x0003,\n  /** Passed to drawElements or drawArrays to draw triangles. Each set of three vertices creates a separate triangle. */\n  TRIANGLES = 0x0004,\n  /** Passed to drawElements or drawArrays to draw a connected group of triangles. */\n  TRIANGLE_STRIP = 0x0005,\n  /** Passed to drawElements or drawArrays to draw a connected group of triangles. Each vertex connects to the previous and the first vertex in the fan. */\n  TRIANGLE_FAN = 0x0006,\n\n  // Blending modes\n  // Constants passed to blendFunc() or blendFuncSeparate() to specify the blending mode (for both, RBG and alpha, or separately).\n  /** Passed to blendFunc or blendFuncSeparate to turn off a component. */\n  ZERO = 0,\n  /** Passed to blendFunc or blendFuncSeparate to turn on a component. */\n  ONE = 1,\n  /** Passed to blendFunc or blendFuncSeparate to multiply a component by the source elements color. */\n  SRC_COLOR = 0x0300,\n  /** Passed to blendFunc or blendFuncSeparate to multiply a component by one minus the source elements color. */\n  ONE_MINUS_SRC_COLOR = 0x0301,\n  /** Passed to blendFunc or blendFuncSeparate to multiply a component by the source's alpha. */\n  SRC_ALPHA = 0x0302,\n  /** Passed to blendFunc or blendFuncSeparate to multiply a component by one minus the source's alpha. */\n  ONE_MINUS_SRC_ALPHA = 0x0303,\n  /** Passed to blendFunc or blendFuncSeparate to multiply a component by the destination's alpha. */\n  DST_ALPHA = 0x0304,\n  /** Passed to blendFunc or blendFuncSeparate to multiply a component by one minus the destination's alpha. */\n  ONE_MINUS_DST_ALPHA = 0x0305,\n  /** Passed to blendFunc or blendFuncSeparate to multiply a component by the destination's color. */\n  DST_COLOR = 0x0306,\n  /** Passed to blendFunc or blendFuncSeparate to multiply a component by one minus the destination's color. */\n  ONE_MINUS_DST_COLOR = 0x0307,\n  /** Passed to blendFunc or blendFuncSeparate to multiply a component by the minimum of source's alpha or one minus the destination's alpha. */\n  SRC_ALPHA_SATURATE = 0x0308,\n  /** Passed to blendFunc or blendFuncSeparate to specify a constant color blend function. */\n  CONSTANT_COLOR = 0x8001,\n  /** Passed to blendFunc or blendFuncSeparate to specify one minus a constant color blend function. */\n  ONE_MINUS_CONSTANT_COLOR = 0x8002,\n  /** Passed to blendFunc or blendFuncSeparate to specify a constant alpha blend function. */\n  CONSTANT_ALPHA = 0x8003,\n  /** Passed to blendFunc or blendFuncSeparate to specify one minus a constant alpha blend function. */\n  ONE_MINUS_CONSTANT_ALPHA = 0x8004,\n\n  // Blending equations\n  // Constants passed to blendEquation() or blendEquationSeparate() to control\n  // how the blending is calculated (for both, RBG and alpha, or separately).\n\n  /** Passed to blendEquation or blendEquationSeparate to set an addition blend function. */\n  /** Passed to blendEquation or blendEquationSeparate to specify a subtraction blend function (source - destination). */\n  /** Passed to blendEquation or blendEquationSeparate to specify a reverse subtraction blend function (destination - source). */\n  FUNC_ADD = 0x8006,\n  FUNC_SUBTRACT = 0x800a,\n  FUNC_REVERSE_SUBTRACT = 0x800b,\n\n  // Getting GL parameter information\n  // Constants passed to getParameter() to specify what information to return.\n\n  /** Passed to getParameter to get the current RGB blend function. */\n  BLEND_EQUATION = 0x8009,\n  /** Passed to getParameter to get the current RGB blend function. Same as BLEND_EQUATION */\n  BLEND_EQUATION_RGB = 0x8009,\n  /** Passed to getParameter to get the current alpha blend function. Same as BLEND_EQUATION */\n  BLEND_EQUATION_ALPHA = 0x883d,\n  /** Passed to getParameter to get the current destination RGB blend function. */\n  BLEND_DST_RGB = 0x80c8,\n  /** Passed to getParameter to get the current destination RGB blend function. */\n  BLEND_SRC_RGB = 0x80c9,\n  /** Passed to getParameter to get the current destination alpha blend function. */\n  BLEND_DST_ALPHA = 0x80ca,\n  /** Passed to getParameter to get the current source alpha blend function. */\n  BLEND_SRC_ALPHA = 0x80cb,\n\n  /** Passed to getParameter to return a the current blend color. */\n  BLEND_COLOR = 0x8005,\n  /** Passed to getParameter to get the array buffer binding. */\n  ARRAY_BUFFER_BINDING = 0x8894,\n  /** Passed to getParameter to get the current element array buffer. */\n  ELEMENT_ARRAY_BUFFER_BINDING = 0x8895,\n  /** Passed to getParameter to get the current lineWidth (set by the lineWidth method). */\n  LINE_WIDTH = 0x0b21,\n  /** Passed to getParameter to get the current size of a point drawn with gl.POINTS */\n  ALIASED_POINT_SIZE_RANGE = 0x846d,\n  /** Passed to getParameter to get the range of available widths for a line. Returns a length-2 array with the lo value at 0, and hight at 1. */\n  ALIASED_LINE_WIDTH_RANGE = 0x846e,\n  /** Passed to getParameter to get the current value of cullFace. Should return FRONT, BACK, or FRONT_AND_BACK */\n  CULL_FACE_MODE = 0x0b45,\n  /** Passed to getParameter to determine the current value of frontFace. Should return CW or CCW. */\n  FRONT_FACE = 0x0b46,\n  /** Passed to getParameter to return a length-2 array of floats giving the current depth range. */\n  DEPTH_RANGE = 0x0b70,\n  /** Passed to getParameter to determine if the depth write mask is enabled. */\n\n  DEPTH_WRITEMASK = 0x0b72,\n  /** Passed to getParameter to determine the current depth clear value. */\n  DEPTH_CLEAR_VALUE = 0x0b73,\n  /** Passed to getParameter to get the current depth function. Returns NEVER, ALWAYS, LESS, EQUAL, LEQUAL, GREATER, GEQUAL, or NOTEQUAL. */\n  DEPTH_FUNC = 0x0b74,\n  /** Passed to getParameter to get the value the stencil will be cleared to. */\n  STENCIL_CLEAR_VALUE = 0x0b91,\n  /** Passed to getParameter to get the current stencil function. Returns NEVER, ALWAYS, LESS, EQUAL, LEQUAL, GREATER, GEQUAL, or NOTEQUAL. */\n  STENCIL_FUNC = 0x0b92,\n  /** Passed to getParameter to get the current stencil fail function. Should return KEEP, REPLACE, INCR, DECR, INVERT, INCR_WRAP, or DECR_WRAP. */\n  STENCIL_FAIL = 0x0b94,\n  /** Passed to getParameter to get the current stencil fail function should the depth buffer test fail. Should return KEEP, REPLACE, INCR, DECR, INVERT, INCR_WRAP, or DECR_WRAP. */\n  STENCIL_PASS_DEPTH_FAIL = 0x0b95,\n  /** Passed to getParameter to get the current stencil fail function should the depth buffer test pass. Should return KEEP, REPLACE, INCR, DECR, INVERT, INCR_WRAP, or DECR_WRAP. */\n  STENCIL_PASS_DEPTH_PASS = 0x0b96,\n  /** Passed to getParameter to get the reference value used for stencil tests. */\n  STENCIL_REF = 0x0b97,\n  STENCIL_VALUE_MASK = 0x0b93,\n  STENCIL_WRITEMASK = 0x0b98,\n  STENCIL_BACK_FUNC = 0x8800,\n  STENCIL_BACK_FAIL = 0x8801,\n  STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802,\n  STENCIL_BACK_PASS_DEPTH_PASS = 0x8803,\n  STENCIL_BACK_REF = 0x8ca3,\n  STENCIL_BACK_VALUE_MASK = 0x8ca4,\n  STENCIL_BACK_WRITEMASK = 0x8ca5,\n\n  /** An Int32Array with four elements for the current viewport dimensions. */\n  VIEWPORT = 0x0ba2,\n  /** An Int32Array with four elements for the current scissor box dimensions. */\n  SCISSOR_BOX = 0x0c10,\n  COLOR_CLEAR_VALUE = 0x0c22,\n  COLOR_WRITEMASK = 0x0c23,\n  UNPACK_ALIGNMENT = 0x0cf5,\n  PACK_ALIGNMENT = 0x0d05,\n  MAX_TEXTURE_SIZE = 0x0d33,\n  MAX_VIEWPORT_DIMS = 0x0d3a,\n  SUBPIXEL_BITS = 0x0d50,\n  RED_BITS = 0x0d52,\n  GREEN_BITS = 0x0d53,\n  BLUE_BITS = 0x0d54,\n  ALPHA_BITS = 0x0d55,\n  DEPTH_BITS = 0x0d56,\n  STENCIL_BITS = 0x0d57,\n  POLYGON_OFFSET_UNITS = 0x2a00,\n  POLYGON_OFFSET_FACTOR = 0x8038,\n  TEXTURE_BINDING_2D = 0x8069,\n  SAMPLE_BUFFERS = 0x80a8,\n  SAMPLES = 0x80a9,\n  SAMPLE_COVERAGE_VALUE = 0x80aa,\n  SAMPLE_COVERAGE_INVERT = 0x80ab,\n  COMPRESSED_TEXTURE_FORMATS = 0x86a3,\n  VENDOR = 0x1f00,\n  RENDERER = 0x1f01,\n  VERSION = 0x1f02,\n  IMPLEMENTATION_COLOR_READ_TYPE = 0x8b9a,\n  IMPLEMENTATION_COLOR_READ_FORMAT = 0x8b9b,\n  BROWSER_DEFAULT_WEBGL = 0x9244,\n\n  // Buffers\n  // Constants passed to bufferData(), bufferSubData(), bindBuffer(), or\n  // getBufferParameter().\n\n  /** Passed to bufferData as a hint about whether the contents of the buffer are likely to be used often and not change often. */\n  STATIC_DRAW = 0x88e4,\n  /** Passed to bufferData as a hint about whether the contents of the buffer are likely to not be used often. */\n  STREAM_DRAW = 0x88e0,\n  /** Passed to bufferData as a hint about whether the contents of the buffer are likely to be used often and change often. */\n  DYNAMIC_DRAW = 0x88e8,\n  /** Passed to bindBuffer or bufferData to specify the type of buffer being used. */\n  ARRAY_BUFFER = 0x8892,\n  /** Passed to bindBuffer or bufferData to specify the type of buffer being used. */\n  ELEMENT_ARRAY_BUFFER = 0x8893,\n  /** Passed to getBufferParameter to get a buffer's size. */\n  BUFFER_SIZE = 0x8764,\n  /** Passed to getBufferParameter to get the hint for the buffer passed in when it was created. */\n  BUFFER_USAGE = 0x8765,\n\n  // Vertex attributes\n  // Constants passed to getVertexAttrib().\n\n  /** Passed to getVertexAttrib to read back the current vertex attribute. */\n  CURRENT_VERTEX_ATTRIB = 0x8626,\n  VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622,\n  VERTEX_ATTRIB_ARRAY_SIZE = 0x8623,\n  VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624,\n  VERTEX_ATTRIB_ARRAY_TYPE = 0x8625,\n  VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886a,\n  VERTEX_ATTRIB_ARRAY_POINTER = 0x8645,\n  VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889f,\n\n  // Culling\n  // Constants passed to cullFace().\n\n  /** Passed to enable/disable to turn on/off culling. Can also be used with getParameter to find the current culling method. */\n  CULL_FACE = 0x0b44,\n  /** Passed to cullFace to specify that only front faces should be culled. */\n  FRONT = 0x0404,\n  /** Passed to cullFace to specify that only back faces should be culled. */\n  BACK = 0x0405,\n  /** Passed to cullFace to specify that front and back faces should be culled. */\n  FRONT_AND_BACK = 0x0408,\n\n  // Enabling and disabling\n  // Constants passed to enable() or disable().\n\n  /** Passed to enable/disable to turn on/off blending. Can also be used with getParameter to find the current blending method. */\n  BLEND = 0x0be2,\n  /** Passed to enable/disable to turn on/off the depth test. Can also be used with getParameter to query the depth test. */\n  DEPTH_TEST = 0x0b71,\n  /** Passed to enable/disable to turn on/off dithering. Can also be used with getParameter to find the current dithering method. */\n  DITHER = 0x0bd0,\n  /** Passed to enable/disable to turn on/off the polygon offset. Useful for rendering hidden-line images, decals, and or solids with highlighted edges. Can also be used with getParameter to query the scissor test. */\n  POLYGON_OFFSET_FILL = 0x8037,\n  /** Passed to enable/disable to turn on/off the alpha to coverage. Used in multi-sampling alpha channels. */\n  SAMPLE_ALPHA_TO_COVERAGE = 0x809e,\n  /** Passed to enable/disable to turn on/off the sample coverage. Used in multi-sampling. */\n  SAMPLE_COVERAGE = 0x80a0,\n  /** Passed to enable/disable to turn on/off the scissor test. Can also be used with getParameter to query the scissor test. */\n  SCISSOR_TEST = 0x0c11,\n  /** Passed to enable/disable to turn on/off the stencil test. Can also be used with getParameter to query the stencil test. */\n  STENCIL_TEST = 0x0b90,\n\n  // Errors\n  // Constants returned from getError().\n\n  /** Returned from getError(). */\n  NO_ERROR = 0,\n  /** Returned from getError(). */\n  INVALID_ENUM = 0x0500,\n  /** Returned from getError(). */\n  INVALID_VALUE = 0x0501,\n  /** Returned from getError(). */\n  INVALID_OPERATION = 0x0502,\n  /** Returned from getError(). */\n  OUT_OF_MEMORY = 0x0505,\n  /** Returned from getError(). */\n  CONTEXT_LOST_WEBGL = 0x9242,\n\n  // Front face directions\n  // Constants passed to frontFace().\n\n  /** Passed to frontFace to specify the front face of a polygon is drawn in the clockwise direction */\n  CW = 0x0900,\n  /** Passed to frontFace to specify the front face of a polygon is drawn in the counter clockwise direction */\n  CCW = 0x0901,\n\n  // Hints\n  // Constants passed to hint()\n\n  /** There is no preference for this behavior. */\n  DONT_CARE = 0x1100,\n  /** The most efficient behavior should be used. */\n  FASTEST = 0x1101,\n  /** The most correct or the highest quality option should be used. */\n  NICEST = 0x1102,\n  /** Hint for the quality of filtering when generating mipmap images with WebGLRenderingContext.generateMipmap(). */\n  GENERATE_MIPMAP_HINT = 0x8192,\n\n  // Data types\n\n  BYTE = 0x1400,\n  UNSIGNED_BYTE = 0x1401,\n  SHORT = 0x1402,\n  UNSIGNED_SHORT = 0x1403,\n  INT = 0x1404,\n  UNSIGNED_INT = 0x1405,\n  FLOAT = 0x1406,\n  DOUBLE = 0x140a,\n\n  // Pixel formats\n\n  DEPTH_COMPONENT = 0x1902,\n  ALPHA = 0x1906,\n  RGB = 0x1907,\n  RGBA = 0x1908,\n  LUMINANCE = 0x1909,\n  LUMINANCE_ALPHA = 0x190a,\n\n  // Pixel types\n\n  // UNSIGNED_BYTE = 0x1401,\n  UNSIGNED_SHORT_4_4_4_4 = 0x8033,\n  UNSIGNED_SHORT_5_5_5_1 = 0x8034,\n  UNSIGNED_SHORT_5_6_5 = 0x8363,\n\n  // Shaders\n  // Constants passed to createShader() or getShaderParameter()\n\n  /** Passed to createShader to define a fragment shader. */\n  FRAGMENT_SHADER = 0x8b30,\n  /** Passed to createShader to define a vertex shader */\n  VERTEX_SHADER = 0x8b31,\n  /** Passed to getShaderParameter to get the status of the compilation. Returns false if the shader was not compiled. You can then query getShaderInfoLog to find the exact error */\n  COMPILE_STATUS = 0x8b81,\n  /** Passed to getShaderParameter to determine if a shader was deleted via deleteShader. Returns true if it was, false otherwise. */\n  DELETE_STATUS = 0x8b80,\n  /** Passed to getProgramParameter after calling linkProgram to determine if a program was linked correctly. Returns false if there were errors. Use getProgramInfoLog to find the exact error. */\n  LINK_STATUS = 0x8b82,\n  /** Passed to getProgramParameter after calling validateProgram to determine if it is valid. Returns false if errors were found. */\n  VALIDATE_STATUS = 0x8b83,\n  /** Passed to getProgramParameter after calling attachShader to determine if the shader was attached correctly. Returns false if errors occurred. */\n  ATTACHED_SHADERS = 0x8b85,\n  /** Passed to getProgramParameter to get the number of attributes active in a program. */\n  ACTIVE_ATTRIBUTES = 0x8b89,\n  /** Passed to getProgramParameter to get the number of uniforms active in a program. */\n  ACTIVE_UNIFORMS = 0x8b86,\n  /** The maximum number of entries possible in the vertex attribute list. */\n  MAX_VERTEX_ATTRIBS = 0x8869,\n  MAX_VERTEX_UNIFORM_VECTORS = 0x8dfb,\n  MAX_VARYING_VECTORS = 0x8dfc,\n  MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8b4d,\n  MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8b4c,\n  /** Implementation dependent number of maximum texture units. At least 8. */\n  MAX_TEXTURE_IMAGE_UNITS = 0x8872,\n  MAX_FRAGMENT_UNIFORM_VECTORS = 0x8dfd,\n  SHADER_TYPE = 0x8b4f,\n  SHADING_LANGUAGE_VERSION = 0x8b8c,\n  CURRENT_PROGRAM = 0x8b8d,\n\n  // Depth or stencil tests\n  // Constants passed to depthFunc() or stencilFunc().\n\n  /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass, i.e., nothing will be drawn. */\n  NEVER = 0x0200,\n  /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value. */\n  LESS = 0x0201,\n  /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value. */\n  EQUAL = 0x0202,\n  /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value. */\n  LEQUAL = 0x0203,\n  /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value. */\n  GREATER = 0x0204,\n  /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value. */\n  NOTEQUAL = 0x0205,\n  /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value. */\n  GEQUAL = 0x0206,\n  /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass, i.e., pixels will be drawn in the order they are drawn. */\n  ALWAYS = 0x0207,\n\n  // Stencil actions\n  // Constants passed to stencilOp().\n\n  KEEP = 0x1e00,\n  REPLACE = 0x1e01,\n  INCR = 0x1e02,\n  DECR = 0x1e03,\n  INVERT = 0x150a,\n  INCR_WRAP = 0x8507,\n  DECR_WRAP = 0x8508,\n\n  // Textures\n  // Constants passed to texParameteri(),\n  // texParameterf(), bindTexture(), texImage2D(), and others.\n\n  NEAREST = 0x2600,\n  LINEAR = 0x2601,\n  NEAREST_MIPMAP_NEAREST = 0x2700,\n  LINEAR_MIPMAP_NEAREST = 0x2701,\n  NEAREST_MIPMAP_LINEAR = 0x2702,\n  LINEAR_MIPMAP_LINEAR = 0x2703,\n  /** The texture magnification function is used when the pixel being textured maps to an area less than or equal to one texture element. It sets the texture magnification function to either GL_NEAREST or GL_LINEAR (see below). GL_NEAREST is generally faster than GL_LINEAR, but it can produce textured images with sharper edges because the transition between texture elements is not as smooth. Default: GL_LINEAR.  */\n  TEXTURE_MAG_FILTER = 0x2800,\n  /** The texture minifying function is used whenever the pixel being textured maps to an area greater than one texture element. There are six defined minifying functions. Two of them use the nearest one or nearest four texture elements to compute the texture value. The other four use mipmaps. Default: GL_NEAREST_MIPMAP_LINEAR */\n  TEXTURE_MIN_FILTER = 0x2801,\n  /** Sets the wrap parameter for texture coordinate  to either GL_CLAMP_TO_EDGE, GL_MIRRORED_REPEAT, or GL_REPEAT. G */\n  TEXTURE_WRAP_S = 0x2802,\n  /** Sets the wrap parameter for texture coordinate  to either GL_CLAMP_TO_EDGE, GL_MIRRORED_REPEAT, or GL_REPEAT. G */\n  TEXTURE_WRAP_T = 0x2803,\n  TEXTURE_2D = 0x0de1,\n  TEXTURE = 0x1702,\n  TEXTURE_CUBE_MAP = 0x8513,\n  TEXTURE_BINDING_CUBE_MAP = 0x8514,\n  TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515,\n  TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516,\n  TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517,\n  TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518,\n  TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519,\n  TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851a,\n  MAX_CUBE_MAP_TEXTURE_SIZE = 0x851c,\n  // TEXTURE0 - 31 0x84C0 - 0x84DF A texture unit.\n  TEXTURE0 = 0x84c0,\n  ACTIVE_TEXTURE = 0x84e0,\n  REPEAT = 0x2901,\n  CLAMP_TO_EDGE = 0x812f,\n  MIRRORED_REPEAT = 0x8370,\n\n  // Emulation\n  TEXTURE_WIDTH = 0x1000,\n  TEXTURE_HEIGHT = 0x1001,\n\n  // Uniform types\n\n  FLOAT_VEC2 = 0x8b50,\n  FLOAT_VEC3 = 0x8b51,\n  FLOAT_VEC4 = 0x8b52,\n  INT_VEC2 = 0x8b53,\n  INT_VEC3 = 0x8b54,\n  INT_VEC4 = 0x8b55,\n  BOOL = 0x8b56,\n  BOOL_VEC2 = 0x8b57,\n  BOOL_VEC3 = 0x8b58,\n  BOOL_VEC4 = 0x8b59,\n  FLOAT_MAT2 = 0x8b5a,\n  FLOAT_MAT3 = 0x8b5b,\n  FLOAT_MAT4 = 0x8b5c,\n  SAMPLER_2D = 0x8b5e,\n  SAMPLER_CUBE = 0x8b60,\n\n  // Shader precision-specified types\n\n  LOW_FLOAT = 0x8df0,\n  MEDIUM_FLOAT = 0x8df1,\n  HIGH_FLOAT = 0x8df2,\n  LOW_INT = 0x8df3,\n  MEDIUM_INT = 0x8df4,\n  HIGH_INT = 0x8df5,\n\n  // Framebuffers and renderbuffers\n\n  FRAMEBUFFER = 0x8d40,\n  RENDERBUFFER = 0x8d41,\n  RGBA4 = 0x8056,\n  RGB5_A1 = 0x8057,\n  RGB565 = 0x8d62,\n  DEPTH_COMPONENT16 = 0x81a5,\n  STENCIL_INDEX = 0x1901,\n  STENCIL_INDEX8 = 0x8d48,\n  DEPTH_STENCIL = 0x84f9,\n  RENDERBUFFER_WIDTH = 0x8d42,\n  RENDERBUFFER_HEIGHT = 0x8d43,\n  RENDERBUFFER_INTERNAL_FORMAT = 0x8d44,\n  RENDERBUFFER_RED_SIZE = 0x8d50,\n  RENDERBUFFER_GREEN_SIZE = 0x8d51,\n  RENDERBUFFER_BLUE_SIZE = 0x8d52,\n  RENDERBUFFER_ALPHA_SIZE = 0x8d53,\n  RENDERBUFFER_DEPTH_SIZE = 0x8d54,\n  RENDERBUFFER_STENCIL_SIZE = 0x8d55,\n  FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8cd0,\n  FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8cd1,\n  FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8cd2,\n  FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8cd3,\n  COLOR_ATTACHMENT0 = 0x8ce0,\n  DEPTH_ATTACHMENT = 0x8d00,\n  STENCIL_ATTACHMENT = 0x8d20,\n  DEPTH_STENCIL_ATTACHMENT = 0x821a,\n  NONE = 0,\n  FRAMEBUFFER_COMPLETE = 0x8cd5,\n  FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8cd6,\n  FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8cd7,\n  FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8cd9,\n  FRAMEBUFFER_UNSUPPORTED = 0x8cdd,\n  FRAMEBUFFER_BINDING = 0x8ca6,\n  RENDERBUFFER_BINDING = 0x8ca7,\n  READ_FRAMEBUFFER = 0x8ca8,\n  DRAW_FRAMEBUFFER = 0x8ca9,\n  MAX_RENDERBUFFER_SIZE = 0x84e8,\n  INVALID_FRAMEBUFFER_OPERATION = 0x0506,\n\n  // Pixel storage modes\n  // Constants passed to pixelStorei().\n\n  UNPACK_FLIP_Y_WEBGL = 0x9240,\n  UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241,\n  UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243,\n\n  // Additional constants defined WebGL 2\n  // These constants are defined on the WebGL2RenderingContext interface.\n  // All WebGL 1 constants are also available in a WebGL 2 context.\n\n  // Getting GL parameter information\n  // Constants passed to getParameter()\n  // to specify what information to return.\n\n  READ_BUFFER = 0x0c02,\n  UNPACK_ROW_LENGTH = 0x0cf2,\n  UNPACK_SKIP_ROWS = 0x0cf3,\n  UNPACK_SKIP_PIXELS = 0x0cf4,\n  PACK_ROW_LENGTH = 0x0d02,\n  PACK_SKIP_ROWS = 0x0d03,\n  PACK_SKIP_PIXELS = 0x0d04,\n  TEXTURE_BINDING_3D = 0x806a,\n  UNPACK_SKIP_IMAGES = 0x806d,\n  UNPACK_IMAGE_HEIGHT = 0x806e,\n  MAX_3D_TEXTURE_SIZE = 0x8073,\n  MAX_ELEMENTS_VERTICES = 0x80e8,\n  MAX_ELEMENTS_INDICES = 0x80e9,\n  MAX_TEXTURE_LOD_BIAS = 0x84fd,\n  MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8b49,\n  MAX_VERTEX_UNIFORM_COMPONENTS = 0x8b4a,\n  MAX_ARRAY_TEXTURE_LAYERS = 0x88ff,\n  MIN_PROGRAM_TEXEL_OFFSET = 0x8904,\n  MAX_PROGRAM_TEXEL_OFFSET = 0x8905,\n  MAX_VARYING_COMPONENTS = 0x8b4b,\n  FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8b8b,\n  RASTERIZER_DISCARD = 0x8c89,\n  VERTEX_ARRAY_BINDING = 0x85b5,\n  MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122,\n  MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125,\n  MAX_SERVER_WAIT_TIMEOUT = 0x9111,\n  MAX_ELEMENT_INDEX = 0x8d6b,\n\n  // Textures\n  // Constants passed to texParameteri(),\n  // texParameterf(), bindTexture(), texImage2D(), and others.\n\n  RED = 0x1903,\n  RGB8 = 0x8051,\n  RGBA8 = 0x8058,\n  RGB10_A2 = 0x8059,\n  TEXTURE_3D = 0x806f,\n  /** Sets the wrap parameter for texture coordinate  to either GL_CLAMP_TO_EDGE, GL_MIRRORED_REPEAT, or GL_REPEAT. G */\n  TEXTURE_WRAP_R = 0x8072,\n  TEXTURE_MIN_LOD = 0x813a,\n  TEXTURE_MAX_LOD = 0x813b,\n  TEXTURE_BASE_LEVEL = 0x813c,\n  TEXTURE_MAX_LEVEL = 0x813d,\n  TEXTURE_COMPARE_MODE = 0x884c,\n  TEXTURE_COMPARE_FUNC = 0x884d,\n  SRGB = 0x8c40,\n  SRGB8 = 0x8c41,\n  SRGB8_ALPHA8 = 0x8c43,\n  COMPARE_REF_TO_TEXTURE = 0x884e,\n  RGBA32F = 0x8814,\n  RGB32F = 0x8815,\n  RGBA16F = 0x881a,\n  RGB16F = 0x881b,\n  TEXTURE_2D_ARRAY = 0x8c1a,\n  TEXTURE_BINDING_2D_ARRAY = 0x8c1d,\n  R11F_G11F_B10F = 0x8c3a,\n  RGB9_E5 = 0x8c3d,\n  RGBA32UI = 0x8d70,\n  RGB32UI = 0x8d71,\n  RGBA16UI = 0x8d76,\n  RGB16UI = 0x8d77,\n  RGBA8UI = 0x8d7c,\n  RGB8UI = 0x8d7d,\n  RGBA32I = 0x8d82,\n  RGB32I = 0x8d83,\n  RGBA16I = 0x8d88,\n  RGB16I = 0x8d89,\n  RGBA8I = 0x8d8e,\n  RGB8I = 0x8d8f,\n  RED_INTEGER = 0x8d94,\n  RGB_INTEGER = 0x8d98,\n  RGBA_INTEGER = 0x8d99,\n  R8 = 0x8229,\n  RG8 = 0x822b,\n  R16F = 0x822d,\n  R32F = 0x822e,\n  RG16F = 0x822f,\n  RG32F = 0x8230,\n  R8I = 0x8231,\n  R8UI = 0x8232,\n  R16I = 0x8233,\n  R16UI = 0x8234,\n  R32I = 0x8235,\n  R32UI = 0x8236,\n  RG8I = 0x8237,\n  RG8UI = 0x8238,\n  RG16I = 0x8239,\n  RG16UI = 0x823a,\n  RG32I = 0x823b,\n  RG32UI = 0x823c,\n  R8_SNORM = 0x8f94,\n  RG8_SNORM = 0x8f95,\n  RGB8_SNORM = 0x8f96,\n  RGBA8_SNORM = 0x8f97,\n  RGB10_A2UI = 0x906f,\n\n  /* covered by extension\n  COMPRESSED_R11_EAC  = 0x9270,\n  COMPRESSED_SIGNED_R11_EAC = 0x9271,\n  COMPRESSED_RG11_EAC = 0x9272,\n  COMPRESSED_SIGNED_RG11_EAC  = 0x9273,\n  COMPRESSED_RGB8_ETC2  = 0x9274,\n  COMPRESSED_SRGB8_ETC2 = 0x9275,\n  COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2  = 0x9276,\n  COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC  = 0x9277,\n  COMPRESSED_RGBA8_ETC2_EAC = 0x9278,\n  COMPRESSED_SRGB8_ALPHA8_ETC2_EAC  = 0x9279,\n  */\n  TEXTURE_IMMUTABLE_FORMAT = 0x912f,\n  TEXTURE_IMMUTABLE_LEVELS = 0x82df,\n\n  // Pixel types\n\n  UNSIGNED_INT_2_10_10_10_REV = 0x8368,\n  UNSIGNED_INT_10F_11F_11F_REV = 0x8c3b,\n  UNSIGNED_INT_5_9_9_9_REV = 0x8c3e,\n  FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8dad,\n  UNSIGNED_INT_24_8 = 0x84fa,\n  HALF_FLOAT = 0x140b,\n  RG = 0x8227,\n  RG_INTEGER = 0x8228,\n  INT_2_10_10_10_REV = 0x8d9f,\n\n  // Queries\n\n  CURRENT_QUERY = 0x8865,\n  /** Returns a GLuint containing the query result. */\n  QUERY_RESULT = 0x8866,\n  /** Whether query result is available. */\n  QUERY_RESULT_AVAILABLE = 0x8867,\n  /** Occlusion query (if drawing passed depth test)  */\n  ANY_SAMPLES_PASSED = 0x8c2f,\n  /** Occlusion query less accurate/faster version */\n  ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8d6a,\n\n  // Draw buffers\n\n  MAX_DRAW_BUFFERS = 0x8824,\n  DRAW_BUFFER0 = 0x8825,\n  DRAW_BUFFER1 = 0x8826,\n  DRAW_BUFFER2 = 0x8827,\n  DRAW_BUFFER3 = 0x8828,\n  DRAW_BUFFER4 = 0x8829,\n  DRAW_BUFFER5 = 0x882a,\n  DRAW_BUFFER6 = 0x882b,\n  DRAW_BUFFER7 = 0x882c,\n  DRAW_BUFFER8 = 0x882d,\n  DRAW_BUFFER9 = 0x882e,\n  DRAW_BUFFER10 = 0x882f,\n  DRAW_BUFFER11 = 0x8830,\n  DRAW_BUFFER12 = 0x8831,\n  DRAW_BUFFER13 = 0x8832,\n  DRAW_BUFFER14 = 0x8833,\n  DRAW_BUFFER15 = 0x8834,\n  MAX_COLOR_ATTACHMENTS = 0x8cdf,\n  COLOR_ATTACHMENT1 = 0x8ce1,\n  COLOR_ATTACHMENT2 = 0x8ce2,\n  COLOR_ATTACHMENT3 = 0x8ce3,\n  COLOR_ATTACHMENT4 = 0x8ce4,\n  COLOR_ATTACHMENT5 = 0x8ce5,\n  COLOR_ATTACHMENT6 = 0x8ce6,\n  COLOR_ATTACHMENT7 = 0x8ce7,\n  COLOR_ATTACHMENT8 = 0x8ce8,\n  COLOR_ATTACHMENT9 = 0x8ce9,\n  COLOR_ATTACHMENT10 = 0x8cea,\n  COLOR_ATTACHMENT11 = 0x8ceb,\n  COLOR_ATTACHMENT12 = 0x8cec,\n  COLOR_ATTACHMENT13 = 0x8ced,\n  COLOR_ATTACHMENT14 = 0x8cee,\n  COLOR_ATTACHMENT15 = 0x8cef,\n\n  // Samplers\n\n  SAMPLER_3D = 0x8b5f,\n  SAMPLER_2D_SHADOW = 0x8b62,\n  SAMPLER_2D_ARRAY = 0x8dc1,\n  SAMPLER_2D_ARRAY_SHADOW = 0x8dc4,\n  SAMPLER_CUBE_SHADOW = 0x8dc5,\n  INT_SAMPLER_2D = 0x8dca,\n  INT_SAMPLER_3D = 0x8dcb,\n  INT_SAMPLER_CUBE = 0x8dcc,\n  INT_SAMPLER_2D_ARRAY = 0x8dcf,\n  UNSIGNED_INT_SAMPLER_2D = 0x8dd2,\n  UNSIGNED_INT_SAMPLER_3D = 0x8dd3,\n  UNSIGNED_INT_SAMPLER_CUBE = 0x8dd4,\n  UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8dd7,\n  MAX_SAMPLES = 0x8d57,\n  SAMPLER_BINDING = 0x8919,\n\n  // Buffers\n\n  PIXEL_PACK_BUFFER = 0x88eb,\n  PIXEL_UNPACK_BUFFER = 0x88ec,\n  PIXEL_PACK_BUFFER_BINDING = 0x88ed,\n  PIXEL_UNPACK_BUFFER_BINDING = 0x88ef,\n  COPY_READ_BUFFER = 0x8f36,\n  COPY_WRITE_BUFFER = 0x8f37,\n  COPY_READ_BUFFER_BINDING = 0x8f36,\n  COPY_WRITE_BUFFER_BINDING = 0x8f37,\n\n  // Data types\n\n  FLOAT_MAT2x3 = 0x8b65,\n  FLOAT_MAT2x4 = 0x8b66,\n  FLOAT_MAT3x2 = 0x8b67,\n  FLOAT_MAT3x4 = 0x8b68,\n  FLOAT_MAT4x2 = 0x8b69,\n  FLOAT_MAT4x3 = 0x8b6a,\n  UNSIGNED_INT_VEC2 = 0x8dc6,\n  UNSIGNED_INT_VEC3 = 0x8dc7,\n  UNSIGNED_INT_VEC4 = 0x8dc8,\n  UNSIGNED_NORMALIZED = 0x8c17,\n  SIGNED_NORMALIZED = 0x8f9c,\n\n  // Vertex attributes\n\n  VERTEX_ATTRIB_ARRAY_INTEGER = 0x88fd,\n  VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88fe,\n\n  // Transform feedback\n\n  TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8c7f,\n  MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8c80,\n  TRANSFORM_FEEDBACK_VARYINGS = 0x8c83,\n  TRANSFORM_FEEDBACK_BUFFER_START = 0x8c84,\n  TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8c85,\n  TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8c88,\n  MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8c8a,\n  MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8c8b,\n  INTERLEAVED_ATTRIBS = 0x8c8c,\n  SEPARATE_ATTRIBS = 0x8c8d,\n  TRANSFORM_FEEDBACK_BUFFER = 0x8c8e,\n  TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8c8f,\n  TRANSFORM_FEEDBACK = 0x8e22,\n  TRANSFORM_FEEDBACK_PAUSED = 0x8e23,\n  TRANSFORM_FEEDBACK_ACTIVE = 0x8e24,\n  TRANSFORM_FEEDBACK_BINDING = 0x8e25,\n\n  // Framebuffers and renderbuffers\n\n  FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210,\n  FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211,\n  FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212,\n  FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213,\n  FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214,\n  FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215,\n  FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216,\n  FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217,\n  FRAMEBUFFER_DEFAULT = 0x8218,\n  // DEPTH_STENCIL_ATTACHMENT  = 0x821A,\n  // DEPTH_STENCIL = 0x84F9,\n  DEPTH24_STENCIL8 = 0x88f0,\n  DRAW_FRAMEBUFFER_BINDING = 0x8ca6,\n  READ_FRAMEBUFFER_BINDING = 0x8caa,\n  RENDERBUFFER_SAMPLES = 0x8cab,\n  FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8cd4,\n  FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8d56,\n\n  // Uniforms\n\n  UNIFORM_BUFFER = 0x8a11,\n  UNIFORM_BUFFER_BINDING = 0x8a28,\n  UNIFORM_BUFFER_START = 0x8a29,\n  UNIFORM_BUFFER_SIZE = 0x8a2a,\n  MAX_VERTEX_UNIFORM_BLOCKS = 0x8a2b,\n  MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8a2d,\n  MAX_COMBINED_UNIFORM_BLOCKS = 0x8a2e,\n  MAX_UNIFORM_BUFFER_BINDINGS = 0x8a2f,\n  MAX_UNIFORM_BLOCK_SIZE = 0x8a30,\n  MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8a31,\n  MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8a33,\n  UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8a34,\n  ACTIVE_UNIFORM_BLOCKS = 0x8a36,\n  UNIFORM_TYPE = 0x8a37,\n  UNIFORM_SIZE = 0x8a38,\n  UNIFORM_BLOCK_INDEX = 0x8a3a,\n  UNIFORM_OFFSET = 0x8a3b,\n  UNIFORM_ARRAY_STRIDE = 0x8a3c,\n  UNIFORM_MATRIX_STRIDE = 0x8a3d,\n  UNIFORM_IS_ROW_MAJOR = 0x8a3e,\n  UNIFORM_BLOCK_BINDING = 0x8a3f,\n  UNIFORM_BLOCK_DATA_SIZE = 0x8a40,\n  UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8a42,\n  UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8a43,\n  UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8a44,\n  UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8a46,\n\n  // Sync objects\n\n  OBJECT_TYPE = 0x9112,\n  SYNC_CONDITION = 0x9113,\n  SYNC_STATUS = 0x9114,\n  SYNC_FLAGS = 0x9115,\n  SYNC_FENCE = 0x9116,\n  SYNC_GPU_COMMANDS_COMPLETE = 0x9117,\n  UNSIGNALED = 0x9118,\n  SIGNALED = 0x9119,\n  ALREADY_SIGNALED = 0x911a,\n  TIMEOUT_EXPIRED = 0x911b,\n  CONDITION_SATISFIED = 0x911c,\n  WAIT_FAILED = 0x911d,\n  SYNC_FLUSH_COMMANDS_BIT = 0x00000001,\n\n  // Miscellaneous constants\n\n  COLOR = 0x1800,\n  DEPTH = 0x1801,\n  STENCIL = 0x1802,\n  MIN = 0x8007,\n  MAX = 0x8008,\n  DEPTH_COMPONENT24 = 0x81a6,\n  STREAM_READ = 0x88e1,\n  STREAM_COPY = 0x88e2,\n  STATIC_READ = 0x88e5,\n  STATIC_COPY = 0x88e6,\n  DYNAMIC_READ = 0x88e9,\n  DYNAMIC_COPY = 0x88ea,\n  DEPTH_COMPONENT32F = 0x8cac,\n  DEPTH32F_STENCIL8 = 0x8cad,\n  INVALID_INDEX = 0xffffffff,\n  TIMEOUT_IGNORED = -1,\n  MAX_CLIENT_WAIT_TIMEOUT_WEBGL = 0x9247,\n\n  // Constants defined in WebGL extensions\n\n  // WEBGL_debug_renderer_info\n\n  /** Passed to getParameter to get the vendor string of the graphics driver. */\n  UNMASKED_VENDOR_WEBGL = 0x9245,\n  /** Passed to getParameter to get the renderer string of the graphics driver. */\n  UNMASKED_RENDERER_WEBGL = 0x9246,\n\n  // EXT_texture_filter_anisotropic\n\n  /** Returns the maximum available anisotropy. */\n  MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84ff,\n  /** Passed to texParameter to set the desired maximum anisotropy for a texture. */\n  TEXTURE_MAX_ANISOTROPY_EXT = 0x84fe,\n\n  // EXT_texture_norm16 - https://khronos.org/registry/webgl/extensions/EXT_texture_norm16/\n\n  R16_EXT = 0x822a,\n  RG16_EXT = 0x822c,\n  RGB16_EXT = 0x8054,\n  RGBA16_EXT = 0x805b,\n  R16_SNORM_EXT = 0x8f98,\n  RG16_SNORM_EXT = 0x8f99,\n  RGB16_SNORM_EXT = 0x8f9a,\n  RGBA16_SNORM_EXT = 0x8f9b,\n\n  // WEBGL_compressed_texture_s3tc (BC1, BC2, BC3)\n\n  /** A DXT1-compressed image in an RGB image format. */\n  COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83f0,\n  /** A DXT1-compressed image in an RGB image format with a simple on/off alpha value. */\n  COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83f1,\n  /** A DXT3-compressed image in an RGBA image format. Compared to a 32-bit RGBA texture, it offers 4:1 compression. */\n  COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83f2,\n  /** A DXT5-compressed image in an RGBA image format. It also provides a 4:1 compression, but differs to the DXT3 compression in how the alpha compression is done. */\n  COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83f3,\n\n  // WEBGL_compressed_texture_s3tc_srgb (BC1, BC2, BC3 -  SRGB)\n\n  COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8c4c,\n  COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8c4d,\n  COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8c4e,\n  COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8c4f,\n\n  // WEBGL_compressed_texture_rgtc (BC4, BC5)\n\n  COMPRESSED_RED_RGTC1_EXT = 0x8dbb,\n  COMPRESSED_SIGNED_RED_RGTC1_EXT = 0x8dbc,\n  COMPRESSED_RED_GREEN_RGTC2_EXT = 0x8dbd,\n  COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 0x8dbe,\n\n  // WEBGL_compressed_texture_bptc (BC6, BC7)\n\n  COMPRESSED_RGBA_BPTC_UNORM_EXT = 0x8e8c,\n  COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 0x8e8d,\n  COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 0x8e8e,\n  COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 0x8e8f,\n\n  // WEBGL_compressed_texture_es3\n\n  /** One-channel (red) unsigned format compression. */\n  COMPRESSED_R11_EAC = 0x9270,\n  /** One-channel (red) signed format compression. */\n  COMPRESSED_SIGNED_R11_EAC = 0x9271,\n  /** Two-channel (red and green) unsigned format compression. */\n  COMPRESSED_RG11_EAC = 0x9272,\n  /** Two-channel (red and green) signed format compression. */\n  COMPRESSED_SIGNED_RG11_EAC = 0x9273,\n  /** Compresses RGB8 data with no alpha channel. */\n  COMPRESSED_RGB8_ETC2 = 0x9274,\n  /** Compresses RGBA8 data. The RGB part is encoded the same as RGB_ETC2, but the alpha part is encoded separately. */\n  COMPRESSED_RGBA8_ETC2_EAC = 0x9275,\n  /** Compresses sRGB8 data with no alpha channel. */\n  COMPRESSED_SRGB8_ETC2 = 0x9276,\n  /** Compresses sRGBA8 data. The sRGB part is encoded the same as SRGB_ETC2, but the alpha part is encoded separately. */\n  COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9277,\n  /** Similar to RGB8_ETC, but with ability to punch through the alpha channel, which means to make it completely opaque or transparent. */\n  COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9278,\n  /** Similar to SRGB8_ETC, but with ability to punch through the alpha channel, which means to make it completely opaque or transparent. */\n  COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9279,\n\n  // WEBGL_compressed_texture_pvrtc\n\n  /** RGB compression in 4-bit mode. One block for each 4\u00D74 pixels. */\n  COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8c00,\n  /** RGBA compression in 4-bit mode. One block for each 4\u00D74 pixels. */\n  COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8c02,\n  /** RGB compression in 2-bit mode. One block for each 8\u00D74 pixels. */\n  COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8c01,\n  /** RGBA compression in 2-bit mode. One block for each 8\u00D74 pixels. */\n  COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8c03,\n\n  // WEBGL_compressed_texture_etc1\n\n  /** Compresses 24-bit RGB data with no alpha channel. */\n  COMPRESSED_RGB_ETC1_WEBGL = 0x8d64,\n\n  // WEBGL_compressed_texture_atc\n\n  COMPRESSED_RGB_ATC_WEBGL = 0x8c92,\n  COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 0x8c92,\n  COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 0x87ee,\n\n  // WEBGL_compressed_texture_astc\n\n  COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93b0,\n  COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93b1,\n  COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93b2,\n  COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93b3,\n  COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93b4,\n  COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93b5,\n  COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93b6,\n  COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93b7,\n  COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93b8,\n  COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93b9,\n  COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93ba,\n  COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93bb,\n  COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93bc,\n  COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93bd,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93d0,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93d1,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93d2,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93d3,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93d4,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93d5,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93d6,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93d7,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93d8,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93d9,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93da,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93db,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93dc,\n  COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93dd,\n\n  // EXT_disjoint_timer_query\n\n  /** The number of bits used to hold the query result for the given target. */\n  QUERY_COUNTER_BITS_EXT = 0x8864,\n  /** The currently active query. */\n  CURRENT_QUERY_EXT = 0x8865,\n  /** The query result. */\n  QUERY_RESULT_EXT = 0x8866,\n  /** A Boolean indicating whether or not a query result is available. */\n  QUERY_RESULT_AVAILABLE_EXT = 0x8867,\n  /** Elapsed time (in nanoseconds). */\n  TIME_ELAPSED_EXT = 0x88bf,\n  /** The current time. */\n  TIMESTAMP_EXT = 0x8e28,\n  /** A Boolean indicating whether or not the GPU performed any disjoint operation (lost context) */\n  GPU_DISJOINT_EXT = 0x8fbb,\n\n  // KHR_parallel_shader_compile https://registry.khronos.org/webgl/extensions/KHR_parallel_shader_compile\n\n  /** a non-blocking poll operation, so that compile/link status availability can be queried without potentially incurring stalls */\n  COMPLETION_STATUS_KHR = 0x91b1,\n\n  // EXT_depth_clamp https://registry.khronos.org/webgl/extensions/EXT_depth_clamp/\n\n  /** Disables depth clipping */\n  DEPTH_CLAMP_EXT = 0x864f,\n\n  // WEBGL_provoking_vertex https://registry.khronos.org/webgl/extensions/WEBGL_provoking_vertex/\n\n  /** Values of first vertex in primitive are used for flat shading */\n  FIRST_VERTEX_CONVENTION_WEBGL = 0x8e4d,\n  /** Values of first vertex in primitive are used for flat shading */\n  LAST_VERTEX_CONVENTION_WEBGL = 0x8e4e, // default\n  /** Controls which vertex in primitive is used for flat shading */\n  PROVOKING_VERTEX_WEBL = 0x8e4f,\n\n  // WEBGL_polygon_mode https://registry.khronos.org/webgl/extensions/WEBGL_polygon_mode/\n\n  POLYGON_MODE_WEBGL = 0x0b40,\n  POLYGON_OFFSET_LINE_WEBGL = 0x2a02,\n  LINE_WEBGL = 0x1b01,\n  FILL_WEBGL = 0x1b02,\n\n  // WEBGL_clip_cull_distance https://registry.khronos.org/webgl/extensions/WEBGL_clip_cull_distance/\n\n  /** Max clip distances */\n  MAX_CLIP_DISTANCES_WEBGL = 0x0d32,\n  /** Max cull distances */\n  MAX_CULL_DISTANCES_WEBGL = 0x82f9,\n  /** Max clip and cull distances */\n  MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL = 0x82fa,\n\n  /** Enable gl_ClipDistance[0] and gl_CullDistance[0] */\n  CLIP_DISTANCE0_WEBGL = 0x3000,\n  /** Enable gl_ClipDistance[1] and gl_CullDistance[1] */\n  CLIP_DISTANCE1_WEBGL = 0x3001,\n  /** Enable gl_ClipDistance[2] and gl_CullDistance[2] */\n  CLIP_DISTANCE2_WEBGL = 0x3002,\n  /** Enable gl_ClipDistance[3] and gl_CullDistance[3] */\n  CLIP_DISTANCE3_WEBGL = 0x3003,\n  /** Enable gl_ClipDistance[4] and gl_CullDistance[4] */\n  CLIP_DISTANCE4_WEBGL = 0x3004,\n  /** Enable gl_ClipDistance[5] and gl_CullDistance[5] */\n  CLIP_DISTANCE5_WEBGL = 0x3005,\n  /** Enable gl_ClipDistance[6] and gl_CullDistance[6] */\n  CLIP_DISTANCE6_WEBGL = 0x3006,\n  /** Enable gl_ClipDistance[7] and gl_CullDistance[7] */\n  CLIP_DISTANCE7_WEBGL = 0x3007,\n\n  /** EXT_polygon_offset_clamp https://registry.khronos.org/webgl/extensions/EXT_polygon_offset_clamp/ */\n  POLYGON_OFFSET_CLAMP_EXT = 0x8e1b,\n\n  /** EXT_clip_control https://registry.khronos.org/webgl/extensions/EXT_clip_control/ */\n  LOWER_LEFT_EXT = 0x8ca1,\n  UPPER_LEFT_EXT = 0x8ca2,\n\n  NEGATIVE_ONE_TO_ONE_EXT = 0x935e,\n  ZERO_TO_ONE_EXT = 0x935f,\n\n  CLIP_ORIGIN_EXT = 0x935c,\n  CLIP_DEPTH_MODE_EXT = 0x935d,\n\n  /** WEBGL_blend_func_extended https://registry.khronos.org/webgl/extensions/WEBGL_blend_func_extended/ */\n  SRC1_COLOR_WEBGL = 0x88f9,\n  SRC1_ALPHA_WEBGL = 0x8589,\n  ONE_MINUS_SRC1_COLOR_WEBGL = 0x88fa,\n  ONE_MINUS_SRC1_ALPHA_WEBGL = 0x88fb,\n  MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL = 0x88fc,\n\n  /** EXT_texture_mirror_clamp_to_edge https://registry.khronos.org/webgl/extensions/EXT_texture_mirror_clamp_to_edge/ */\n  MIRROR_CLAMP_TO_EDGE_EXT = 0x8743\n}\n\nexport {GLEnum as GL};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Goal is to make WebGL2 contexts look like WebGL1\n// @note Partly inspired by with some older code from the `regl` library\n\n/* eslint-disable camelcase */\n\nimport {GL} from '@luma.gl/webgl/constants';\n\n// webgl1 extensions natively supported by webgl2\nconst WEBGL1_STATIC_EXTENSIONS = {\n  WEBGL_depth_texture: {\n    UNSIGNED_INT_24_8_WEBGL: GL.UNSIGNED_INT_24_8\n  } as const satisfies WEBGL_depth_texture,\n  OES_element_index_uint: {} as const satisfies OES_element_index_uint,\n  OES_texture_float: {} as const satisfies OES_texture_float,\n  OES_texture_half_float: {\n    // @ts-expect-error different numbers?\n    HALF_FLOAT_OES: GL.HALF_FLOAT\n  } as const satisfies OES_texture_half_float,\n  EXT_color_buffer_float: {} as const satisfies EXT_color_buffer_float,\n  OES_standard_derivatives: {\n    FRAGMENT_SHADER_DERIVATIVE_HINT_OES: GL.FRAGMENT_SHADER_DERIVATIVE_HINT\n  } as const satisfies OES_standard_derivatives,\n  EXT_frag_depth: {} as const satisfies EXT_frag_depth,\n  EXT_blend_minmax: {\n    MIN_EXT: GL.MIN,\n    MAX_EXT: GL.MAX\n  } as const satisfies EXT_blend_minmax,\n  EXT_shader_texture_lod: {} as const satisfies EXT_shader_texture_lod\n};\n\nconst getWEBGL_draw_buffers = (gl: WebGL2RenderingContext) =>\n  ({\n    drawBuffersWEBGL(buffers: number[]) {\n      return gl.drawBuffers(buffers);\n    },\n    COLOR_ATTACHMENT0_WEBGL: GL.COLOR_ATTACHMENT0,\n    COLOR_ATTACHMENT1_WEBGL: GL.COLOR_ATTACHMENT1,\n    COLOR_ATTACHMENT2_WEBGL: GL.COLOR_ATTACHMENT2,\n    COLOR_ATTACHMENT3_WEBGL: GL.COLOR_ATTACHMENT3\n  }) as const satisfies Partial<WEBGL_draw_buffers>; // - too many fields\n\nconst getOES_vertex_array_object = (gl: WebGL2RenderingContext) =>\n  ({\n    VERTEX_ARRAY_BINDING_OES: GL.VERTEX_ARRAY_BINDING,\n    createVertexArrayOES() {\n      return gl.createVertexArray();\n    },\n    deleteVertexArrayOES(vertexArray: WebGLVertexArrayObject): void {\n      return gl.deleteVertexArray(vertexArray);\n    },\n    isVertexArrayOES(vertexArray: WebGLVertexArrayObject): boolean {\n      return gl.isVertexArray(vertexArray);\n    },\n    bindVertexArrayOES(vertexArray: WebGLVertexArrayObject): void {\n      return gl.bindVertexArray(vertexArray);\n    }\n  }) as const satisfies OES_vertex_array_object;\n\nconst getANGLE_instanced_arrays = (gl: WebGL2RenderingContext) =>\n  ({\n    VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: 0x88fe,\n    drawArraysInstancedANGLE(...args) {\n      return gl.drawArraysInstanced(...args);\n    },\n    drawElementsInstancedANGLE(...args) {\n      return gl.drawElementsInstanced(...args);\n    },\n    vertexAttribDivisorANGLE(...args) {\n      return gl.vertexAttribDivisor(...args);\n    }\n  }) as const satisfies ANGLE_instanced_arrays;\n\n/**\n * Make browser return WebGL2 contexts even if WebGL1 contexts are requested\n * @param enforce\n * @returns\n */\nexport function enforceWebGL2(enforce: boolean = true): void {\n  const prototype = HTMLCanvasElement.prototype as any;\n  if (!enforce && prototype.originalGetContext) {\n    // Reset the original getContext function\n    prototype.getContext = prototype.originalGetContext;\n    prototype.originalGetContext = undefined;\n    return;\n  }\n\n  // Store the original getContext function\n  prototype.originalGetContext = prototype.getContext;\n\n  // Override the getContext function\n  prototype.getContext = function (contextId: string, options?: WebGLContextAttributes) {\n    // Attempt to force WebGL2 for all WebGL1 contexts\n    if (contextId === 'webgl' || contextId === 'experimental-webgl') {\n      const context = this.originalGetContext('webgl2', options) as WebGL2RenderingContext;\n      // Work around test mocking\n      if (context instanceof HTMLElement) {\n        polyfillWebGL1Extensions(context);\n      }\n      return context;\n    }\n    // For any other type, return the original context\n    return this.originalGetContext(contextId, options);\n  };\n}\n\n/** Install WebGL1-only extensions on WebGL2 contexts */\nexport function polyfillWebGL1Extensions(gl: WebGL2RenderingContext): void {\n  // Enable, to support float and half-float textures\n  gl.getExtension('EXT_color_buffer_float');\n\n  // WebGL1 extensions implemented using WebGL2 APIs\n  const boundExtensions = {\n    ...WEBGL1_STATIC_EXTENSIONS,\n    WEBGL_disjoint_timer_query: gl.getExtension('EXT_disjoint_timer_query_webgl2'),\n    WEBGL_draw_buffers: getWEBGL_draw_buffers(gl),\n    OES_vertex_array_object: getOES_vertex_array_object(gl),\n    ANGLE_instanced_arrays: getANGLE_instanced_arrays(gl)\n  };\n\n  // Override gl.getExtension\n  // eslint-disable-next-line @typescript-eslint/unbound-method\n  const originalGetExtension = gl.getExtension;\n  gl.getExtension = function (extensionName: string) {\n    const ext = originalGetExtension.call(gl, extensionName);\n    if (ext) {\n      return ext;\n    }\n\n    // Injected extensions\n    if (extensionName in boundExtensions) {\n      // @ts-ignore TODO string index\n      return boundExtensions[extensionName];\n    }\n\n    return null;\n  };\n\n  // Override gl.getSupportedExtensions\n  // eslint-disable-next-line @typescript-eslint/unbound-method\n  const originalGetSupportedExtensions = gl.getSupportedExtensions;\n  gl.getSupportedExtensions = function (): string[] | null {\n    const extensions = originalGetSupportedExtensions.apply(gl) || [];\n    return extensions?.concat(Object.keys(boundExtensions));\n  };\n}\n\n// Update unsized WebGL1 formats to sized WebGL2 formats\n// todo move to texture format file\n// export function getInternalFormat(gl: WebGL2RenderingContext, format: GL, type: GL): GL {\n//   // webgl2 texture formats\n//   // https://webgl2fundamentals.org/webgl/lessons/webgl-data-textures.html\n//   switch (format) {\n//     case GL.DEPTH_COMPONENT:\n//       return GL.DEPTH_COMPONENT24;\n//     case GL.DEPTH_STENCIL:\n//       return GL.DEPTH24_STENCIL8;\n//     case GL.RGBA:\n//       return type === GL.HALF_FLOAT ? GL.RGBA16F : GL.RGBA32F;\n//     case GL.RGB:\n//       return type === GL.HALF_FLOAT ? GL.RGB16F : GL.RGB32F;\n//     default:\n//       return format;\n//   }\n// }\n\n/*\n// texture type to update on the fly\nexport function getTextureType(gl: WebGL2RenderingContext, type: GL): GL {\n  if (type === HALF_FLOAT_OES) {\n    return GL.HALF_FLOAT;\n  }\n  return type;\n}\n\n  // And texImage2D to convert the internalFormat to webgl2.\n  const webgl2 = this;\n  const origTexImage = gl.texImage2D;\n  gl.texImage2D = function (target, miplevel, iformat, a, typeFor6, c, d, typeFor9, f) {\n    if (arguments.length == 6) {\n      var ifmt = webgl2.getInternalFormat(gl, iformat, typeFor6);\n      origTexImage.apply(gl, [target, miplevel, ifmt, a, webgl.getTextureType(gl, typeFor6), c]);\n    } else {\n      // arguments.length == 9\n      var ifmt = webgl2.getInternalFormat(gl, iformat, typeFor9);\n      origTexImage.apply(gl, [\n        target,\n        miplevel,\n        ifmt,\n        a,\n        typeFor6,\n        c,\n        d,\n        webgl2.getTextureType(gl, typeFor9),\n        f\n      ]);\n    }\n  };\n};\n*/\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/**\n * Load a script (identified by an url). When the url returns, the\n * content of this file is added into a new script element, attached to the DOM (body element)\n * @param scriptUrl defines the url of the script to laod\n * @param scriptId defines the id of the script element\n */\nexport async function loadScript(scriptUrl: string, scriptId?: string): Promise<Event> {\n  const head = document.getElementsByTagName('head')[0];\n  if (!head) {\n    throw new Error('loadScript');\n  }\n\n  const script = document.createElement('script');\n  script.setAttribute('type', 'text/javascript');\n  script.setAttribute('src', scriptUrl);\n  if (scriptId) {\n    script.id = scriptId;\n  }\n\n  return new Promise((resolve, reject) => {\n    script.onload = resolve;\n    script.onerror = error =>\n      reject(new Error(`Unable to load script '${scriptUrl}': ${error as string}`));\n    head.appendChild(script);\n  });\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {GLExtensions} from '@luma.gl/webgl/constants';\n\n/**\n * Stores luma.gl specific state associated with a context\n */\nexport interface WebGLContextData {\n  /** This type is used by lower level code that is not aware of the Device type */\n  device?: unknown;\n  _polyfilled: boolean;\n  extensions: GLExtensions;\n  softwareRenderer?: boolean;\n}\n\n/**\n * Gets luma.gl specific state from a context\n * @returns context state\n */\nexport function getWebGLContextData(gl: WebGL2RenderingContext): WebGLContextData {\n  // @ts-expect-error\n  const contextData = (gl.luma as WebGLContextData | null) || {\n    _polyfilled: false,\n    extensions: {},\n    softwareRenderer: false\n  };\n\n  contextData._polyfilled ??= false;\n  contextData.extensions ||= {};\n\n  // @ts-expect-error\n  gl.luma = contextData;\n\n  return contextData;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {log} from '@luma.gl/core';\nimport {loadScript} from '../../utils/load-script';\nimport {getWebGLContextData} from '../helpers/webgl-context-data';\n\nimport type {Spector} from './spector-types';\n\n/** Spector debug initialization options */\ntype SpectorProps = {\n  /** Whether spector.js is enabled */\n  debugSpectorJS?: boolean;\n  /** URL to load spector script from. Typically a CDN URL */\n  debugSpectorJSUrl?: string;\n  /** Canvas to monitor */\n  gl?: WebGL2RenderingContext;\n};\n\nconst LOG_LEVEL = 1;\n\nlet spector: Spector | null = null;\nlet initialized: boolean = false;\n\ndeclare global {\n  // @ts-ignore\n  // eslint-disable-next-line no-var\n  var SPECTOR: Spector;\n}\n\nexport const DEFAULT_SPECTOR_PROPS: Required<SpectorProps> = {\n  debugSpectorJS: log.get('debug-spectorjs'),\n  // https://github.com/BabylonJS/Spector.js#basic-usage\n  // https://forum.babylonjs.com/t/spectorcdn-is-temporarily-off/48241\n  // spectorUrl: 'https://spectorcdn.babylonjs.com/spector.bundle.js';\n  debugSpectorJSUrl: 'https://cdn.jsdelivr.net/npm/spectorjs@0.9.30/dist/spector.bundle.js',\n  gl: undefined!\n};\n\n/** Loads spector from CDN if not already installed */\nexport async function loadSpectorJS(props: {debugSpectorJSUrl?: string}): Promise<void> {\n  if (!globalThis.SPECTOR) {\n    try {\n      await loadScript(props.debugSpectorJSUrl || DEFAULT_SPECTOR_PROPS.debugSpectorJSUrl);\n    } catch (error) {\n      log.warn(String(error));\n    }\n  }\n}\n\nexport function initializeSpectorJS(props: SpectorProps): Spector | null {\n  props = {...DEFAULT_SPECTOR_PROPS, ...props};\n  if (!props.debugSpectorJS) {\n    return null;\n  }\n\n  if (!spector && globalThis.SPECTOR && !globalThis.luma?.spector) {\n    log.probe(LOG_LEVEL, 'SPECTOR found and initialized. Start with `luma.spector.displayUI()`')();\n    const {Spector: SpectorJS} = globalThis.SPECTOR as any;\n    spector = new SpectorJS();\n    if (globalThis.luma) {\n      (globalThis.luma as any).spector = spector;\n    }\n  }\n\n  if (!spector) {\n    return null;\n  }\n\n  if (!initialized) {\n    initialized = true;\n\n    // enables recording some extra information merged in the capture like texture memory sizes and formats\n    spector.spyCanvases();\n    // A callback when results are ready\n    spector?.onCaptureStarted.add((capture: unknown) =>\n      log.info('Spector capture started:', capture)()\n    );\n    spector?.onCapture.add((capture: unknown) => {\n      log.info('Spector capture complete:', capture)();\n      // Use undocumented Spector API to open the UI with our capture\n      // See https://github.com/BabylonJS/Spector.js/blob/767ad1195a25b85a85c381f400eb50a979239eca/src/spector.ts#L124\n      spector?.getResultUI();\n      // @ts-expect-error private\n      spector?.resultView.display();\n      // @ts-expect-error private\n      spector?.resultView.addCapture(capture);\n    });\n  }\n\n  if (props.gl) {\n    // capture startup\n    const gl = props.gl;\n    const contextData = getWebGLContextData(gl);\n    const device = contextData.device;\n    spector?.startCapture(props.gl, 500); // 500 commands\n    contextData.device = device;\n\n    new Promise(resolve => setTimeout(resolve, 2000)).then(_ => {\n      log.info('Spector capture stopped after 2 seconds')();\n      spector?.stopCapture();\n      // spector?.displayUI();\n    });\n  }\n\n  return spector;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {log} from '@luma.gl/core';\n// Rename constant to prevent inlining. We need the full set of constants for generating debug strings.\nimport {GL as GLEnum} from '@luma.gl/webgl/constants';\nimport {isBrowser} from '@probe.gl/env';\nimport {loadScript} from '../../utils/load-script';\n\nconst WEBGL_DEBUG_CDN_URL = 'https://unpkg.com/webgl-debug@2.0.1/index.js';\n\ntype DebugContextProps = {\n  debugWebGL?: boolean;\n  traceWebGL?: boolean;\n};\n\ntype ContextData = {\n  realContext?: WebGL2RenderingContext;\n  debugContext?: WebGL2RenderingContext;\n};\n\n// Helper to get shared context data\nfunction getWebGLContextData(gl: any): ContextData {\n  gl.luma = gl.luma || {};\n  return gl.luma;\n}\n\ndeclare global {\n  // eslint-disable-next-line no-var\n  var WebGLDebugUtils: any;\n}\n\n/**\n * Loads Khronos WebGLDeveloperTools from CDN if not already installed\n * const WebGLDebugUtils = require('webgl-debug');\n * @see https://github.com/KhronosGroup/WebGLDeveloperTools\n * @see https://github.com/vorg/webgl-debug\n */\nexport async function loadWebGLDeveloperTools(): Promise<void> {\n  if (isBrowser() && !globalThis.WebGLDebugUtils) {\n    globalThis.global = globalThis.global || globalThis;\n    // @ts-expect-error Developer tools expects global to be set\n    globalThis.global.module = {};\n    await loadScript(WEBGL_DEBUG_CDN_URL);\n  }\n}\n\n// Returns (a potentially new) context with debug instrumentation turned off or on.\n// Note that this actually returns a new context\nexport function makeDebugContext(\n  gl: WebGL2RenderingContext,\n  props: DebugContextProps = {}\n): WebGL2RenderingContext {\n  return props.debugWebGL || props.traceWebGL ? getDebugContext(gl, props) : getRealContext(gl);\n}\n\n// Returns the real context from either of the real/debug contexts\nfunction getRealContext(gl: WebGL2RenderingContext): WebGL2RenderingContext {\n  const data = getWebGLContextData(gl);\n  // If the context has a realContext member, it is a debug context so return the realContext\n  return data.realContext ? data.realContext : gl;\n}\n\n// Returns the debug context from either of the real/debug contexts\nfunction getDebugContext(\n  gl: WebGL2RenderingContext,\n  props: DebugContextProps\n): WebGL2RenderingContext {\n  if (!globalThis.WebGLDebugUtils) {\n    log.warn('webgl-debug not loaded')();\n    return gl;\n  }\n\n  const data = getWebGLContextData(gl);\n\n  // If this already has a debug context, return it.\n  if (data.debugContext) {\n    return data.debugContext;\n  }\n\n  // Create a new debug context\n  globalThis.WebGLDebugUtils.init({...GLEnum, ...gl});\n  const glDebug = globalThis.WebGLDebugUtils.makeDebugContext(\n    gl,\n    onGLError.bind(null, props),\n    onValidateGLFunc.bind(null, props)\n  );\n\n  // Make sure we have all WebGL2 and extension constants (todo dynamic import to circumvent minification?)\n  for (const key in GLEnum) {\n    if (!(key in glDebug) && typeof GLEnum[key] === 'number') {\n      glDebug[key] = GLEnum[key];\n    }\n  }\n\n  // Ensure we have a clean prototype on the instrumented object\n  // Note: setPrototypeOf does come with perf warnings, but we already take a bigger perf reduction\n  // by synchronizing the WebGL errors after each WebGL call.\n  class WebGLDebugContext {}\n  Object.setPrototypeOf(glDebug, Object.getPrototypeOf(gl));\n  Object.setPrototypeOf(WebGLDebugContext, glDebug);\n  const debugContext = Object.create(WebGLDebugContext);\n  // Store the debug context\n  data.realContext = gl;\n  data.debugContext = debugContext;\n  // Share the context metadata object with the debug context so lookups stay consistent.\n  (debugContext as {luma?: unknown}).luma = data;\n  debugContext.debug = true;\n\n  // Return it\n  return debugContext;\n}\n\n// DEBUG TRACING\n\nfunction getFunctionString(functionName: string, functionArgs: unknown[]): string {\n  // Cover bug in webgl-debug-tools\n  functionArgs = Array.from(functionArgs).map(arg => (arg === undefined ? 'undefined' : arg));\n  let args = globalThis.WebGLDebugUtils.glFunctionArgsToString(functionName, functionArgs);\n  args = `${args.slice(0, 100)}${args.length > 100 ? '...' : ''}`;\n  return `gl.${functionName}(${args})`;\n}\n\nfunction onGLError(\n  props: DebugContextProps,\n  err: number,\n  functionName: string,\n  args: unknown[]\n): void {\n  // Cover bug in webgl-debug-tools\n  args = Array.from(args).map(arg => (arg === undefined ? 'undefined' : arg));\n  const errorMessage = globalThis.WebGLDebugUtils.glEnumToString(err);\n  const functionArgs = globalThis.WebGLDebugUtils.glFunctionArgsToString(functionName, args);\n  const message = `${errorMessage} in gl.${functionName}(${functionArgs})`;\n  // TODO - call device.reportError\n  log.error(\n    '%cWebGL',\n    'color: white; background: red; padding: 2px 6px; border-radius: 3px;',\n    message\n  )();\n  // biome-ignore lint/suspicious/noDebugger: pause immediately on WebGL debug utility errors.\n  debugger;\n  throw new Error(message);\n}\n\n// Don't generate function string until it is needed\nfunction onValidateGLFunc(\n  props: DebugContextProps,\n  functionName: string,\n  functionArgs: unknown[]\n): void {\n  let functionString: string = '';\n  if (props.traceWebGL && log.level >= 1) {\n    functionString = getFunctionString(functionName, functionArgs);\n    log.info(\n      1,\n      '%cWebGL',\n      'color: white; background: blue; padding: 2px 6px; border-radius: 3px;',\n      functionString\n    )();\n  }\n\n  for (const arg of functionArgs) {\n    if (arg === undefined) {\n      functionString = functionString || getFunctionString(functionName, functionArgs);\n      // biome-ignore lint/suspicious/noDebugger: pause when validating undefined WebGL call arguments.\n      debugger;\n      // throw new Error(`Undefined argument: ${functionString}`);\n    }\n  }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// @ts-nocheck TODO fix\n\n// Tables describing WebGL parameters\nimport {GL, GLParameters} from '@luma.gl/webgl/constants';\n\n// DEFAULT SETTINGS - FOR FAST CACHE INITIALIZATION AND CONTEXT RESETS\n\n/* eslint-disable no-shadow */\n\nexport const GL_PARAMETER_DEFAULTS: GLParameters = {\n  [GL.BLEND]: false,\n  [GL.BLEND_COLOR]: new Float32Array([0, 0, 0, 0]),\n  [GL.BLEND_EQUATION_RGB]: GL.FUNC_ADD,\n  [GL.BLEND_EQUATION_ALPHA]: GL.FUNC_ADD,\n  [GL.BLEND_SRC_RGB]: GL.ONE,\n  [GL.BLEND_DST_RGB]: GL.ZERO,\n  [GL.BLEND_SRC_ALPHA]: GL.ONE,\n  [GL.BLEND_DST_ALPHA]: GL.ZERO,\n  [GL.COLOR_CLEAR_VALUE]: new Float32Array([0, 0, 0, 0]), // TBD\n  [GL.COLOR_WRITEMASK]: [true, true, true, true],\n  [GL.CULL_FACE]: false,\n  [GL.CULL_FACE_MODE]: GL.BACK,\n  [GL.DEPTH_TEST]: false,\n  [GL.DEPTH_CLEAR_VALUE]: 1,\n  [GL.DEPTH_FUNC]: GL.LESS,\n  [GL.DEPTH_RANGE]: new Float32Array([0, 1]), // TBD\n  [GL.DEPTH_WRITEMASK]: true,\n  [GL.DITHER]: true,\n  [GL.CURRENT_PROGRAM]: null,\n  // FRAMEBUFFER_BINDING and DRAW_FRAMEBUFFER_BINDING(WebGL2) refer same state.\n  [GL.FRAMEBUFFER_BINDING]: null,\n  [GL.RENDERBUFFER_BINDING]: null,\n  [GL.VERTEX_ARRAY_BINDING]: null,\n  [GL.ARRAY_BUFFER_BINDING]: null,\n  [GL.FRONT_FACE]: GL.CCW,\n  [GL.GENERATE_MIPMAP_HINT]: GL.DONT_CARE,\n  [GL.LINE_WIDTH]: 1,\n  [GL.POLYGON_OFFSET_FILL]: false,\n  [GL.POLYGON_OFFSET_FACTOR]: 0,\n  [GL.POLYGON_OFFSET_UNITS]: 0,\n  [GL.SAMPLE_ALPHA_TO_COVERAGE]: false,\n  [GL.SAMPLE_COVERAGE]: false,\n  [GL.SAMPLE_COVERAGE_VALUE]: 1.0,\n  [GL.SAMPLE_COVERAGE_INVERT]: false,\n  [GL.SCISSOR_TEST]: false,\n  // Note: Dynamic value. If scissor test enabled we expect users to set correct scissor box\n  [GL.SCISSOR_BOX]: new Int32Array([0, 0, 1024, 1024]),\n  [GL.STENCIL_TEST]: false,\n  [GL.STENCIL_CLEAR_VALUE]: 0,\n  [GL.STENCIL_WRITEMASK]: 0xffffffff,\n  [GL.STENCIL_BACK_WRITEMASK]: 0xffffffff,\n  [GL.STENCIL_FUNC]: GL.ALWAYS,\n  [GL.STENCIL_REF]: 0,\n  [GL.STENCIL_VALUE_MASK]: 0xffffffff,\n  [GL.STENCIL_BACK_FUNC]: GL.ALWAYS,\n  [GL.STENCIL_BACK_REF]: 0,\n  [GL.STENCIL_BACK_VALUE_MASK]: 0xffffffff,\n  [GL.STENCIL_FAIL]: GL.KEEP,\n  [GL.STENCIL_PASS_DEPTH_FAIL]: GL.KEEP,\n  [GL.STENCIL_PASS_DEPTH_PASS]: GL.KEEP,\n  [GL.STENCIL_BACK_FAIL]: GL.KEEP,\n  [GL.STENCIL_BACK_PASS_DEPTH_FAIL]: GL.KEEP,\n  [GL.STENCIL_BACK_PASS_DEPTH_PASS]: GL.KEEP,\n  // Dynamic value: We use [0, 0, 1024, 1024] as default, but usually this is updated in each frame.\n  [GL.VIEWPORT]: [0, 0, 1024, 1024],\n\n  [GL.TRANSFORM_FEEDBACK_BINDING]: null,\n  [GL.COPY_READ_BUFFER_BINDING]: null,\n  [GL.COPY_WRITE_BUFFER_BINDING]: null,\n  [GL.PIXEL_PACK_BUFFER_BINDING]: null,\n  [GL.PIXEL_UNPACK_BUFFER_BINDING]: null,\n  [GL.FRAGMENT_SHADER_DERIVATIVE_HINT]: GL.DONT_CARE,\n  [GL.READ_FRAMEBUFFER_BINDING]: null,\n  [GL.RASTERIZER_DISCARD]: false,\n\n  [GL.PACK_ALIGNMENT]: 4,\n  [GL.UNPACK_ALIGNMENT]: 4,\n  [GL.UNPACK_FLIP_Y_WEBGL]: false,\n  [GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL]: false,\n  [GL.UNPACK_COLORSPACE_CONVERSION_WEBGL]: GL.BROWSER_DEFAULT_WEBGL,\n  [GL.PACK_ROW_LENGTH]: 0,\n  [GL.PACK_SKIP_PIXELS]: 0,\n  [GL.PACK_SKIP_ROWS]: 0,\n  [GL.UNPACK_ROW_LENGTH]: 0,\n  [GL.UNPACK_IMAGE_HEIGHT]: 0,\n  [GL.UNPACK_SKIP_PIXELS]: 0,\n  [GL.UNPACK_SKIP_ROWS]: 0,\n  [GL.UNPACK_SKIP_IMAGES]: 0\n};\n\n// SETTER TABLES - ENABLES SETTING ANY PARAMETER WITH A COMMON API\n\nconst enable = (gl: WebGL2RenderingContext, value: unknown, key: GL) =>\n  value ? gl.enable(key) : gl.disable(key);\nconst hint = (gl: WebGL2RenderingContext, value: GL, key: GL) => gl.hint(key, value);\nconst pixelStorei = (gl: WebGL2RenderingContext, value: number | boolean, key: GL) =>\n  gl.pixelStorei(key, value);\n\nconst bindFramebuffer = (gl: WebGL2RenderingContext, value: unknown, key: GL) => {\n  const target = key === GL.FRAMEBUFFER_BINDING ? GL.DRAW_FRAMEBUFFER : GL.READ_FRAMEBUFFER;\n  return gl.bindFramebuffer(target, value as WebGLFramebuffer);\n};\n\nconst bindBuffer = (gl: WebGL2RenderingContext, value: unknown, key: GL) => {\n  const bindingMap: Partial<Record<GL, GL>> = {\n    [GL.ARRAY_BUFFER_BINDING]: GL.ARRAY_BUFFER,\n    [GL.COPY_READ_BUFFER_BINDING]: GL.COPY_READ_BUFFER,\n    [GL.COPY_WRITE_BUFFER_BINDING]: GL.COPY_WRITE_BUFFER,\n    [GL.PIXEL_PACK_BUFFER_BINDING]: GL.PIXEL_PACK_BUFFER,\n    [GL.PIXEL_UNPACK_BUFFER_BINDING]: GL.PIXEL_UNPACK_BUFFER\n  };\n  const glTarget = bindingMap[key];\n\n  gl.bindBuffer(glTarget as number, value as WebGLBuffer | null);\n};\n\n// Utility\nfunction isArray(array: unknown): boolean {\n  return Array.isArray(array) || (ArrayBuffer.isView(array) && !(array instanceof DataView));\n}\n\n// Map from WebGL parameter names to corresponding WebGL setter functions\n// WegGL constants are read by parameter names, but set by function names\n// NOTE: When value type is a string, it will be handled by 'GL_COMPOSITE_PARAMETER_SETTERS'\nexport const GL_PARAMETER_SETTERS = {\n  [GL.BLEND]: enable,\n  [GL.BLEND_COLOR]: (gl: WebGL2RenderingContext, value: [number, number, number, number]) =>\n    gl.blendColor(...value),\n  [GL.BLEND_EQUATION_RGB]: 'blendEquation',\n  [GL.BLEND_EQUATION_ALPHA]: 'blendEquation',\n  [GL.BLEND_SRC_RGB]: 'blendFunc',\n  [GL.BLEND_DST_RGB]: 'blendFunc',\n  [GL.BLEND_SRC_ALPHA]: 'blendFunc',\n  [GL.BLEND_DST_ALPHA]: 'blendFunc',\n  [GL.COLOR_CLEAR_VALUE]: (gl: WebGL2RenderingContext, value: [number, number, number, number]) =>\n    gl.clearColor(...value),\n  [GL.COLOR_WRITEMASK]: (gl: WebGL2RenderingContext, value: [boolean, boolean, boolean, boolean]) =>\n    gl.colorMask(...value),\n  [GL.CULL_FACE]: enable,\n  [GL.CULL_FACE_MODE]: (gl: WebGL2RenderingContext, value) => gl.cullFace(value),\n  [GL.DEPTH_TEST]: enable,\n  [GL.DEPTH_CLEAR_VALUE]: (gl: WebGL2RenderingContext, value) => gl.clearDepth(value),\n  [GL.DEPTH_FUNC]: (gl: WebGL2RenderingContext, value) => gl.depthFunc(value),\n  [GL.DEPTH_RANGE]: (gl: WebGL2RenderingContext, value: [number, number]) =>\n    gl.depthRange(...value),\n  [GL.DEPTH_WRITEMASK]: (gl: WebGL2RenderingContext, value) => gl.depthMask(value),\n  [GL.DITHER]: enable,\n  [GL.FRAGMENT_SHADER_DERIVATIVE_HINT]: hint,\n\n  [GL.CURRENT_PROGRAM]: (gl: WebGL2RenderingContext, value) => gl.useProgram(value),\n  [GL.RENDERBUFFER_BINDING]: (gl: WebGL2RenderingContext, value) =>\n    gl.bindRenderbuffer(GL.RENDERBUFFER, value),\n  [GL.TRANSFORM_FEEDBACK_BINDING]: (gl: WebGL2RenderingContext, value) =>\n    gl.bindTransformFeedback?.(GL.TRANSFORM_FEEDBACK, value),\n  [GL.VERTEX_ARRAY_BINDING]: (gl: WebGL2RenderingContext, value) => gl.bindVertexArray(value),\n  // NOTE: FRAMEBUFFER_BINDING and DRAW_FRAMEBUFFER_BINDING(WebGL2) refer same state.\n  [GL.FRAMEBUFFER_BINDING]: bindFramebuffer,\n  [GL.READ_FRAMEBUFFER_BINDING]: bindFramebuffer,\n\n  // Buffers\n  [GL.ARRAY_BUFFER_BINDING]: bindBuffer,\n  [GL.COPY_READ_BUFFER_BINDING]: bindBuffer,\n  [GL.COPY_WRITE_BUFFER_BINDING]: bindBuffer,\n  [GL.PIXEL_PACK_BUFFER_BINDING]: bindBuffer,\n  [GL.PIXEL_UNPACK_BUFFER_BINDING]: bindBuffer,\n\n  [GL.FRONT_FACE]: (gl: WebGL2RenderingContext, value) => gl.frontFace(value),\n  [GL.GENERATE_MIPMAP_HINT]: hint,\n  [GL.LINE_WIDTH]: (gl: WebGL2RenderingContext, value) => gl.lineWidth(value),\n  [GL.POLYGON_OFFSET_FILL]: enable,\n  [GL.POLYGON_OFFSET_FACTOR]: 'polygonOffset',\n  [GL.POLYGON_OFFSET_UNITS]: 'polygonOffset',\n  [GL.RASTERIZER_DISCARD]: enable,\n  [GL.SAMPLE_ALPHA_TO_COVERAGE]: enable,\n  [GL.SAMPLE_COVERAGE]: enable,\n  [GL.SAMPLE_COVERAGE_VALUE]: 'sampleCoverage',\n  [GL.SAMPLE_COVERAGE_INVERT]: 'sampleCoverage',\n  [GL.SCISSOR_TEST]: enable,\n  [GL.SCISSOR_BOX]: (gl: WebGL2RenderingContext, value: [number, number, number, number]) =>\n    gl.scissor(...value),\n  [GL.STENCIL_TEST]: enable,\n  [GL.STENCIL_CLEAR_VALUE]: (gl: WebGL2RenderingContext, value) => gl.clearStencil(value),\n  [GL.STENCIL_WRITEMASK]: (gl: WebGL2RenderingContext, value) =>\n    gl.stencilMaskSeparate(GL.FRONT, value),\n  [GL.STENCIL_BACK_WRITEMASK]: (gl: WebGL2RenderingContext, value) =>\n    gl.stencilMaskSeparate(GL.BACK, value),\n  [GL.STENCIL_FUNC]: 'stencilFuncFront',\n  [GL.STENCIL_REF]: 'stencilFuncFront',\n  [GL.STENCIL_VALUE_MASK]: 'stencilFuncFront',\n  [GL.STENCIL_BACK_FUNC]: 'stencilFuncBack',\n  [GL.STENCIL_BACK_REF]: 'stencilFuncBack',\n  [GL.STENCIL_BACK_VALUE_MASK]: 'stencilFuncBack',\n  [GL.STENCIL_FAIL]: 'stencilOpFront',\n  [GL.STENCIL_PASS_DEPTH_FAIL]: 'stencilOpFront',\n  [GL.STENCIL_PASS_DEPTH_PASS]: 'stencilOpFront',\n  [GL.STENCIL_BACK_FAIL]: 'stencilOpBack',\n  [GL.STENCIL_BACK_PASS_DEPTH_FAIL]: 'stencilOpBack',\n  [GL.STENCIL_BACK_PASS_DEPTH_PASS]: 'stencilOpBack',\n  [GL.VIEWPORT]: (gl: WebGL2RenderingContext, value: [number, number, number, number]) =>\n    gl.viewport(...value),\n\n  // WEBGL2 EXTENSIONS\n\n  // EXT_depth_clamp https://registry.khronos.org/webgl/extensions/EXT_depth_clamp/\n\n  [GL.DEPTH_CLAMP_EXT]: enable,\n\n  // WEBGL_provoking_vertex https://registry.khronos.org/webgl/extensions/WEBGL_provoking_vertex/\n\n  // [GL.PROVOKING_VERTEX_WEBL]: TODO - extension function needed\n\n  // WEBGL_polygon_mode https://registry.khronos.org/webgl/extensions/WEBGL_polygon_mode/\n\n  // POLYGON_MODE_WEBGL  TODO - extension function needed\n  [GL.POLYGON_OFFSET_LINE_WEBGL]: enable,\n\n  // WEBGL_clip_cull_distance https://registry.khronos.org/webgl/extensions/WEBGL_clip_cull_distance/\n\n  [GL.CLIP_DISTANCE0_WEBGL]: enable,\n  [GL.CLIP_DISTANCE1_WEBGL]: enable,\n  [GL.CLIP_DISTANCE2_WEBGL]: enable,\n  [GL.CLIP_DISTANCE3_WEBGL]: enable,\n  [GL.CLIP_DISTANCE4_WEBGL]: enable,\n  [GL.CLIP_DISTANCE5_WEBGL]: enable,\n  [GL.CLIP_DISTANCE6_WEBGL]: enable,\n  [GL.CLIP_DISTANCE7_WEBGL]: enable,\n\n  // PIXEL PACK/UNPACK MODES\n  [GL.PACK_ALIGNMENT]: pixelStorei,\n  [GL.UNPACK_ALIGNMENT]: pixelStorei,\n  [GL.UNPACK_FLIP_Y_WEBGL]: pixelStorei,\n  [GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL]: pixelStorei,\n  [GL.UNPACK_COLORSPACE_CONVERSION_WEBGL]: pixelStorei,\n  [GL.PACK_ROW_LENGTH]: pixelStorei,\n  [GL.PACK_SKIP_PIXELS]: pixelStorei,\n  [GL.PACK_SKIP_ROWS]: pixelStorei,\n  [GL.UNPACK_ROW_LENGTH]: pixelStorei,\n  [GL.UNPACK_IMAGE_HEIGHT]: pixelStorei,\n  [GL.UNPACK_SKIP_PIXELS]: pixelStorei,\n  [GL.UNPACK_SKIP_ROWS]: pixelStorei,\n  [GL.UNPACK_SKIP_IMAGES]: pixelStorei,\n\n  // Function-style setters\n  framebuffer: (gl: WebGL2RenderingContext, framebuffer) => {\n    // accepts 1) a WebGLFramebuffer 2) null (default framebuffer), or 3) luma.gl Framebuffer class\n    // framebuffer is null when restoring to default framebuffer, otherwise use the WebGL handle.\n    const handle = framebuffer && 'handle' in framebuffer ? framebuffer.handle : framebuffer;\n    return gl.bindFramebuffer(GL.FRAMEBUFFER, handle);\n  },\n  blend: (gl: WebGL2RenderingContext, value) =>\n    value ? gl.enable(GL.BLEND) : gl.disable(GL.BLEND),\n  blendColor: (gl: WebGL2RenderingContext, value: [number, number, number, number]) =>\n    gl.blendColor(...value),\n  blendEquation: (gl: WebGL2RenderingContext, args: number | [number, number]) => {\n    const separateModes = typeof args === 'number' ? ([args, args] as [number, number]) : args;\n    gl.blendEquationSeparate(...separateModes);\n  },\n  blendFunc: (\n    gl: WebGL2RenderingContext,\n    args: [number, number] | [number, number, number, number]\n  ) => {\n    const separateFuncs =\n      args?.length === 2 ? ([...args, ...args] as [number, number, number, number]) : args;\n    gl.blendFuncSeparate(...separateFuncs);\n  },\n\n  clearColor: (gl: WebGL2RenderingContext, value: [number, number, number, number]) =>\n    gl.clearColor(...value),\n  clearDepth: (gl: WebGL2RenderingContext, value) => gl.clearDepth(value),\n  clearStencil: (gl: WebGL2RenderingContext, value) => gl.clearStencil(value),\n\n  colorMask: (gl: WebGL2RenderingContext, value: [boolean, boolean, boolean, boolean]) =>\n    gl.colorMask(...value),\n\n  cull: (gl: WebGL2RenderingContext, value) =>\n    value ? gl.enable(GL.CULL_FACE) : gl.disable(GL.CULL_FACE),\n  cullFace: (gl: WebGL2RenderingContext, value) => gl.cullFace(value),\n\n  depthTest: (gl: WebGL2RenderingContext, value) =>\n    value ? gl.enable(GL.DEPTH_TEST) : gl.disable(GL.DEPTH_TEST),\n  depthFunc: (gl: WebGL2RenderingContext, value) => gl.depthFunc(value),\n  depthMask: (gl: WebGL2RenderingContext, value) => gl.depthMask(value),\n  depthRange: (gl: WebGL2RenderingContext, value: [number, number]) => gl.depthRange(...value),\n\n  dither: (gl: WebGL2RenderingContext, value) =>\n    value ? gl.enable(GL.DITHER) : gl.disable(GL.DITHER),\n\n  derivativeHint: (gl: WebGL2RenderingContext, value) => {\n    // gl1: 'OES_standard_derivatives'\n    gl.hint(GL.FRAGMENT_SHADER_DERIVATIVE_HINT, value);\n  },\n\n  frontFace: (gl: WebGL2RenderingContext, value) => gl.frontFace(value),\n\n  mipmapHint: (gl: WebGL2RenderingContext, value) => gl.hint(GL.GENERATE_MIPMAP_HINT, value),\n\n  lineWidth: (gl: WebGL2RenderingContext, value) => gl.lineWidth(value),\n\n  polygonOffsetFill: (gl: WebGL2RenderingContext, value) =>\n    value ? gl.enable(GL.POLYGON_OFFSET_FILL) : gl.disable(GL.POLYGON_OFFSET_FILL),\n  polygonOffset: (gl: WebGL2RenderingContext, value: [number, number]) =>\n    gl.polygonOffset(...value),\n\n  sampleCoverage: (gl: WebGL2RenderingContext, value: [number, boolean?]) =>\n    gl.sampleCoverage(value[0], value[1] || false),\n\n  scissorTest: (gl: WebGL2RenderingContext, value) =>\n    value ? gl.enable(GL.SCISSOR_TEST) : gl.disable(GL.SCISSOR_TEST),\n  scissor: (gl: WebGL2RenderingContext, value: [number, number, number, number]) =>\n    gl.scissor(...value),\n\n  stencilTest: (gl: WebGL2RenderingContext, value) =>\n    value ? gl.enable(GL.STENCIL_TEST) : gl.disable(GL.STENCIL_TEST),\n  stencilMask: (gl: WebGL2RenderingContext, value) => {\n    value = isArray(value) ? value : [value, value];\n    const [mask, backMask] = value;\n    gl.stencilMaskSeparate(GL.FRONT, mask);\n    gl.stencilMaskSeparate(GL.BACK, backMask);\n  },\n  stencilFunc: (gl: WebGL2RenderingContext, args) => {\n    args = isArray(args) && args.length === 3 ? [...args, ...args] : args;\n    const [func, ref, mask, backFunc, backRef, backMask] = args;\n    gl.stencilFuncSeparate(GL.FRONT, func, ref, mask);\n    gl.stencilFuncSeparate(GL.BACK, backFunc, backRef, backMask);\n  },\n  stencilOp: (gl: WebGL2RenderingContext, args) => {\n    args = isArray(args) && args.length === 3 ? [...args, ...args] : args;\n    const [sfail, dpfail, dppass, backSfail, backDpfail, backDppass] = args;\n    gl.stencilOpSeparate(GL.FRONT, sfail, dpfail, dppass);\n    gl.stencilOpSeparate(GL.BACK, backSfail, backDpfail, backDppass);\n  },\n\n  viewport: (gl: WebGL2RenderingContext, value: [number, number, number, number]) =>\n    gl.viewport(...value)\n};\n\nfunction getValue(glEnum, values, cache) {\n  return values[glEnum] !== undefined ? values[glEnum] : cache[glEnum];\n}\n\n// COMPOSITE_WEBGL_PARAMETER_\nexport const GL_COMPOSITE_PARAMETER_SETTERS = {\n  blendEquation: (gl: WebGL2RenderingContext, values, cache) =>\n    gl.blendEquationSeparate(\n      getValue(GL.BLEND_EQUATION_RGB, values, cache),\n      getValue(GL.BLEND_EQUATION_ALPHA, values, cache)\n    ),\n  blendFunc: (gl: WebGL2RenderingContext, values, cache) =>\n    gl.blendFuncSeparate(\n      getValue(GL.BLEND_SRC_RGB, values, cache),\n      getValue(GL.BLEND_DST_RGB, values, cache),\n      getValue(GL.BLEND_SRC_ALPHA, values, cache),\n      getValue(GL.BLEND_DST_ALPHA, values, cache)\n    ),\n  polygonOffset: (gl: WebGL2RenderingContext, values, cache) =>\n    gl.polygonOffset(\n      getValue(GL.POLYGON_OFFSET_FACTOR, values, cache),\n      getValue(GL.POLYGON_OFFSET_UNITS, values, cache)\n    ),\n  sampleCoverage: (gl: WebGL2RenderingContext, values, cache) =>\n    gl.sampleCoverage(\n      getValue(GL.SAMPLE_COVERAGE_VALUE, values, cache),\n      getValue(GL.SAMPLE_COVERAGE_INVERT, values, cache)\n    ),\n  stencilFuncFront: (gl: WebGL2RenderingContext, values, cache) =>\n    gl.stencilFuncSeparate(\n      GL.FRONT,\n      getValue(GL.STENCIL_FUNC, values, cache),\n      getValue(GL.STENCIL_REF, values, cache),\n      getValue(GL.STENCIL_VALUE_MASK, values, cache)\n    ),\n  stencilFuncBack: (gl: WebGL2RenderingContext, values, cache) =>\n    gl.stencilFuncSeparate(\n      GL.BACK,\n      getValue(GL.STENCIL_BACK_FUNC, values, cache),\n      getValue(GL.STENCIL_BACK_REF, values, cache),\n      getValue(GL.STENCIL_BACK_VALUE_MASK, values, cache)\n    ),\n  stencilOpFront: (gl: WebGL2RenderingContext, values, cache) =>\n    gl.stencilOpSeparate(\n      GL.FRONT,\n      getValue(GL.STENCIL_FAIL, values, cache),\n      getValue(GL.STENCIL_PASS_DEPTH_FAIL, values, cache),\n      getValue(GL.STENCIL_PASS_DEPTH_PASS, values, cache)\n    ),\n  stencilOpBack: (gl: WebGL2RenderingContext, values, cache) =>\n    gl.stencilOpSeparate(\n      GL.BACK,\n      getValue(GL.STENCIL_BACK_FAIL, values, cache),\n      getValue(GL.STENCIL_BACK_PASS_DEPTH_FAIL, values, cache),\n      getValue(GL.STENCIL_BACK_PASS_DEPTH_PASS, values, cache)\n    )\n};\n\ntype UpdateFunc = (params: Record<string, any>) => void;\n\n// Setter functions intercepted for cache updates\nexport const GL_HOOKED_SETTERS = {\n  // GENERIC SETTERS\n\n  enable: (update: UpdateFunc, capability: GL) =>\n    update({\n      [capability]: true\n    }),\n  disable: (update: UpdateFunc, capability: GL) =>\n    update({\n      [capability]: false\n    }),\n  pixelStorei: (update: UpdateFunc, pname: GL, value) =>\n    update({\n      [pname]: value\n    }),\n  hint: (update: UpdateFunc, pname: GL, value: GL) =>\n    update({\n      [pname]: value\n    }),\n\n  // SPECIFIC SETTERS\n  useProgram: (update: UpdateFunc, value) =>\n    update({\n      [GL.CURRENT_PROGRAM]: value\n    }),\n  bindRenderbuffer: (update: UpdateFunc, target, value) =>\n    update({\n      [GL.RENDERBUFFER_BINDING]: value\n    }),\n  bindTransformFeedback: (update: UpdateFunc, target, value) =>\n    update({\n      [GL.TRANSFORM_FEEDBACK_BINDING]: value\n    }),\n  bindVertexArray: (update: UpdateFunc, value) =>\n    update({\n      [GL.VERTEX_ARRAY_BINDING]: value\n    }),\n\n  bindFramebuffer: (update: UpdateFunc, target, framebuffer) => {\n    switch (target) {\n      case GL.FRAMEBUFFER:\n        return update({\n          [GL.DRAW_FRAMEBUFFER_BINDING]: framebuffer,\n          [GL.READ_FRAMEBUFFER_BINDING]: framebuffer\n        });\n      case GL.DRAW_FRAMEBUFFER:\n        return update({[GL.DRAW_FRAMEBUFFER_BINDING]: framebuffer});\n      case GL.READ_FRAMEBUFFER:\n        return update({[GL.READ_FRAMEBUFFER_BINDING]: framebuffer});\n      default:\n        return null;\n    }\n  },\n  bindBuffer: (update: UpdateFunc, target, buffer) => {\n    const pname = {\n      [GL.ARRAY_BUFFER]: [GL.ARRAY_BUFFER_BINDING],\n      [GL.COPY_READ_BUFFER]: [GL.COPY_READ_BUFFER_BINDING],\n      [GL.COPY_WRITE_BUFFER]: [GL.COPY_WRITE_BUFFER_BINDING],\n      [GL.PIXEL_PACK_BUFFER]: [GL.PIXEL_PACK_BUFFER_BINDING],\n      [GL.PIXEL_UNPACK_BUFFER]: [GL.PIXEL_UNPACK_BUFFER_BINDING]\n    }[target];\n\n    if (pname) {\n      return update({[pname]: buffer});\n    }\n    // targets that should not be cached\n    return {valueChanged: true};\n  },\n\n  blendColor: (update: UpdateFunc, r: number, g: number, b: number, a: number) =>\n    update({\n      [GL.BLEND_COLOR]: new Float32Array([r, g, b, a])\n    }),\n\n  blendEquation: (update: UpdateFunc, mode) =>\n    update({\n      [GL.BLEND_EQUATION_RGB]: mode,\n      [GL.BLEND_EQUATION_ALPHA]: mode\n    }),\n\n  blendEquationSeparate: (update: UpdateFunc, modeRGB, modeAlpha) =>\n    update({\n      [GL.BLEND_EQUATION_RGB]: modeRGB,\n      [GL.BLEND_EQUATION_ALPHA]: modeAlpha\n    }),\n\n  blendFunc: (update: UpdateFunc, src, dst) =>\n    update({\n      [GL.BLEND_SRC_RGB]: src,\n      [GL.BLEND_DST_RGB]: dst,\n      [GL.BLEND_SRC_ALPHA]: src,\n      [GL.BLEND_DST_ALPHA]: dst\n    }),\n\n  blendFuncSeparate: (update: UpdateFunc, srcRGB, dstRGB, srcAlpha, dstAlpha) =>\n    update({\n      [GL.BLEND_SRC_RGB]: srcRGB,\n      [GL.BLEND_DST_RGB]: dstRGB,\n      [GL.BLEND_SRC_ALPHA]: srcAlpha,\n      [GL.BLEND_DST_ALPHA]: dstAlpha\n    }),\n\n  clearColor: (update: UpdateFunc, r: number, g: number, b: number, a: number) =>\n    update({\n      [GL.COLOR_CLEAR_VALUE]: new Float32Array([r, g, b, a])\n    }),\n\n  clearDepth: (update: UpdateFunc, depth: number) =>\n    update({\n      [GL.DEPTH_CLEAR_VALUE]: depth\n    }),\n\n  clearStencil: (update: UpdateFunc, s: number) =>\n    update({\n      [GL.STENCIL_CLEAR_VALUE]: s\n    }),\n\n  colorMask: (update: UpdateFunc, r: number, g: number, b: number, a: number) =>\n    update({\n      [GL.COLOR_WRITEMASK]: [r, g, b, a]\n    }),\n\n  cullFace: (update: UpdateFunc, mode) =>\n    update({\n      [GL.CULL_FACE_MODE]: mode\n    }),\n\n  depthFunc: (update: UpdateFunc, func) =>\n    update({\n      [GL.DEPTH_FUNC]: func\n    }),\n\n  depthRange: (update: UpdateFunc, zNear: number, zFar: number) =>\n    update({\n      [GL.DEPTH_RANGE]: new Float32Array([zNear, zFar])\n    }),\n\n  depthMask: (update: UpdateFunc, mask: number) =>\n    update({\n      [GL.DEPTH_WRITEMASK]: mask\n    }),\n\n  frontFace: (update: UpdateFunc, face) =>\n    update({\n      [GL.FRONT_FACE]: face\n    }),\n\n  lineWidth: (update: UpdateFunc, width) =>\n    update({\n      [GL.LINE_WIDTH]: width\n    }),\n\n  polygonOffset: (update: UpdateFunc, factor, units) =>\n    update({\n      [GL.POLYGON_OFFSET_FACTOR]: factor,\n      [GL.POLYGON_OFFSET_UNITS]: units\n    }),\n\n  sampleCoverage: (update: UpdateFunc, value, invert) =>\n    update({\n      [GL.SAMPLE_COVERAGE_VALUE]: value,\n      [GL.SAMPLE_COVERAGE_INVERT]: invert\n    }),\n\n  scissor: (update: UpdateFunc, x, y, width, height) =>\n    update({\n      [GL.SCISSOR_BOX]: new Int32Array([x, y, width, height])\n    }),\n\n  stencilMask: (update: UpdateFunc, mask) =>\n    update({\n      [GL.STENCIL_WRITEMASK]: mask,\n      [GL.STENCIL_BACK_WRITEMASK]: mask\n    }),\n\n  stencilMaskSeparate: (update: UpdateFunc, face, mask) =>\n    update({\n      [face === GL.FRONT ? GL.STENCIL_WRITEMASK : GL.STENCIL_BACK_WRITEMASK]: mask\n    }),\n\n  stencilFunc: (update: UpdateFunc, func, ref, mask) =>\n    update({\n      [GL.STENCIL_FUNC]: func,\n      [GL.STENCIL_REF]: ref,\n      [GL.STENCIL_VALUE_MASK]: mask,\n      [GL.STENCIL_BACK_FUNC]: func,\n      [GL.STENCIL_BACK_REF]: ref,\n      [GL.STENCIL_BACK_VALUE_MASK]: mask\n    }),\n\n  stencilFuncSeparate: (update: UpdateFunc, face, func, ref, mask) =>\n    update({\n      [face === GL.FRONT ? GL.STENCIL_FUNC : GL.STENCIL_BACK_FUNC]: func,\n      [face === GL.FRONT ? GL.STENCIL_REF : GL.STENCIL_BACK_REF]: ref,\n      [face === GL.FRONT ? GL.STENCIL_VALUE_MASK : GL.STENCIL_BACK_VALUE_MASK]: mask\n    }),\n\n  stencilOp: (update: UpdateFunc, fail, zfail, zpass) =>\n    update({\n      [GL.STENCIL_FAIL]: fail,\n      [GL.STENCIL_PASS_DEPTH_FAIL]: zfail,\n      [GL.STENCIL_PASS_DEPTH_PASS]: zpass,\n      [GL.STENCIL_BACK_FAIL]: fail,\n      [GL.STENCIL_BACK_PASS_DEPTH_FAIL]: zfail,\n      [GL.STENCIL_BACK_PASS_DEPTH_PASS]: zpass\n    }),\n\n  stencilOpSeparate: (update: UpdateFunc, face, fail, zfail, zpass) =>\n    update({\n      [face === GL.FRONT ? GL.STENCIL_FAIL : GL.STENCIL_BACK_FAIL]: fail,\n      [face === GL.FRONT ? GL.STENCIL_PASS_DEPTH_FAIL : GL.STENCIL_BACK_PASS_DEPTH_FAIL]: zfail,\n      [face === GL.FRONT ? GL.STENCIL_PASS_DEPTH_PASS : GL.STENCIL_BACK_PASS_DEPTH_PASS]: zpass\n    }),\n\n  viewport: (update: UpdateFunc, x, y, width, height) =>\n    update({\n      [GL.VIEWPORT]: [x, y, width, height]\n    })\n};\n\n// GETTER TABLE - FOR READING OUT AN ENTIRE CONTEXT\n\nconst isEnabled = (gl: WebGL2RenderingContext, key) => gl.isEnabled(key);\n\n// Exceptions for any keys that cannot be queried by gl.getParameters\nexport const GL_PARAMETER_GETTERS = {\n  [GL.BLEND]: isEnabled,\n  [GL.CULL_FACE]: isEnabled,\n  [GL.DEPTH_TEST]: isEnabled,\n  [GL.DITHER]: isEnabled,\n  [GL.POLYGON_OFFSET_FILL]: isEnabled,\n  [GL.SAMPLE_ALPHA_TO_COVERAGE]: isEnabled,\n  [GL.SAMPLE_COVERAGE]: isEnabled,\n  [GL.SCISSOR_TEST]: isEnabled,\n  [GL.STENCIL_TEST]: isEnabled,\n  [GL.RASTERIZER_DISCARD]: isEnabled\n};\n\nexport const NON_CACHE_PARAMETERS = new Set([\n  // setter not intercepted\n  GL.ACTIVE_TEXTURE,\n  GL.TRANSFORM_FEEDBACK_ACTIVE,\n  GL.TRANSFORM_FEEDBACK_PAUSED,\n\n  // setters bindBufferRange/bindBufferBase cannot be pruned based on cache\n  GL.TRANSFORM_FEEDBACK_BUFFER_BINDING,\n  GL.UNIFORM_BUFFER_BINDING,\n\n  // states depending on VERTEX_ARRAY_BINDING\n  GL.ELEMENT_ARRAY_BUFFER_BINDING,\n  // states depending on READ_FRAMEBUFFER_BINDING\n  GL.IMPLEMENTATION_COLOR_READ_FORMAT,\n  GL.IMPLEMENTATION_COLOR_READ_TYPE,\n  // states depending on FRAMEBUFFER_BINDING\n  GL.READ_BUFFER,\n  GL.DRAW_BUFFER0,\n  GL.DRAW_BUFFER1,\n  GL.DRAW_BUFFER2,\n  GL.DRAW_BUFFER3,\n  GL.DRAW_BUFFER4,\n  GL.DRAW_BUFFER5,\n  GL.DRAW_BUFFER6,\n  GL.DRAW_BUFFER7,\n  GL.DRAW_BUFFER8,\n  GL.DRAW_BUFFER9,\n  GL.DRAW_BUFFER10,\n  GL.DRAW_BUFFER11,\n  GL.DRAW_BUFFER12,\n  GL.DRAW_BUFFER13,\n  GL.DRAW_BUFFER14,\n  GL.DRAW_BUFFER15,\n  // states depending on ACTIVE_TEXTURE\n  GL.SAMPLER_BINDING,\n  GL.TEXTURE_BINDING_2D,\n  GL.TEXTURE_BINDING_2D_ARRAY,\n  GL.TEXTURE_BINDING_3D,\n  GL.TEXTURE_BINDING_CUBE_MAP\n]);\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Provides a unified API for getting and setting any WebGL parameter\n// Also knows default values of all parameters, enabling fast cache initialization\n// Provides base functionality for the state caching.\nimport type {GLParameters} from '@luma.gl/webgl/constants';\nimport {\n  GL_PARAMETER_DEFAULTS,\n  GL_PARAMETER_SETTERS,\n  GL_COMPOSITE_PARAMETER_SETTERS,\n  GL_PARAMETER_GETTERS\n} from './webgl-parameter-tables';\n\nexport type {GLParameters};\n\n/**\n * Sets any GL parameter regardless of function (gl.blendMode, ...)\n *\n * @note requires a `cache` object to be set on the context (lumaState.cache)\n * This object is used to fill in any missing values for composite setter functions\n */\nexport function setGLParameters(gl: WebGL2RenderingContext, parameters: GLParameters): void {\n  if (isObjectEmpty(parameters)) {\n    return;\n  }\n\n  const compositeSetters = {};\n\n  // HANDLE PRIMITIVE SETTERS (and make note of any composite setters)\n\n  for (const key in parameters) {\n    const glConstant = Number(key);\n    // @ts-ignore TODO\n    const setter = GL_PARAMETER_SETTERS[key];\n    if (setter) {\n      // Composite setters should only be called once, so save them\n      if (typeof setter === 'string') {\n        // @ts-ignore TODO\n        compositeSetters[setter] = true;\n      } else {\n        // if (gl[glConstant] !== undefined) {\n        // TODO - added above check since this is being called on WebGL2 parameters in WebGL1...\n        // TODO - deep equal on values? only call setter if value has changed?\n        // NOTE - the setter will automatically update this.state\n        // @ts-ignore TODO\n        setter(gl, parameters[key], glConstant);\n      }\n    }\n  }\n\n  // HANDLE COMPOSITE SETTERS\n\n  // NOTE: any non-provided values needed by composite setters are filled in from state cache\n  // The cache parameter is automatically retrieved from the context\n  // This depends on `trackContextState`, which is technically a \"circular\" dependency.\n  // But it is too inconvenient to always require a cache parameter here.\n  // This is the ONLY external dependency in this module/\n  // @ts-expect-error\n  const cache = gl.lumaState?.cache;\n  if (cache) {\n    for (const key in compositeSetters) {\n      // TODO - avoid calling composite setters if values have not changed.\n      // @ts-ignore TODO\n      const compositeSetter = GL_COMPOSITE_PARAMETER_SETTERS[key];\n      // Note - if `trackContextState` has been called,\n      // the setter will automatically update this.state.cache\n      compositeSetter(gl, parameters, cache);\n    }\n  }\n\n  // Add a log for the else case?\n}\n\n/**\n * Reads the entire WebGL state from a context\n\n  // default to querying all parameters\n\n  * @returns - a newly created map, with values keyed by GL parameters\n *\n * @note Copies the state from a context (gl.getParameter should not be overriden)\n * Reads the entire WebGL state from a context\n *\n * @note This can generates a huge amount of synchronous driver roundtrips and should be\n * considered a very slow operation, to be used only if/when a context already manipulated\n * by external code needs to be synchronized for the first time\n */\nexport function getGLParameters(\n  gl: WebGL2RenderingContext,\n  parameters: keyof GLParameters | (keyof GLParameters)[] | GLParameters = GL_PARAMETER_DEFAULTS\n): GLParameters {\n  // support both arrays of parameters and objects (keys represent parameters)\n\n  if (typeof parameters === 'number') {\n    // single GL enum\n    const key = parameters;\n    // @ts-ignore TODO\n    const getter = GL_PARAMETER_GETTERS[key];\n    return getter ? getter(gl, key) : gl.getParameter(key);\n  }\n\n  const parameterKeys = Array.isArray(parameters) ? parameters : Object.keys(parameters);\n\n  const state: GLParameters = {};\n  for (const key of parameterKeys) {\n    // @ts-ignore TODO\n    const getter = GL_PARAMETER_GETTERS[key];\n    // @ts-ignore TODO\n    state[key] = getter ? getter(gl, Number(key)) : gl.getParameter(Number(key));\n  }\n  return state;\n}\n\n/**\n * Reset all parameters to a (almost) pure context state\n * @note viewport and scissor will be set to the values in GL_PARAMETER_DEFAULTS,\n * NOT the canvas size dimensions, so they will have to be properly set after\n * calling this function.\n */\nexport function resetGLParameters(gl: WebGL2RenderingContext): void {\n  setGLParameters(gl, GL_PARAMETER_DEFAULTS);\n}\n\n// Helpers\n\n// Returns true if given object is empty, false otherwise.\nfunction isObjectEmpty(object: Record<string, unknown>): boolean {\n  // @ts-ignore dummy key variable\n  for (const key in object) {\n    return false;\n  }\n  return true;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {TypedArray} from '@luma.gl/core';\n\n/** deeply compare two arrays */\nexport function deepArrayEqual(\n  x: unknown | unknown[] | TypedArray,\n  y: unknown | unknown[] | TypedArray\n): boolean {\n  if (x === y) {\n    return true;\n  }\n  if (isArray(x) && isArray(y) && x.length === y.length) {\n    for (let i = 0; i < x.length; ++i) {\n      if (x[i] !== y[i]) {\n        return false;\n      }\n    }\n    return true;\n  }\n  return false;\n}\n\nfunction isArray(x: unknown): x is unknown[] {\n  return Array.isArray(x) || ArrayBuffer.isView(x);\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// @ts-nocheck TODO - fix\n\nimport {setGLParameters, getGLParameters} from '../parameters/unified-parameter-api';\nimport {deepArrayEqual} from './deep-array-equal';\nimport {\n  GL_PARAMETER_DEFAULTS,\n  GL_HOOKED_SETTERS,\n  NON_CACHE_PARAMETERS\n} from '../parameters/webgl-parameter-tables';\n\n// HELPER CLASS - WebGLStateTracker\n\n/**\n * Support for listening to context state changes and intercepting state queries\n * NOTE: this system does not handle buffer bindings\n */\nexport class WebGLStateTracker {\n  static get(gl: WebGL2RenderingContext): WebGLStateTracker {\n    // @ts-expect-error\n    return gl.lumaState as WebGLStateTracker;\n  }\n\n  gl: WebGL2RenderingContext;\n  program: unknown = null;\n  stateStack: object[] = [];\n  enable = true;\n  cache: Record<string, any> = null!;\n  log;\n\n  protected initialized = false;\n\n  constructor(\n    gl: WebGL2RenderingContext,\n    props?: {\n      log; // Logging function, called when gl parameter change calls are actually issued\n    }\n  ) {\n    this.gl = gl;\n    this.log = props?.log || (() => {});\n\n    this._updateCache = this._updateCache.bind(this);\n    Object.seal(this);\n  }\n\n  push(values = {}) {\n    this.stateStack.push({});\n  }\n\n  pop() {\n    // assert(this.stateStack.length > 0);\n    // Use the saved values in the state stack to restore parameters\n    const oldValues = this.stateStack[this.stateStack.length - 1];\n    setGLParameters(this.gl, oldValues);\n    // Don't pop until we have reset parameters (to make sure other \"stack frames\" are not affected)\n    this.stateStack.pop();\n  }\n\n  /**\n   * Initialize WebGL state caching on a context\n   * can be called multiple times to enable/disable\n   *\n   * @note After calling this function, context state will be cached\n   * .push() and .pop() will be available for saving,\n   * temporarily modifying, and then restoring state.\n   */\n  trackState(gl: WebGL2RenderingContext, options?: {copyState?: boolean}): void {\n    this.cache = options?.copyState\n      ? getGLParameters(gl)\n      : Object.assign({}, GL_PARAMETER_DEFAULTS);\n\n    if (this.initialized) {\n      throw new Error('WebGLStateTracker');\n    }\n    this.initialized = true;\n\n    // @ts-expect-error\n    this.gl.lumaState = this;\n\n    installProgramSpy(gl);\n\n    // intercept all setter functions in the table\n    for (const key in GL_HOOKED_SETTERS) {\n      const setter = GL_HOOKED_SETTERS[key];\n      installSetterSpy(gl, key, setter);\n    }\n\n    // intercept all getter functions in the table\n    installGetterOverride(gl, 'getParameter');\n    installGetterOverride(gl, 'isEnabled');\n  }\n\n  /**\n  // interceptor for context set functions - update our cache and our stack\n  // values (Object) - the key values for this setter\n   * @param values\n   * @returns\n   */\n  _updateCache(values: {[key: number | string]: any}) {\n    let valueChanged = false;\n    let oldValue; // = undefined\n\n    const oldValues: {[key: number | string]: any} | null =\n      this.stateStack.length > 0 ? this.stateStack[this.stateStack.length - 1] : null;\n\n    for (const key in values) {\n      // assert(key !== undefined);\n      const value = values[key];\n      const cached = this.cache[key];\n      // Check that value hasn't already been shadowed\n      if (!deepArrayEqual(value, cached)) {\n        valueChanged = true;\n        oldValue = cached;\n\n        // First, save current value being shadowed\n        // If a state stack frame is active, save the current parameter values for pop\n        // but first check that value hasn't already been shadowed and saved\n        if (oldValues && !(key in oldValues)) {\n          oldValues[key] = cached;\n        }\n\n        // Save current value being shadowed\n        this.cache[key] = value;\n      }\n    }\n\n    return {valueChanged, oldValue};\n  }\n}\n\n// HELPER FUNCTIONS - INSTALL GET/SET INTERCEPTORS (SPYS) ON THE CONTEXT\n\n/**\n// Overrides a WebGL2RenderingContext state \"getter\" function\n// to return values directly from cache\n * @param gl\n * @param functionName\n */\nfunction installGetterOverride(gl: WebGL2RenderingContext, functionName: string) {\n  // Get the original function from the WebGL2RenderingContext\n  const originalGetterFunc = gl[functionName].bind(gl);\n\n  // Wrap it with a spy so that we can update our state cache when it gets called\n  gl[functionName] = function get(pname) {\n    if (pname === undefined || NON_CACHE_PARAMETERS.has(pname)) {\n      // Invalid or blacklisted parameter, do not cache\n      return originalGetterFunc(pname);\n    }\n\n    const glState = WebGLStateTracker.get(gl);\n    if (!(pname in glState.cache)) {\n      // WebGL limits are not prepopulated in the cache, call the original getter when first queried.\n      glState.cache[pname] = originalGetterFunc(pname);\n    }\n\n    // Optionally call the original function to do a \"hard\" query from the WebGL2RenderingContext\n    return glState.enable\n      ? // Call the getter the params so that it can e.g. serve from a cache\n        glState.cache[pname]\n      : // Optionally call the original function to do a \"hard\" query from the WebGL2RenderingContext\n        originalGetterFunc(pname);\n  };\n\n  // Set the name of this anonymous function to help in debugging and profiling\n  Object.defineProperty(gl[functionName], 'name', {\n    value: `${functionName}-from-cache`,\n    configurable: false\n  });\n}\n\n/**\n// Overrides a WebGL2RenderingContext state \"setter\" function\n// to call a setter spy before the actual setter. Allows us to keep a cache\n// updated with a copy of the WebGL context state.\n * @param gl\n * @param functionName\n * @param setter\n * @returns\n */\nfunction installSetterSpy(gl: WebGL2RenderingContext, functionName: string, setter: Function) {\n  // Get the original function from the WebGL2RenderingContext\n  if (!gl[functionName]) {\n    // TODO - remove?\n    // This could happen if we try to intercept WebGL2 method on a WebGL1 context\n    return;\n  }\n\n  const originalSetterFunc = gl[functionName].bind(gl);\n\n  // Wrap it with a spy so that we can update our state cache when it gets called\n  gl[functionName] = function set(...params) {\n    // Update the value\n    // Call the setter with the state cache and the params so that it can store the parameters\n    const glState = WebGLStateTracker.get(gl);\n    // eslint-disable-next-line @typescript-eslint/unbound-method\n    const {valueChanged, oldValue} = setter(glState._updateCache, ...params);\n\n    // Call the original WebGL2RenderingContext func to make sure the context actually gets updated\n    if (valueChanged) {\n      originalSetterFunc(...params);\n    }\n\n    // Note: if the original function fails to set the value, our state cache will be bad\n    // No solution for this at the moment, but assuming that this is unlikely to be a real problem\n    // We could call the setter after the originalSetterFunc. Concern is that this would\n    // cause different behavior in debug mode, where originalSetterFunc can throw exceptions\n\n    return oldValue;\n  };\n\n  // Set the name of this anonymous function to help in debugging and profiling\n  Object.defineProperty(gl[functionName], 'name', {\n    value: `${functionName}-to-cache`,\n    configurable: false\n  });\n}\n\nfunction installProgramSpy(gl: WebGL2RenderingContext): void {\n  const originalUseProgram = gl.useProgram.bind(gl);\n\n  gl.useProgram = function useProgramLuma(handle) {\n    const glState = WebGLStateTracker.get(gl);\n    if (glState.program !== handle) {\n      originalUseProgram(handle);\n      glState.program = handle;\n    }\n  };\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {getWebGLContextData} from './webgl-context-data';\n\n/**\n * ContextProps\n * @param onContextLost\n * @param onContextRestored *\n */\ntype ContextProps = {\n  /** Called when a context is lost */\n  onContextLost: (event: Event) => void;\n  /** Called when a context is restored */\n  onContextRestored: (event: Event) => void;\n};\n\n/**\n * Create a WebGL context for a canvas\n * Note calling this multiple time on the same canvas does return the same context\n * @param canvas A canvas element or offscreen canvas\n */\nexport function createBrowserContext(\n  canvas: HTMLCanvasElement | OffscreenCanvas,\n  props: ContextProps,\n  webglContextAttributes: WebGLContextAttributes\n): WebGL2RenderingContext {\n  // Try to extract any extra information about why context creation failed\n  let errorMessage = '';\n  const onCreateError = (event: Event) => {\n    const statusMessage = (event as WebGLContextEvent).statusMessage;\n    if (statusMessage) {\n      errorMessage ||= statusMessage;\n    }\n  };\n  canvas.addEventListener('webglcontextcreationerror', onCreateError, false);\n\n  const allowSoftwareRenderer = webglContextAttributes.failIfMajorPerformanceCaveat !== true;\n\n  const webglProps: WebGLContextAttributes = {\n    preserveDrawingBuffer: true,\n    ...webglContextAttributes,\n    // Always start by requesting a high-performance context.\n    failIfMajorPerformanceCaveat: true\n  };\n\n  // Create the desired context\n  let gl: WebGL2RenderingContext | null = null;\n\n  try {\n    // Create a webgl2 context\n    gl ||= canvas.getContext('webgl2', webglProps);\n    if (!gl && webglProps.failIfMajorPerformanceCaveat) {\n      errorMessage ||=\n        'Only software GPU is available. Set `failIfMajorPerformanceCaveat: false` to allow.';\n    }\n\n    // Creation failed with failIfMajorPerformanceCaveat - Try a Software GPU\n    let softwareRenderer = false;\n    if (!gl && allowSoftwareRenderer) {\n      webglProps.failIfMajorPerformanceCaveat = false;\n      gl = canvas.getContext('webgl2', webglProps);\n      softwareRenderer = true;\n    }\n\n    if (!gl) {\n      gl = canvas.getContext('webgl', {}) as WebGL2RenderingContext;\n      if (gl) {\n        gl = null;\n        errorMessage ||= 'Your browser only supports WebGL1';\n      }\n    }\n\n    if (!gl) {\n      errorMessage ||= 'Your browser does not support WebGL';\n      throw new Error(`Failed to create WebGL context: ${errorMessage}`);\n    }\n\n    // Initialize luma.gl specific context data\n    const luma = getWebGLContextData(gl);\n    luma.softwareRenderer = softwareRenderer;\n\n    // Carefully extract and wrap callbacks to prevent addEventListener from rebinding them.\n    const {onContextLost, onContextRestored} = props;\n    canvas.addEventListener('webglcontextlost', (event: Event) => onContextLost(event), false);\n    canvas.addEventListener(\n      'webglcontextrestored',\n      (event: Event) => onContextRestored(event),\n      false\n    );\n\n    return gl;\n  } finally {\n    canvas.removeEventListener('webglcontextcreationerror', onCreateError, false);\n  }\n}\n\n/* TODO - can we call this asynchronously to catch the error events?\nexport async function createBrowserContextAsync(canvas: HTMLCanvasElement | OffscreenCanvas, props: ContextProps): Promise<WebGL2RenderingContext> {\n  props = {...DEFAULT_CONTEXT_PROPS, ...props};\n\n // Try to extract any extra information about why context creation failed\n let errorMessage = null;\n const onCreateError = (error) => (errorMessage = error.statusMessage || errorMessage);\n canvas.addEventListener('webglcontextcreationerror', onCreateError, false);\n\n const gl = createBrowserContext(canvas, props);\n\n // Give the listener a chance to fire\n await new Promise(resolve => setTimeout(resolve, 0));\n\n canvas.removeEventListener('webglcontextcreationerror', onCreateError, false);\n\n return gl;\n}\n*/\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {GLExtensions} from '@luma.gl/webgl/constants';\n\n/** Ensure extensions are only requested once */\nexport function getWebGLExtension(\n  gl: WebGL2RenderingContext,\n  name: string,\n  extensions: GLExtensions\n): unknown {\n  // @ts-ignore TODO\n  if (extensions[name] === undefined) {\n    // @ts-ignore TODO\n    extensions[name] = gl.getExtension(name) || null;\n  }\n  // @ts-ignore TODO\n  return extensions[name];\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {DeviceInfo} from '@luma.gl/core';\nimport {GL, GLExtensions} from '@luma.gl/webgl/constants';\nimport {getWebGLExtension} from '../../context/helpers/webgl-extensions';\n\n/** @returns strings identifying the GPU vendor and driver. */\nexport function getDeviceInfo(gl: WebGL2RenderingContext, extensions: GLExtensions): DeviceInfo {\n  // \"Masked\" info is always available, but don't contain much useful information\n  const vendorMasked = gl.getParameter(GL.VENDOR);\n  const rendererMasked = gl.getParameter(GL.RENDERER);\n\n  // If we are lucky, unmasked info is available\n  // https://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/\n  getWebGLExtension(gl, 'WEBGL_debug_renderer_info', extensions);\n  const ext = extensions.WEBGL_debug_renderer_info;\n  const vendorUnmasked = gl.getParameter(ext ? ext.UNMASKED_VENDOR_WEBGL : GL.VENDOR);\n  const rendererUnmasked = gl.getParameter(ext ? ext.UNMASKED_RENDERER_WEBGL : GL.RENDERER);\n  const vendor = vendorUnmasked || vendorMasked;\n  const renderer = rendererUnmasked || rendererMasked;\n\n  // Driver version\n  const version = gl.getParameter(GL.VERSION) as string;\n\n  // \"Sniff\" the GPU type and backend from the info. This works best if unmasked info is available.\n  const gpu = identifyGPUVendor(vendor, renderer);\n  const gpuBackend = identifyGPUBackend(vendor, renderer);\n  const gpuType = identifyGPUType(vendor, renderer);\n\n  // Determine GLSL version\n  // For now, skip parsing of the long version string, just use context type below to deduce version\n  // const version = gl.getParameter(GL.SHADING_LANGUAGE_VERSION) as string;\n  // const shadingLanguageVersion = parseGLSLVersion(version);\n  const shadingLanguage = 'glsl';\n  const shadingLanguageVersion = 300;\n\n  return {\n    type: 'webgl',\n    gpu,\n    gpuType,\n    gpuBackend,\n    vendor,\n    renderer,\n    version,\n    shadingLanguage,\n    shadingLanguageVersion\n  };\n}\n\n/** \"Sniff\" the GPU type from the info. This works best if unmasked info is available. */\nfunction identifyGPUVendor(\n  vendor: string,\n  renderer: string\n): 'nvidia' | 'intel' | 'apple' | 'amd' | 'software' | 'unknown' {\n  if (/NVIDIA/i.exec(vendor) || /NVIDIA/i.exec(renderer)) {\n    return 'nvidia';\n  }\n  if (/INTEL/i.exec(vendor) || /INTEL/i.exec(renderer)) {\n    return 'intel';\n  }\n  if (/Apple/i.exec(vendor) || /Apple/i.exec(renderer)) {\n    return 'apple';\n  }\n  if (\n    /AMD/i.exec(vendor) ||\n    /AMD/i.exec(renderer) ||\n    /ATI/i.exec(vendor) ||\n    /ATI/i.exec(renderer)\n  ) {\n    return 'amd';\n  }\n  if (/SwiftShader/i.exec(vendor) || /SwiftShader/i.exec(renderer)) {\n    return 'software';\n  }\n\n  return 'unknown';\n}\n\n/** \"Sniff\" the GPU backend from the info. This works best if unmasked info is available. */\nfunction identifyGPUBackend(vendor: string, renderer: string): 'opengl' | 'metal' | 'unknown' {\n  if (/Metal/i.exec(vendor) || /Metal/i.exec(renderer)) {\n    return 'metal';\n  }\n  if (/ANGLE/i.exec(vendor) || /ANGLE/i.exec(renderer)) {\n    return 'opengl';\n  }\n  return 'unknown';\n}\n\nfunction identifyGPUType(\n  vendor: string,\n  renderer: string\n): 'discrete' | 'integrated' | 'cpu' | 'unknown' {\n  if (/SwiftShader/i.exec(vendor) || /SwiftShader/i.exec(renderer)) {\n    return 'cpu';\n  }\n\n  const gpuVendor = identifyGPUVendor(vendor, renderer);\n  switch (gpuVendor) {\n    case 'apple':\n      return isAppleSiliconGPU(vendor, renderer) ? 'integrated' : 'unknown';\n    case 'intel':\n      return 'integrated';\n    case 'software':\n      return 'cpu';\n    case 'unknown':\n      return 'unknown';\n    default:\n      return 'discrete';\n  }\n}\n\nfunction isAppleSiliconGPU(vendor: string, renderer: string): boolean {\n  return /Apple (M\\d|A\\d|GPU)/i.test(`${vendor} ${renderer}`);\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {GL} from '@luma.gl/webgl/constants';\nimport {VertexFormat, NormalizedDataType} from '@luma.gl/core';\n\ntype GLDataType =\n  | GL.UNSIGNED_BYTE\n  | GL.BYTE\n  | GL.UNSIGNED_SHORT\n  | GL.SHORT\n  | GL.UNSIGNED_INT\n  | GL.INT\n  | GL.HALF_FLOAT\n  | GL.FLOAT;\n\n/** Get vertex format from GL constants */\nexport function getVertexFormatFromGL(type: GLDataType, components: 1 | 2 | 3 | 4): VertexFormat {\n  const base = getVertexTypeFromGL(type);\n  // biome-ignore format: preserve layout\n  switch (components) {\n    case 1: return base;\n    case 2: return `${base}x2`;\n    // @ts-expect-error TODO deal with lack of \"unaligned\" formats\n    case 3: return `${base}x3`;\n    case 4: return `${base}x4`;\n  }\n  // @ts-ignore unreachable\n  throw new Error(String(components));\n}\n\n/** Get data type from GL constants */\nexport function getVertexTypeFromGL(type: GLDataType, normalized = false): NormalizedDataType {\n  // biome-ignore format: preserve layout\n  switch (type) {\n    // WebGPU does not support normalized 32 bit integer attributes\n    case GL.INT: return normalized ? 'sint32' : 'sint32';\n    case GL.UNSIGNED_INT: return normalized ? 'uint32' : 'uint32';\n    case GL.SHORT: return normalized ? 'sint16' : 'unorm16';\n    case GL.UNSIGNED_SHORT: return normalized ? 'uint16' : 'unorm16';\n    case GL.BYTE: return normalized ? 'sint8' : 'snorm16';\n    case GL.UNSIGNED_BYTE: return normalized ? 'uint8' : 'unorm8';\n    case GL.FLOAT: return 'float32';\n    case GL.HALF_FLOAT: return 'float16';\n  }\n  // @ts-ignore unreachable\n  throw new Error(String(type));\n}\n\nexport function getGLFromVertexType(\n  dataType: NormalizedDataType\n):\n  | GL.UNSIGNED_BYTE\n  | GL.BYTE\n  | GL.UNSIGNED_SHORT\n  | GL.SHORT\n  | GL.UNSIGNED_INT\n  | GL.INT\n  | GL.HALF_FLOAT\n  | GL.FLOAT {\n  // biome-ignore format: preserve layout\n  switch (dataType) {\n    case 'uint8': return GL.UNSIGNED_BYTE;\n    case 'sint8': return GL.BYTE;\n    case 'unorm8': return GL.UNSIGNED_BYTE;\n    case 'snorm8': return GL.BYTE;\n    case 'uint16': return GL.UNSIGNED_SHORT;\n    case 'sint16': return GL.SHORT;\n    case 'unorm16': return GL.UNSIGNED_SHORT;\n    case 'snorm16': return GL.SHORT;\n    case 'uint32': return GL.UNSIGNED_INT;\n    case 'sint32': return GL.INT;\n    // WebGPU does not support normalized 32 bit integer attributes\n    // case 'unorm32': return GL.UNSIGNED_INT;\n    // case 'snorm32': return GL.INT;\n    case 'float16': return GL.HALF_FLOAT;\n    case 'float32': return GL.FLOAT;\n  }\n  // @ts-ignore unreachable\n  throw new Error(String(dataType));\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {\n  DeviceFeature,\n  TextureFormat,\n  TextureFormatCapabilities,\n  DeviceTextureFormatCapabilities\n} from '@luma.gl/core';\nimport {textureFormatDecoder} from '@luma.gl/core';\nimport {GL, GLPixelType, GLExtensions, GLTexelDataFormat} from '@luma.gl/webgl/constants';\nimport {getWebGLExtension} from '../../context/helpers/webgl-extensions';\nimport {getGLFromVertexType} from './webgl-vertex-formats';\n\n/* eslint-disable camelcase */\n\n// TEXTURE FEATURES\n\n// Define local webgl extension strings to optimize minification\nconst X_S3TC = 'WEBGL_compressed_texture_s3tc'; // BC1, BC2, BC3\nconst X_S3TC_SRGB = 'WEBGL_compressed_texture_s3tc_srgb'; // BC1, BC2, BC3\nconst X_RGTC = 'EXT_texture_compression_rgtc'; // BC4, BC5\nconst X_BPTC = 'EXT_texture_compression_bptc'; // BC6, BC7\nconst X_ETC2 = 'WEBGL_compressed_texture_etc'; // Renamed from 'WEBGL_compressed_texture_es3'\nconst X_ASTC = 'WEBGL_compressed_texture_astc';\nconst X_ETC1 = 'WEBGL_compressed_texture_etc1';\nconst X_PVRTC = 'WEBGL_compressed_texture_pvrtc';\nconst X_ATC = 'WEBGL_compressed_texture_atc';\n\n// Define local webgl extension strings to optimize minification\nconst EXT_texture_norm16 = 'EXT_texture_norm16';\nconst EXT_render_snorm = 'EXT_render_snorm';\nconst EXT_color_buffer_float = 'EXT_color_buffer_float';\nconst SNORM8_COLOR_RENDERABLE: DeviceFeature = 'snorm8-renderable-webgl';\nconst NORM16_COLOR_RENDERABLE: DeviceFeature = 'norm16-renderable-webgl';\nconst SNORM16_COLOR_RENDERABLE: DeviceFeature = 'snorm16-renderable-webgl';\nconst FLOAT16_COLOR_RENDERABLE: DeviceFeature = 'float16-renderable-webgl';\nconst FLOAT32_COLOR_RENDERABLE: DeviceFeature = 'float32-renderable-webgl';\nconst RGB9E5UFLOAT_COLOR_RENDERABLE: DeviceFeature = 'rgb9e5ufloat-renderable-webgl';\n\ntype TextureFeatureDefinition = {\n  extensions?: string[];\n  features?: DeviceFeature[];\n};\n\n// biome-ignore format: preserve layout\nexport const TEXTURE_FEATURES: Partial<Record<DeviceFeature, TextureFeatureDefinition>> = {\n  'float32-renderable-webgl': {extensions: [EXT_color_buffer_float]},\n  'float16-renderable-webgl': {extensions: ['EXT_color_buffer_half_float']},\n  'rgb9e5ufloat-renderable-webgl': {extensions: ['WEBGL_render_shared_exponent']},\n  'snorm8-renderable-webgl': {extensions: [EXT_render_snorm]},\n  'norm16-webgl': {extensions: [EXT_texture_norm16]},\n  'norm16-renderable-webgl': {features: ['norm16-webgl']},\n  'snorm16-renderable-webgl': {features: ['norm16-webgl'], extensions: [EXT_render_snorm]},\n\n  'float32-filterable': {extensions: ['OES_texture_float_linear']},\n  'float16-filterable-webgl': {extensions: ['OES_texture_half_float_linear']},\n  'texture-filterable-anisotropic-webgl': {extensions: ['EXT_texture_filter_anisotropic']},\n\n  'texture-blend-float-webgl': {extensions: ['EXT_float_blend']},\n\n  'texture-compression-bc': {extensions: [X_S3TC, X_S3TC_SRGB, X_RGTC, X_BPTC]},\n  // 'texture-compression-bc3-srgb-webgl': [X_S3TC_SRGB],\n  // 'texture-compression-bc3-webgl': [X_S3TC],\n  'texture-compression-bc5-webgl': {extensions: [X_RGTC]},\n  'texture-compression-bc7-webgl': {extensions: [X_BPTC]},\n  'texture-compression-etc2': {extensions: [X_ETC2]},\n  'texture-compression-astc': {extensions: [X_ASTC]},\n  'texture-compression-etc1-webgl': {extensions: [X_ETC1]},\n  'texture-compression-pvrtc-webgl': {extensions: [X_PVRTC]},\n  'texture-compression-atc-webgl': {extensions: [X_ATC]}\n};\n\nexport function isTextureFeature(feature: DeviceFeature): boolean {\n  return feature in TEXTURE_FEATURES;\n}\n\n/** Checks a texture feature (for Device.features). Mainly compressed texture support */\nexport function checkTextureFeature(\n  gl: WebGL2RenderingContext,\n  feature: DeviceFeature,\n  extensions: GLExtensions\n): boolean {\n  return hasTextureFeature(gl, feature, extensions, new Set<DeviceFeature>());\n}\n\nfunction hasTextureFeature(\n  gl: WebGL2RenderingContext,\n  feature: DeviceFeature,\n  extensions: GLExtensions,\n  seenFeatures: Set<DeviceFeature>\n): boolean {\n  const definition = TEXTURE_FEATURES[feature];\n  if (!definition) {\n    return false;\n  }\n\n  if (seenFeatures.has(feature)) {\n    return false;\n  }\n\n  seenFeatures.add(feature);\n  const hasDependentFeatures = (definition.features || []).every(dependentFeature =>\n    hasTextureFeature(gl, dependentFeature, extensions, seenFeatures)\n  );\n  seenFeatures.delete(feature);\n  if (!hasDependentFeatures) {\n    return false;\n  }\n\n  return (definition.extensions || []).every(extension =>\n    Boolean(getWebGLExtension(gl, extension, extensions))\n  );\n}\n\n// TEXTURE FORMATS\n\n/** Map a format to webgl and constants */\ntype WebGLFormatInfo = {\n  gl?: GL;\n  /** compressed */\n  x?: string;\n  /** color-renderable capability gate. false means never color-renderable on WebGL. */\n  r?: DeviceFeature | false;\n  types?: GLPixelType[];\n  dataFormat?: GLTexelDataFormat;\n  /** if depthTexture is set this is a depth/stencil format that can be set to a texture  */\n  depthTexture?: boolean;\n  /** @deprecated can this format be used with renderbuffers */\n  rb?: boolean;\n};\n\n// TABLES\n\n/**\n * Texture format data -\n * Exported but can change without notice\n */\n// biome-ignore format: preserve layout\nexport const WEBGL_TEXTURE_FORMATS: Record<TextureFormat, WebGLFormatInfo> = {\n  // 8-bit formats\n  'r8unorm': {gl: GL.R8, rb: true},\n  'r8snorm': {gl: GL.R8_SNORM, r: SNORM8_COLOR_RENDERABLE},\n  'r8uint': {gl: GL.R8UI, rb: true},\n  'r8sint': {gl: GL.R8I, rb: true},\n\n  // 16-bit formats\n  'rg8unorm': {gl: GL.RG8, rb: true},\n  'rg8snorm': {gl: GL.RG8_SNORM, r: SNORM8_COLOR_RENDERABLE},\n  'rg8uint': {gl: GL.RG8UI, rb: true},\n  'rg8sint': {gl: GL.RG8I, rb: true},\n\n  'r16uint': {gl: GL.R16UI, rb: true},\n  'r16sint': {gl: GL.R16I, rb: true},\n  'r16float': {gl: GL.R16F, rb: true, r: FLOAT16_COLOR_RENDERABLE},\n  'r16unorm': {gl: GL.R16_EXT, rb: true, r: NORM16_COLOR_RENDERABLE},\n  'r16snorm': {gl: GL.R16_SNORM_EXT, r: SNORM16_COLOR_RENDERABLE},\n\n  // Packed 16-bit formats\n  'rgba4unorm-webgl': {gl: GL.RGBA4, rb: true},\n  'rgb565unorm-webgl': {gl: GL.RGB565, rb: true},\n  'rgb5a1unorm-webgl': {gl: GL.RGB5_A1, rb: true},\n\n  // 24-bit formats\n  'rgb8unorm-webgl': {gl: GL.RGB8},\n  'rgb8snorm-webgl': {gl: GL.RGB8_SNORM},\n\n  // 32-bit formats\n  'rgba8unorm': {gl: GL.RGBA8},\n  'rgba8unorm-srgb': {gl: GL.SRGB8_ALPHA8},\n  'rgba8snorm': {gl: GL.RGBA8_SNORM, r: SNORM8_COLOR_RENDERABLE},\n  'rgba8uint': {gl: GL.RGBA8UI},\n  'rgba8sint': {gl: GL.RGBA8I},\n  // reverse colors, webgpu only\n  'bgra8unorm': {},\n  'bgra8unorm-srgb': {},\n\n  'rg16uint': {gl: GL.RG16UI},\n  'rg16sint': {gl: GL.RG16I},\n  'rg16float': {gl: GL.RG16F, rb: true, r: FLOAT16_COLOR_RENDERABLE},\n  'rg16unorm': {gl: GL.RG16_EXT, r: NORM16_COLOR_RENDERABLE},\n  'rg16snorm': {gl: GL.RG16_SNORM_EXT, r: SNORM16_COLOR_RENDERABLE},\n\n  'r32uint': {gl: GL.R32UI, rb: true},\n  'r32sint': {gl: GL.R32I, rb: true},\n  'r32float': {gl: GL.R32F, r: FLOAT32_COLOR_RENDERABLE},\n\n  // Packed 32-bit formats\n  'rgb9e5ufloat': {gl: GL.RGB9_E5, r: RGB9E5UFLOAT_COLOR_RENDERABLE}, // , filter: true},\n  'rg11b10ufloat': {gl: GL.R11F_G11F_B10F, rb: true},\n  'rgb10a2unorm': {gl: GL.RGB10_A2, rb: true},\n  'rgb10a2uint': {gl: GL.RGB10_A2UI, rb: true},\n\n  // 48-bit formats\n  'rgb16unorm-webgl': {gl: GL.RGB16_EXT, r: false}, // rgb not renderable\n  'rgb16snorm-webgl': {gl: GL.RGB16_SNORM_EXT, r: false}, // rgb not renderable\n\n  // 64-bit formats\n  'rg32uint': {gl: GL.RG32UI, rb: true},\n  'rg32sint': {gl: GL.RG32I, rb: true},\n  'rg32float': {gl: GL.RG32F, rb: true, r: FLOAT32_COLOR_RENDERABLE},\n  'rgba16uint': {gl: GL.RGBA16UI, rb: true},\n  'rgba16sint': {gl: GL.RGBA16I, rb: true},\n  'rgba16float': {gl: GL.RGBA16F, r: FLOAT16_COLOR_RENDERABLE},\n  'rgba16unorm': {gl: GL.RGBA16_EXT, rb: true, r: NORM16_COLOR_RENDERABLE},\n  'rgba16snorm': {gl: GL.RGBA16_SNORM_EXT, r: SNORM16_COLOR_RENDERABLE},\n\n  // 96-bit formats (deprecated!)\n  'rgb32float-webgl': {gl: GL.RGB32F, x: EXT_color_buffer_float, r: FLOAT32_COLOR_RENDERABLE, dataFormat: GL.RGB, types: [GL.FLOAT]},\n\n  // 128-bit formats\n  'rgba32uint': {gl: GL.RGBA32UI, rb: true},\n  'rgba32sint': {gl: GL.RGBA32I, rb: true},\n  'rgba32float': {gl: GL.RGBA32F, rb: true, r: FLOAT32_COLOR_RENDERABLE},\n\n  // Depth and stencil formats\n  'stencil8': {gl: GL.STENCIL_INDEX8, rb: true}, // 8 stencil bits\n\n  'depth16unorm': {gl: GL.DEPTH_COMPONENT16, dataFormat: GL.DEPTH_COMPONENT, types: [GL.UNSIGNED_SHORT], rb: true}, // 16 depth bits\n  'depth24plus': {gl: GL.DEPTH_COMPONENT24, dataFormat: GL.DEPTH_COMPONENT, types: [GL.UNSIGNED_INT]},\n  'depth32float': {gl: GL.DEPTH_COMPONENT32F, dataFormat: GL.DEPTH_COMPONENT, types: [GL.FLOAT], rb: true},\n\n  // The depth component of the \"depth24plus\" and \"depth24plus-stencil8\" formats may be implemented as either a 24-bit depth value or a \"depth32float\" value.\n  'depth24plus-stencil8': {gl: GL.DEPTH24_STENCIL8, rb: true, depthTexture: true, dataFormat: GL.DEPTH_STENCIL, types: [GL.UNSIGNED_INT_24_8]},\n  // \"depth32float-stencil8\" feature - TODO below is render buffer only?\n  'depth32float-stencil8': {gl: GL.DEPTH32F_STENCIL8, dataFormat: GL.DEPTH_STENCIL, types: [GL.FLOAT_32_UNSIGNED_INT_24_8_REV], rb: true},\n\n  // BC compressed formats: check device.features.has(\"texture-compression-bc\");\n\n  'bc1-rgb-unorm-webgl': {gl: GL.COMPRESSED_RGB_S3TC_DXT1_EXT, x: X_S3TC},\n  'bc1-rgb-unorm-srgb-webgl': {gl: GL.COMPRESSED_SRGB_S3TC_DXT1_EXT, x: X_S3TC_SRGB},\n\n  'bc1-rgba-unorm': {gl: GL.COMPRESSED_RGBA_S3TC_DXT1_EXT, x: X_S3TC},\n  'bc1-rgba-unorm-srgb': {gl: GL.COMPRESSED_SRGB_S3TC_DXT1_EXT, x: X_S3TC_SRGB},\n  'bc2-rgba-unorm': {gl: GL.COMPRESSED_RGBA_S3TC_DXT3_EXT, x: X_S3TC},\n  'bc2-rgba-unorm-srgb': {gl: GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, x: X_S3TC_SRGB},\n  'bc3-rgba-unorm': {gl: GL.COMPRESSED_RGBA_S3TC_DXT5_EXT, x: X_S3TC},\n  'bc3-rgba-unorm-srgb': {gl: GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, x: X_S3TC_SRGB},\n  'bc4-r-unorm': {gl: GL.COMPRESSED_RED_RGTC1_EXT, x: X_RGTC},\n  'bc4-r-snorm': {gl: GL.COMPRESSED_SIGNED_RED_RGTC1_EXT, x: X_RGTC},\n  'bc5-rg-unorm': {gl: GL.COMPRESSED_RED_GREEN_RGTC2_EXT, x: X_RGTC},\n  'bc5-rg-snorm': {gl: GL.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, x: X_RGTC},\n  'bc6h-rgb-ufloat': {gl: GL.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, x: X_BPTC},\n  'bc6h-rgb-float': {gl: GL.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, x: X_BPTC},\n  'bc7-rgba-unorm': {gl: GL.COMPRESSED_RGBA_BPTC_UNORM_EXT, x: X_BPTC},\n  'bc7-rgba-unorm-srgb': {gl: GL.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, x: X_BPTC},\n\n  // WEBGL_compressed_texture_etc: device.features.has(\"texture-compression-etc2\")\n  // Note: Supposedly guaranteed availability compressed formats in WebGL2, but through CPU decompression\n\n  'etc2-rgb8unorm': {gl: GL.COMPRESSED_RGB8_ETC2},\n  'etc2-rgb8unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ETC2},\n  'etc2-rgb8a1unorm': {gl: GL.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2},\n  'etc2-rgb8a1unorm-srgb': {gl: GL.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2},\n  'etc2-rgba8unorm': {gl: GL.COMPRESSED_RGBA8_ETC2_EAC},\n  'etc2-rgba8unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC},\n\n  'eac-r11unorm': {gl: GL.COMPRESSED_R11_EAC},\n  'eac-r11snorm': {gl: GL.COMPRESSED_SIGNED_R11_EAC},\n  'eac-rg11unorm': {gl: GL.COMPRESSED_RG11_EAC},\n  'eac-rg11snorm': {gl: GL.COMPRESSED_SIGNED_RG11_EAC},\n\n  // X_ASTC compressed formats: device.features.has(\"texture-compression-astc\")\n\n  'astc-4x4-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_4x4_KHR},\n  'astc-4x4-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR},\n  'astc-5x4-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_5x4_KHR},\n  'astc-5x4-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR},\n  'astc-5x5-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_5x5_KHR},\n  'astc-5x5-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR},\n  'astc-6x5-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_6x5_KHR},\n  'astc-6x5-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR},\n  'astc-6x6-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_6x6_KHR},\n  'astc-6x6-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR},\n  'astc-8x5-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_8x5_KHR},\n  'astc-8x5-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR},\n  'astc-8x6-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_8x6_KHR},\n  'astc-8x6-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR},\n  'astc-8x8-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_8x8_KHR},\n  'astc-8x8-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR},\n  'astc-10x5-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_10x5_KHR},\n  'astc-10x5-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR},\n  'astc-10x6-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_10x6_KHR},\n  'astc-10x6-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR},\n  'astc-10x8-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_10x8_KHR},\n  'astc-10x8-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR},\n  'astc-10x10-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_10x10_KHR},\n  'astc-10x10-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR},\n  'astc-12x10-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_12x10_KHR},\n  'astc-12x10-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR},\n  'astc-12x12-unorm': {gl: GL.COMPRESSED_RGBA_ASTC_12x12_KHR},\n  'astc-12x12-unorm-srgb': {gl: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR},\n\n  // WEBGL_compressed_texture_pvrtc\n\n  'pvrtc-rgb4unorm-webgl': {gl: GL.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},\n  'pvrtc-rgba4unorm-webgl': {gl: GL.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},\n  'pvrtc-rgb2unorm-webgl': {gl: GL.COMPRESSED_RGB_PVRTC_2BPPV1_IMG},\n  'pvrtc-rgba2unorm-webgl': {gl: GL.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG},\n\n  // WEBGL_compressed_texture_etc1\n\n  'etc1-rbg-unorm-webgl': {gl: GL.COMPRESSED_RGB_ETC1_WEBGL},\n\n  // WEBGL_compressed_texture_atc\n\n  'atc-rgb-unorm-webgl': {gl: GL.COMPRESSED_RGB_ATC_WEBGL},\n  'atc-rgba-unorm-webgl': {gl: GL.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL},\n  'atc-rgbai-unorm-webgl': {gl: GL.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL}\n};\n\n// FUNCTIONS\n\n/** Checks if a texture format is supported, renderable, filterable etc */\nexport function getTextureFormatCapabilitiesWebGL(\n  gl: WebGL2RenderingContext,\n  formatSupport: TextureFormatCapabilities,\n  extensions: GLExtensions\n): DeviceTextureFormatCapabilities {\n  let supported = formatSupport.create;\n  const webglFormatInfo = WEBGL_TEXTURE_FORMATS[formatSupport.format];\n\n  // Support Check that we have a GL constant\n  if (webglFormatInfo?.gl === undefined) {\n    supported = false;\n  }\n\n  if (webglFormatInfo?.x) {\n    supported = supported && Boolean(getWebGLExtension(gl, webglFormatInfo.x, extensions));\n  }\n\n  // WebGL2 exposes STENCIL_INDEX8 for renderbuffers, but standalone stencil textures are not\n  // valid texture storage targets. Report them as unsupported texture formats to avoid invalid\n  // constructor paths and misleading capability checks.\n  if (formatSupport.format === 'stencil8') {\n    supported = false;\n  }\n\n  const renderFeatureSupported =\n    webglFormatInfo?.r === false\n      ? false\n      : webglFormatInfo?.r === undefined || checkTextureFeature(gl, webglFormatInfo.r, extensions);\n  const renderable =\n    supported &&\n    formatSupport.render &&\n    renderFeatureSupported &&\n    isColorRenderableTextureFormat(gl, formatSupport.format, extensions);\n\n  return {\n    format: formatSupport.format,\n    // @ts-ignore\n    create: supported && formatSupport.create,\n    // @ts-ignore\n    render: renderable,\n    // @ts-ignore\n    filter: supported && formatSupport.filter,\n    // @ts-ignore\n    blend: supported && formatSupport.blend,\n    // @ts-ignore\n    store: supported && formatSupport.store\n  };\n}\n\nfunction isColorRenderableTextureFormat(\n  gl: WebGL2RenderingContext,\n  format: TextureFormat,\n  extensions: GLExtensions\n): boolean {\n  const webglFormatInfo = WEBGL_TEXTURE_FORMATS[format];\n  const internalFormat = webglFormatInfo?.gl;\n  if (internalFormat === undefined) {\n    return false;\n  }\n\n  if (webglFormatInfo?.x && !getWebGLExtension(gl, webglFormatInfo.x, extensions)) {\n    return false;\n  }\n\n  const previousTexture = gl.getParameter(GL.TEXTURE_BINDING_2D) as WebGLTexture | null;\n  const previousFramebuffer = gl.getParameter(GL.FRAMEBUFFER_BINDING) as WebGLFramebuffer | null;\n  const texture = gl.createTexture();\n  const framebuffer = gl.createFramebuffer();\n  if (!texture || !framebuffer) {\n    return false;\n  }\n\n  // Isolate the probe from any prior driver errors so the result reflects only this format.\n  const noError = Number(GL.NO_ERROR);\n  let error = Number(gl.getError());\n  while (error !== noError) {\n    error = gl.getError();\n  }\n\n  let renderable = false;\n  try {\n    gl.bindTexture(GL.TEXTURE_2D, texture);\n    gl.texStorage2D(GL.TEXTURE_2D, 1, internalFormat, 1, 1);\n    if (Number(gl.getError()) !== noError) {\n      return false;\n    }\n\n    gl.bindFramebuffer(GL.FRAMEBUFFER, framebuffer);\n    gl.framebufferTexture2D(GL.FRAMEBUFFER, GL.COLOR_ATTACHMENT0, GL.TEXTURE_2D, texture, 0);\n    renderable =\n      Number(gl.checkFramebufferStatus(GL.FRAMEBUFFER)) === Number(GL.FRAMEBUFFER_COMPLETE) &&\n      Number(gl.getError()) === noError;\n  } finally {\n    gl.bindFramebuffer(GL.FRAMEBUFFER, previousFramebuffer);\n    gl.deleteFramebuffer(framebuffer);\n    gl.bindTexture(GL.TEXTURE_2D, previousTexture);\n    gl.deleteTexture(texture);\n  }\n\n  return renderable;\n}\n\n/** Get parameters necessary to work with format in WebGL: internalFormat, dataFormat, type, compressed, */\nexport function getTextureFormatWebGL(format: TextureFormat): {\n  internalFormat: GL;\n  format: GLTexelDataFormat;\n  type: GLPixelType;\n  compressed: boolean;\n} {\n  const formatData = WEBGL_TEXTURE_FORMATS[format];\n  const webglFormat = convertTextureFormatToGL(format);\n  const decoded = textureFormatDecoder.getInfo(format);\n\n  if (decoded.compressed) {\n    // TODO: Unclear whether this is always valid, this may be why ETC2 RGBA8 fails.\n    formatData.dataFormat = webglFormat as GLTexelDataFormat;\n  }\n\n  return {\n    internalFormat: webglFormat,\n    format:\n      formatData?.dataFormat ||\n      getWebGLPixelDataFormat(decoded.channels, decoded.integer, decoded.normalized, webglFormat),\n    // depth formats don't have a type\n    type: decoded.dataType\n      ? getGLFromVertexType(decoded.dataType)\n      : formatData?.types?.[0] || GL.UNSIGNED_BYTE,\n    compressed: decoded.compressed || false\n  };\n}\n\nexport function getDepthStencilAttachmentWebGL(\n  format: TextureFormat\n): GL.DEPTH_ATTACHMENT | GL.STENCIL_ATTACHMENT | GL.DEPTH_STENCIL_ATTACHMENT {\n  const formatInfo = textureFormatDecoder.getInfo(format);\n  switch (formatInfo.attachment) {\n    case 'depth':\n      return GL.DEPTH_ATTACHMENT;\n    case 'stencil':\n      return GL.STENCIL_ATTACHMENT;\n    case 'depth-stencil':\n      return GL.DEPTH_STENCIL_ATTACHMENT;\n    default:\n      throw new Error(`Not a depth stencil format: ${format}`);\n  }\n}\n\n/** TODO - VERY roundabout legacy way of calculating bytes per pixel */\nexport function getTextureFormatBytesPerPixel(format: TextureFormat): number {\n  const formatInfo = textureFormatDecoder.getInfo(format);\n  return formatInfo.bytesPerPixel;\n}\n\n// DATA TYPE HELPERS\n\nexport function getWebGLPixelDataFormat(\n  channels: 'r' | 'rg' | 'rgb' | 'rgba' | 'bgra',\n  integer: boolean,\n  normalized: boolean,\n  format: GL\n): GLTexelDataFormat {\n  // WebGL1 formats use same internalFormat\n  if (format === GL.RGBA || format === GL.RGB) {\n    return format;\n  }\n  // biome-ignore format: preserve layout\n  switch (channels) {\n    case 'r': return integer && !normalized ? GL.RED_INTEGER : GL.RED;\n    case 'rg': return integer && !normalized ? GL.RG_INTEGER : GL.RG;\n    case 'rgb': return integer && !normalized ? GL.RGB_INTEGER : GL.RGB;\n    case 'rgba': return integer && !normalized ? GL.RGBA_INTEGER : GL.RGBA;\n    case 'bgra': throw new Error('bgra pixels not supported by WebGL');\n    default: return GL.RGBA;\n  }\n}\n\n/**\n * Map WebGPU style texture format strings to GL constants\n */\nfunction convertTextureFormatToGL(format: TextureFormat): GL {\n  const formatInfo = WEBGL_TEXTURE_FORMATS[format];\n  const webglFormat = formatInfo?.gl;\n  if (webglFormat === undefined) {\n    throw new Error(`Unsupported texture format ${format}`);\n  }\n  return webglFormat;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Feature detection for WebGL\n// Provides a function that enables simple checking of which WebGL features are\n\nimport {DeviceFeature, DeviceFeatures} from '@luma.gl/core';\nimport {GLExtensions} from '@luma.gl/webgl/constants';\nimport {getWebGLExtension} from '../../context/helpers/webgl-extensions';\nimport {\n  isTextureFeature,\n  checkTextureFeature,\n  TEXTURE_FEATURES\n} from '../converters/webgl-texture-table';\n\n/**\n * Defines luma.gl \"feature\" names and semantics\n * when value is 'string' it is the name of the extension that enables this feature\n */\nconst WEBGL_FEATURES: Partial<Record<DeviceFeature, boolean | string>> = {\n  // optional WebGPU features\n  'depth-clip-control': 'EXT_depth_clamp', // TODO these seem subtly different\n  'timestamp-query': 'EXT_disjoint_timer_query_webgl2',\n  // \"indirect-first-instance\"\n  // Textures are handled by getTextureFeatures()\n  // 'depth32float-stencil8' // GPUTextureFormat 'depth32float-stencil8'\n\n  // optional WebGL features\n  'compilation-status-async-webgl': 'KHR_parallel_shader_compile',\n  'polygon-mode-webgl': 'WEBGL_polygon_mode',\n  'provoking-vertex-webgl': 'WEBGL_provoking_vertex',\n  'shader-clip-cull-distance-webgl': 'WEBGL_clip_cull_distance',\n  'shader-noperspective-interpolation-webgl': 'NV_shader_noperspective_interpolation',\n  'shader-conservative-depth-webgl': 'EXT_conservative_depth'\n\n  // Textures are handled by getTextureFeatures()\n};\n\n/**\n * WebGL extensions exposed as luma.gl features\n * To minimize GL log noise and improve performance, this class ensures that\n * - WebGL extensions are not queried until the corresponding feature is checked.\n * - WebGL extensions are only queried once.\n */\nexport class WebGLDeviceFeatures extends DeviceFeatures {\n  protected gl: WebGL2RenderingContext;\n  protected extensions: GLExtensions;\n  protected testedFeatures = new Set<DeviceFeature>();\n\n  constructor(\n    gl: WebGL2RenderingContext,\n    extensions: GLExtensions,\n    disabledFeatures: Partial<Record<DeviceFeature, boolean>>\n  ) {\n    super([], disabledFeatures);\n    this.gl = gl;\n    this.extensions = extensions;\n    // TODO - is this really needed?\n    // Enable EXT_float_blend first: https://developer.mozilla.org/en-US/docs/Web/API/EXT_float_blend\n    getWebGLExtension(gl, 'EXT_color_buffer_float', extensions);\n  }\n\n  override *[Symbol.iterator](): IterableIterator<DeviceFeature> {\n    const features = this.getFeatures();\n    for (const feature of features) {\n      if (this.has(feature)) {\n        yield feature;\n      }\n    }\n    return [];\n  }\n\n  override has(feature: DeviceFeature): boolean {\n    if (this.disabledFeatures?.[feature]) {\n      return false;\n    }\n\n    // We have already tested this feature\n    if (!this.testedFeatures.has(feature)) {\n      this.testedFeatures.add(feature);\n\n      // Check the feature once\n      if (isTextureFeature(feature) && checkTextureFeature(this.gl, feature, this.extensions)) {\n        this.features.add(feature);\n      }\n\n      if (this.getWebGLFeature(feature)) {\n        this.features.add(feature);\n      }\n    }\n    return this.features.has(feature);\n  }\n\n  // FOR DEVICE\n\n  initializeFeatures() {\n    // Initialize all features by checking them.\n    // Except WEBGL_polygon_mode since Chrome logs ugly console warnings\n    const features = this.getFeatures().filter(feature => feature !== 'polygon-mode-webgl');\n    for (const feature of features) {\n      this.has(feature);\n    }\n  }\n\n  // IMPLEMENTATION\n\n  getFeatures() {\n    return [...Object.keys(WEBGL_FEATURES), ...Object.keys(TEXTURE_FEATURES)] as DeviceFeature[];\n  }\n\n  /** Extract all WebGL features */\n  protected getWebGLFeature(feature: DeviceFeature): boolean {\n    const featureInfo = WEBGL_FEATURES[feature];\n    // string value requires checking the corresponding WebGL extension\n    const isSupported =\n      typeof featureInfo === 'string'\n        ? Boolean(getWebGLExtension(this.gl, featureInfo, this.extensions))\n        : Boolean(featureInfo);\n\n    return isSupported;\n  }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {DeviceLimits} from '@luma.gl/core';\nimport {GL} from '@luma.gl/webgl/constants';\n\n// biome-ignore format: preserve layout\nexport class WebGLDeviceLimits extends DeviceLimits {\n  get maxTextureDimension1D() { return 0; } // WebGL does not support 1D textures\n  get maxTextureDimension2D() { return this.getParameter(GL.MAX_TEXTURE_SIZE); }\n  get maxTextureDimension3D() { return this.getParameter(GL.MAX_3D_TEXTURE_SIZE); }\n  get maxTextureArrayLayers() { return this.getParameter(GL.MAX_ARRAY_TEXTURE_LAYERS); }\n  get maxBindGroups() { return 0; }\n  get maxDynamicUniformBuffersPerPipelineLayout() { return 0; } // TBD\n  get maxDynamicStorageBuffersPerPipelineLayout() { return 0; } // TBD\n  get maxSampledTexturesPerShaderStage() { return this.getParameter(GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS); } // ) TBD\n  get maxSamplersPerShaderStage() { return this.getParameter(GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS); }\n  get maxStorageBuffersPerShaderStage() { return 0; } // TBD\n  get maxStorageTexturesPerShaderStage() { return 0; } // TBD\n  get maxUniformBuffersPerShaderStage() { return this.getParameter(GL.MAX_UNIFORM_BUFFER_BINDINGS); }\n  get maxUniformBufferBindingSize() { return this.getParameter(GL.MAX_UNIFORM_BLOCK_SIZE); }\n  get maxStorageBufferBindingSize() { return 0; }\n  get minUniformBufferOffsetAlignment() { return this.getParameter(GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT); }\n  get minStorageBufferOffsetAlignment() { return 0; } \n  get maxVertexBuffers() { return 16; } // WebGL 2 supports 16 buffers, see https://github.com/gpuweb/gpuweb/issues/4284\n  get maxVertexAttributes() { return this.getParameter(GL.MAX_VERTEX_ATTRIBS); }\n  get maxVertexBufferArrayStride() { return 2048; } // TBD, this is just the default value from WebGPU\n  get maxInterStageShaderVariables() { return this.getParameter(GL.MAX_VARYING_COMPONENTS); }\n  get maxComputeWorkgroupStorageSize() { return 0; } // WebGL does not support compute shaders\n  get maxComputeInvocationsPerWorkgroup() { return 0; } // WebGL does not support compute shaders\n  get maxComputeWorkgroupSizeX() { return 0; } // WebGL does not support compute shaders\n  get maxComputeWorkgroupSizeY() { return 0; } // WebGL does not support compute shaders\n  get maxComputeWorkgroupSizeZ() { return 0; } // WebGL does not support compute shaders\n  get maxComputeWorkgroupsPerDimension() { return 0;} // WebGL does not support compute shaders\n\n  // PRIVATE\n\n  protected gl: WebGL2RenderingContext;\n  protected limits: Partial<Record<GL, number>> = {};\n\n  constructor(gl: WebGL2RenderingContext) {\n    super();\n    this.gl = gl;\n  }\n\n  protected getParameter(parameter: GL): number {\n    if (this.limits[parameter] === undefined) {\n      this.limits[parameter] = this.gl.getParameter(parameter);\n    }\n    return this.limits[parameter] || 0;\n  }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {FramebufferProps} from '@luma.gl/core';\nimport {Framebuffer} from '@luma.gl/core';\nimport {GL} from '@luma.gl/webgl/constants';\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLTexture} from './webgl-texture';\nimport {WEBGLTextureView} from './webgl-texture-view';\nimport {getDepthStencilAttachmentWebGL} from '../converters/webgl-texture-table';\n\nexport type Attachment = WEBGLTextureView | WEBGLTexture; // | WEBGLRenderbuffer;\n\n/** luma.gl Framebuffer, WebGL implementation  */\nexport class WEBGLFramebuffer extends Framebuffer {\n  readonly device: WebGLDevice;\n  gl: WebGL2RenderingContext;\n  readonly handle: WebGLFramebuffer;\n\n  colorAttachments: WEBGLTextureView[] = [];\n  depthStencilAttachment: WEBGLTextureView | null = null;\n\n  constructor(device: WebGLDevice, props: FramebufferProps) {\n    super(device, props);\n\n    // WebGL default framebuffer handle is null\n    const isDefaultFramebuffer = props.handle === null;\n\n    this.device = device;\n    this.gl = device.gl;\n    this.handle =\n      this.props.handle || isDefaultFramebuffer ? this.props.handle : this.gl.createFramebuffer();\n\n    if (!isDefaultFramebuffer) {\n      // default framebuffer handle is null, so we can't set debug metadata...\n      device._setWebGLDebugMetadata(this.handle, this, {spector: this.props});\n\n      // Auto create textures for attachments if needed\n      this.autoCreateAttachmentTextures();\n\n      this.updateAttachments();\n    }\n  }\n\n  /** destroys any auto created resources etc. */\n  override destroy(): void {\n    super.destroy(); // destroys owned resources etc.\n    if (!this.destroyed && this.handle !== null) {\n      this.gl.deleteFramebuffer(this.handle);\n      // this.handle = null;\n    }\n  }\n\n  protected updateAttachments(): void {\n    /** Attach from a map of attachments */\n    // @ts-expect-error native bindFramebuffer is overridden by our state tracker\n    const prevHandle: WebGLFramebuffer | null = this.gl.bindFramebuffer(\n      GL.FRAMEBUFFER,\n      this.handle\n    );\n\n    // Walk the attachments\n    for (let i = 0; i < this.colorAttachments.length; ++i) {\n      const attachment = this.colorAttachments[i];\n      if (attachment) {\n        const attachmentPoint = GL.COLOR_ATTACHMENT0 + i;\n        this._attachTextureView(attachmentPoint, attachment);\n      }\n    }\n\n    if (this.depthStencilAttachment) {\n      const attachmentPoint = getDepthStencilAttachmentWebGL(\n        this.depthStencilAttachment.props.format\n      );\n      this._attachTextureView(attachmentPoint, this.depthStencilAttachment);\n    }\n\n    /** Check the status */\n    if (this.device.props.debug) {\n      const status = this.gl.checkFramebufferStatus(GL.FRAMEBUFFER) as GL;\n      if (status !== GL.FRAMEBUFFER_COMPLETE) {\n        throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);\n      }\n    }\n\n    this.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle);\n  }\n\n  // PRIVATE\n\n  /** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */\n  // protected override createDepthStencilTexture(format: TextureFormat): Texture {\n  //   // return new WEBGLRenderbuffer(this.device, {\n  //   return new WEBGLTexture(this.device, {\n  //     id: `${this.id}-depth-stencil`,\n  //     format,\n  //     width: this.width,\n  //     height: this.height,\n  //     mipmaps: false\n  //   });\n  // }\n\n  /**\n   * @param attachment\n   * @param texture\n   * @param layer = 0 - index into WEBGLTextureArray and Texture3D or face for `TextureCubeMap`\n   * @param level = 0 - mipmapLevel\n   */\n  protected _attachTextureView(attachment: GL, textureView: WEBGLTextureView): void {\n    const {gl} = this.device;\n    const {texture} = textureView;\n    const level = textureView.props.baseMipLevel;\n    const layer = textureView.props.baseArrayLayer;\n\n    gl.bindTexture(texture.glTarget, texture.handle);\n\n    switch (texture.glTarget) {\n      case GL.TEXTURE_2D_ARRAY:\n      case GL.TEXTURE_3D:\n        gl.framebufferTextureLayer(GL.FRAMEBUFFER, attachment, texture.handle, level, layer);\n        break;\n\n      case GL.TEXTURE_CUBE_MAP:\n        // layer must be a cubemap face (or if index, converted to cube map face)\n        const face = mapIndexToCubeMapFace(layer);\n        gl.framebufferTexture2D(GL.FRAMEBUFFER, attachment, face, texture.handle, level);\n        break;\n\n      case GL.TEXTURE_2D:\n        gl.framebufferTexture2D(GL.FRAMEBUFFER, attachment, GL.TEXTURE_2D, texture.handle, level);\n        break;\n\n      default:\n        throw new Error('Illegal texture type');\n    }\n\n    gl.bindTexture(texture.glTarget, null);\n  }\n\n  /** Default framebuffer resize is managed by canvas size and should be a no-op. */\n  protected override resizeAttachments(width: number, height: number): void {\n    if (this.handle === null) {\n      this.width = width;\n      this.height = height;\n      return;\n    }\n\n    super.resizeAttachments(width, height);\n  }\n}\n\n// Helper functions\n\n// Map an index to a cube map face constant\nfunction mapIndexToCubeMapFace(layer: number | GL): GL {\n  // TEXTURE_CUBE_MAP_POSITIVE_X is a big value (0x8515)\n  // if smaller assume layer is index, otherwise assume it is already a cube map face constant\n  return layer < (GL.TEXTURE_CUBE_MAP_POSITIVE_X as number)\n    ? layer + GL.TEXTURE_CUBE_MAP_POSITIVE_X\n    : layer;\n}\n\n// Helper METHODS\n// Get a string describing the framebuffer error if installed\nfunction _getFrameBufferStatus(status: GL) {\n  switch (status) {\n    case GL.FRAMEBUFFER_COMPLETE:\n      return 'success';\n    case GL.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:\n      return 'Mismatched attachments';\n    case GL.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:\n      return 'No attachments';\n    case GL.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:\n      return 'Height/width mismatch';\n    case GL.FRAMEBUFFER_UNSUPPORTED:\n      return 'Unsupported or split attachments';\n    // WebGL2\n    case GL.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:\n      return 'Samples mismatch';\n    // OVR_multiview2 extension\n    // case GL.FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR: return 'baseViewIndex mismatch';\n    default:\n      return `${status}`;\n  }\n}\n\n/**\n * Attachment resize is expected to be a noop if size is same\n *\nprotected override resizeAttachments(width: number, height: number): this {\n  // for default framebuffer, just update the stored size\n  if (this.handle === null) {\n    // assert(width === undefined && height === undefined);\n    this.width = this.gl.drawingBufferWidth;\n    this.height = this.gl.drawingBufferHeight;\n    return this;\n  }\n\n  if (width === undefined) {\n    width = this.gl.drawingBufferWidth;\n  }\n  if (height === undefined) {\n    height = this.gl.drawingBufferHeight;\n  }\n\n  // TODO Not clear that this is better than default destroy/create implementation\n\n  for (const colorAttachment of this.colorAttachments) {\n    colorAttachment.texture.clone({width, height});\n  }\n  if (this.depthStencilAttachment) {\n    this.depthStencilAttachment.texture.resize({width, height});\n  }\n  return this;\n}\n*/\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {CanvasContextProps} from '@luma.gl/core';\nimport {CanvasContext} from '@luma.gl/core';\nimport {WebGLDevice} from './webgl-device';\nimport {WEBGLFramebuffer} from './resources/webgl-framebuffer';\n\n/**\n * A WebGL Canvas Context which manages the canvas and handles drawing buffer resizing etc\n */\nexport class WebGLCanvasContext extends CanvasContext {\n  readonly device: WebGLDevice;\n  readonly handle: unknown = null;\n\n  private _framebuffer: WEBGLFramebuffer | null = null;\n\n  get [Symbol.toStringTag](): string {\n    return 'WebGLCanvasContext';\n  }\n\n  constructor(device: WebGLDevice, props: CanvasContextProps) {\n    // Note: Base class creates / looks up the canvas (unless under Node.js)\n    super(props);\n    this.device = device;\n\n    // Base class constructor cannot access derived methods/fields, so we need to call these functions in the subclass constructor\n    this._setAutoCreatedCanvasId(`${this.device.id}-canvas`);\n    this._configureDevice();\n  }\n\n  // IMPLEMENTATION OF ABSTRACT METHODS\n\n  _configureDevice(): void {\n    const shouldResize =\n      this.drawingBufferWidth !== this._framebuffer?.width ||\n      this.drawingBufferHeight !== this._framebuffer?.height;\n    if (shouldResize) {\n      this._framebuffer?.resize([this.drawingBufferWidth, this.drawingBufferHeight]);\n    }\n  }\n\n  _getCurrentFramebuffer(): WEBGLFramebuffer {\n    this._framebuffer ||= new WEBGLFramebuffer(this.device, {\n      id: 'canvas-context-framebuffer',\n      handle: null, // Setting handle to null returns a reference to the default WebGL framebuffer\n      width: this.drawingBufferWidth,\n      height: this.drawingBufferHeight\n    });\n    return this._framebuffer;\n  }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {PresentationContextProps, TextureFormatDepthStencil, Framebuffer} from '@luma.gl/core';\nimport {PresentationContext} from '@luma.gl/core';\nimport type {WebGLDevice} from './webgl-device';\n\ntype PresentationCanvasRenderingContext2D =\n  | CanvasRenderingContext2D\n  | OffscreenCanvasRenderingContext2D;\n\n/**\n * Tracks a non-WebGL destination canvas while rendering into the device's default canvas context.\n */\nexport class WebGLPresentationContext extends PresentationContext {\n  readonly device: WebGLDevice;\n  readonly handle = null;\n  readonly context2d: PresentationCanvasRenderingContext2D;\n\n  get [Symbol.toStringTag](): string {\n    return 'WebGLPresentationContext';\n  }\n\n  constructor(device: WebGLDevice, props: PresentationContextProps = {}) {\n    super(props);\n    this.device = device;\n    const contextLabel = `${this[Symbol.toStringTag]}(${this.id})`;\n\n    const defaultCanvasContext = this.device.getDefaultCanvasContext();\n    if (!defaultCanvasContext.offscreenCanvas) {\n      throw new Error(\n        `${contextLabel}: WebGL PresentationContext requires the default CanvasContext canvas to be an OffscreenCanvas`\n      );\n    }\n\n    const context2d = this.canvas.getContext('2d');\n    if (!context2d) {\n      throw new Error(`${contextLabel}: Failed to create 2d presentation context`);\n    }\n    this.context2d = context2d;\n\n    this._setAutoCreatedCanvasId(`${this.device.id}-presentation-canvas`);\n    this._configureDevice();\n    this._startObservers();\n  }\n\n  present(): void {\n    this._resizeDrawingBufferIfNeeded();\n    this.device.submit();\n\n    const defaultCanvasContext = this.device.getDefaultCanvasContext();\n    const [sourceWidth, sourceHeight] = defaultCanvasContext.getDrawingBufferSize();\n\n    // Responsive layouts can transiently collapse presentation canvases to 0x0 during reflow.\n    // In that case WebGL has nothing meaningful to present, and drawImage() would throw when the\n    // offscreen source canvas has zero width or height.\n    if (\n      this.drawingBufferWidth === 0 ||\n      this.drawingBufferHeight === 0 ||\n      sourceWidth === 0 ||\n      sourceHeight === 0 ||\n      defaultCanvasContext.canvas.width === 0 ||\n      defaultCanvasContext.canvas.height === 0\n    ) {\n      return;\n    }\n\n    if (\n      sourceWidth !== this.drawingBufferWidth ||\n      sourceHeight !== this.drawingBufferHeight ||\n      defaultCanvasContext.canvas.width !== this.drawingBufferWidth ||\n      defaultCanvasContext.canvas.height !== this.drawingBufferHeight\n    ) {\n      throw new Error(\n        `${this[Symbol.toStringTag]}(${this.id}): Default canvas context size ${sourceWidth}x${sourceHeight} does not match presentation size ${this.drawingBufferWidth}x${this.drawingBufferHeight}`\n      );\n    }\n\n    this.context2d.clearRect(0, 0, this.drawingBufferWidth, this.drawingBufferHeight);\n    this.context2d.drawImage(defaultCanvasContext.canvas, 0, 0);\n  }\n\n  protected override _configureDevice(): void {}\n\n  protected override _getCurrentFramebuffer(options?: {\n    depthStencilFormat?: TextureFormatDepthStencil | false;\n  }): Framebuffer {\n    const defaultCanvasContext = this.device.getDefaultCanvasContext();\n    defaultCanvasContext.setDrawingBufferSize(this.drawingBufferWidth, this.drawingBufferHeight);\n    return defaultCanvasContext.getCurrentFramebuffer(options);\n  }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nconst uidCounters: Record<string, number> = {};\n\n/**\n * Returns a UID.\n * @param id= - Identifier base name\n * @return uid\n **/\nexport function uid(id: string = 'id'): string {\n  uidCounters[id] = uidCounters[id] || 1;\n  const count = uidCounters[id]++;\n  return `${id}-${count}`;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {BufferMapCallback, BufferProps} from '@luma.gl/core';\nimport {Buffer} from '@luma.gl/core';\nimport {GL} from '@luma.gl/webgl/constants';\nimport {WebGLDevice} from '../webgl-device';\n\n/** WebGL Buffer interface */\nexport class WEBGLBuffer extends Buffer {\n  readonly device: WebGLDevice;\n  readonly gl: WebGL2RenderingContext;\n  readonly handle: WebGLBuffer;\n\n  /** Target in OpenGL defines the type of buffer */\n  readonly glTarget: GL.ARRAY_BUFFER | GL.ELEMENT_ARRAY_BUFFER | GL.UNIFORM_BUFFER;\n  /** Usage is a hint on how frequently the buffer will be updates */\n  readonly glUsage: GL.STATIC_DRAW | GL.DYNAMIC_DRAW;\n  /** Index type is needed when issuing draw calls, so we pre-compute it */\n  readonly glIndexType: GL.UNSIGNED_SHORT | GL.UNSIGNED_INT = GL.UNSIGNED_SHORT;\n\n  /** Number of bytes allocated on the GPU for this buffer */\n  byteLength: number = 0;\n  /** Number of bytes used */\n  bytesUsed: number = 0;\n\n  constructor(device: WebGLDevice, props: BufferProps = {}) {\n    super(device, props);\n\n    this.device = device;\n    this.gl = this.device.gl;\n\n    const handle = typeof props === 'object' ? props.handle : undefined;\n    this.handle = handle || this.gl.createBuffer();\n    device._setWebGLDebugMetadata(this.handle, this, {\n      spector: {...this.props, data: typeof this.props.data}\n    });\n\n    // - In WebGL1, need to make sure we use GL.ELEMENT_ARRAY_BUFFER when initializing element buffers\n    //   otherwise buffer type will lock to generic (non-element) buffer\n    // - In WebGL2, we can use GL.COPY_READ_BUFFER which avoids locking the type here\n    this.glTarget = getWebGLTarget(this.props.usage);\n    this.glUsage = getWebGLUsage(this.props.usage);\n    // Note: uint8 indices are converted to uint16 during device normalization for WebGPU compatibility\n    this.glIndexType = this.props.indexType === 'uint32' ? GL.UNSIGNED_INT : GL.UNSIGNED_SHORT;\n\n    // Set data: (re)initializes the buffer\n    if (props.data) {\n      this._initWithData(props.data, props.byteOffset, props.byteLength);\n    } else {\n      this._initWithByteLength(props.byteLength || 0);\n    }\n  }\n\n  override destroy(): void {\n    if (!this.destroyed && this.handle) {\n      this.removeStats();\n      if (!this.props.handle) {\n        this.trackDeallocatedMemory();\n        this.gl.deleteBuffer(this.handle);\n      } else {\n        this.trackDeallocatedReferencedMemory('Buffer');\n      }\n      this.destroyed = true;\n      // @ts-expect-error\n      this.handle = null;\n    }\n  }\n\n  /** Allocate a new buffer and initialize to contents of typed array */\n  _initWithData(\n    data: ArrayBuffer | ArrayBufferView,\n    byteOffset: number = 0,\n    byteLength: number = data.byteLength + byteOffset\n  ): void {\n    // const glTarget = this.device.isWebGL2 ? GL.COPY_WRITE_BUFFER : this.glTarget;\n    const glTarget = this.glTarget;\n    this.gl.bindBuffer(glTarget, this.handle);\n    this.gl.bufferData(glTarget, byteLength, this.glUsage);\n    this.gl.bufferSubData(glTarget, byteOffset, data);\n    this.gl.bindBuffer(glTarget, null);\n\n    this.bytesUsed = byteLength;\n    this.byteLength = byteLength;\n\n    this._setDebugData(data, byteOffset, byteLength);\n    if (!this.props.handle) {\n      this.trackAllocatedMemory(byteLength);\n    } else {\n      this.trackReferencedMemory(byteLength, 'Buffer');\n    }\n  }\n\n  // Allocate a GPU buffer of specified size.\n  _initWithByteLength(byteLength: number): this {\n    // assert(byteLength >= 0);\n\n    // Workaround needed for Safari (#291):\n    // gl.bufferData with size equal to 0 crashes. Instead create zero sized array.\n    let data = byteLength;\n    if (byteLength === 0) {\n      // @ts-expect-error\n      data = new Float32Array(0);\n    }\n\n    // const glTarget = this.device.isWebGL2 ? GL.COPY_WRITE_BUFFER : this.glTarget;\n    const glTarget = this.glTarget;\n\n    this.gl.bindBuffer(glTarget, this.handle);\n    this.gl.bufferData(glTarget, data, this.glUsage);\n    this.gl.bindBuffer(glTarget, null);\n\n    this.bytesUsed = byteLength;\n    this.byteLength = byteLength;\n\n    this._setDebugData(null, 0, byteLength);\n    if (!this.props.handle) {\n      this.trackAllocatedMemory(byteLength);\n    } else {\n      this.trackReferencedMemory(byteLength, 'Buffer');\n    }\n\n    return this;\n  }\n\n  write(data: ArrayBufferLike | ArrayBufferView, byteOffset: number = 0): void {\n    const dataView = ArrayBuffer.isView(data) ? data : new Uint8Array(data);\n    const srcOffset = 0;\n    const byteLength = undefined; // data.byteLength;\n\n    // Create the buffer - binding it here for the first time locks the type\n    // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n    const glTarget = GL.COPY_WRITE_BUFFER;\n    this.gl.bindBuffer(glTarget, this.handle);\n    // WebGL2: subData supports additional srcOffset and length parameters\n    if (srcOffset !== 0 || byteLength !== undefined) {\n      this.gl.bufferSubData(glTarget, byteOffset, dataView, srcOffset, byteLength);\n    } else {\n      this.gl.bufferSubData(glTarget, byteOffset, dataView);\n    }\n    this.gl.bindBuffer(glTarget, null);\n\n    this._setDebugData(data, byteOffset, data.byteLength);\n  }\n\n  async mapAndWriteAsync(\n    callback: BufferMapCallback<void>,\n    byteOffset: number = 0,\n    byteLength: number = this.byteLength - byteOffset\n  ): Promise<void> {\n    const arrayBuffer = new ArrayBuffer(byteLength);\n    // eslint-disable-next-line @typescript-eslint/await-thenable\n    await callback(arrayBuffer, 'copied');\n    this.write(arrayBuffer, byteOffset);\n  }\n\n  async readAsync(byteOffset = 0, byteLength?: number): Promise<Uint8Array<ArrayBuffer>> {\n    return this.readSyncWebGL(byteOffset, byteLength);\n  }\n\n  async mapAndReadAsync<T>(\n    callback: BufferMapCallback<T>,\n    byteOffset = 0,\n    byteLength?: number\n  ): Promise<T> {\n    const data = await this.readAsync(byteOffset, byteLength);\n    // eslint-disable-next-line @typescript-eslint/await-thenable\n    return await callback(data.buffer, 'copied');\n  }\n\n  readSyncWebGL(byteOffset = 0, byteLength?: number): Uint8Array<ArrayBuffer> {\n    byteLength = byteLength ?? this.byteLength - byteOffset;\n    const data = new Uint8Array(byteLength);\n    const dstOffset = 0;\n\n    // Use GL.COPY_READ_BUFFER to avoid disturbing other targets and locking type\n    this.gl.bindBuffer(GL.COPY_READ_BUFFER, this.handle);\n    this.gl.getBufferSubData(GL.COPY_READ_BUFFER, byteOffset, data, dstOffset, byteLength);\n    this.gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n\n    // Update local `data` if offsets are 0\n    this._setDebugData(data, byteOffset, byteLength);\n\n    return data;\n  }\n}\n\n/**\n * Returns a WebGL buffer target\n *\n * @param usage\n * static MAP_READ = 0x01;\n * static MAP_WRITE = 0x02;\n * static COPY_SRC = 0x0004;\n * static COPY_DST = 0x0008;\n * static INDEX = 0x0010;\n * static VERTEX = 0x0020;\n * static UNIFORM = 0x0040;\n * static STORAGE = 0x0080;\n * static INDIRECT = 0x0100;\n * static QUERY_RESOLVE = 0x0200;\n *\n * @returns WebGL buffer targe\n *\n * Buffer bind points in WebGL2\n * gl.COPY_READ_BUFFER: Buffer for copying from one buffer object to another.\n * gl.COPY_WRITE_BUFFER: Buffer for copying from one buffer object to another.\n * gl.TRANSFORM_FEEDBACK_BUFFER: Buffer for transform feedback operations.\n * gl.PIXEL_PACK_BUFFER: Buffer used for pixel transfer operations.\n * gl.PIXEL_UNPACK_BUFFER: Buffer used for pixel transfer operations.\n */\nfunction getWebGLTarget(\n  usage: number\n): GL.ARRAY_BUFFER | GL.ELEMENT_ARRAY_BUFFER | GL.UNIFORM_BUFFER {\n  if (usage & Buffer.INDEX) {\n    return GL.ELEMENT_ARRAY_BUFFER;\n  }\n  if (usage & Buffer.VERTEX) {\n    return GL.ARRAY_BUFFER;\n  }\n  if (usage & Buffer.UNIFORM) {\n    return GL.UNIFORM_BUFFER;\n  }\n\n  // Binding a buffer for the first time locks the type\n  // In WebGL2, we can use GL.COPY_WRITE_BUFFER to avoid locking the type\n  return GL.ARRAY_BUFFER;\n}\n\n/** @todo usage is not passed correctly */\nfunction getWebGLUsage(usage: number): GL.STATIC_DRAW | GL.DYNAMIC_DRAW {\n  if (usage & Buffer.INDEX) {\n    return GL.STATIC_DRAW;\n  }\n  if (usage & Buffer.VERTEX) {\n    return GL.STATIC_DRAW;\n  }\n  if (usage & Buffer.UNIFORM) {\n    return GL.DYNAMIC_DRAW;\n  }\n  return GL.STATIC_DRAW;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {type CompilerMessage} from '@luma.gl/core';\n\n/**\n * Parse a WebGL-format GLSL compilation log into an array of WebGPU style message records.\n * This follows documented WebGL conventions for compilation logs.\n * Based on https://github.com/wwwtyro/gl-format-compiler-error (public domain)\n */\nexport function parseShaderCompilerLog(errLog: string): readonly CompilerMessage[] {\n  // Parse the error - note: browser and driver dependent\n  const lines = errLog.split(/\\r?\\n/);\n\n  const messages: CompilerMessage[] = [];\n\n  for (const line of lines) {\n    if (line.length <= 1) {\n      continue; // eslint-disable-line no-continue\n    }\n\n    const lineWithTrimmedWhitespace = line.trim();\n\n    const segments: string[] = line.split(':');\n    const trimmedMessageType = segments[0]?.trim();\n\n    // Check for messages with no line information `ERROR: unsupported shader version`\n    if (segments.length === 2) {\n      const [messageType, message] = segments;\n      if (!messageType || !message) {\n        messages.push({\n          message: lineWithTrimmedWhitespace,\n          type: getMessageType(trimmedMessageType || 'info'),\n          lineNum: 0,\n          linePos: 0\n        });\n        continue; // eslint-disable-line no-continue\n      }\n      messages.push({\n        message: message.trim(),\n        type: getMessageType(messageType),\n        lineNum: 0,\n        linePos: 0\n      });\n\n      continue; // eslint-disable-line no-continue\n    }\n\n    const [messageType, linePosition, lineNumber, ...rest] = segments;\n    if (!messageType || !linePosition || !lineNumber) {\n      messages.push({\n        message: segments.slice(1).join(':').trim() || lineWithTrimmedWhitespace,\n        type: getMessageType(trimmedMessageType || 'info'),\n        lineNum: 0,\n        linePos: 0\n      });\n      continue; // eslint-disable-line no-continue\n    }\n\n    let lineNum = parseInt(lineNumber, 10);\n    if (Number.isNaN(lineNum)) {\n      lineNum = 0;\n    }\n\n    let linePos = parseInt(linePosition, 10);\n    if (Number.isNaN(linePos)) {\n      linePos = 0;\n    }\n\n    messages.push({\n      message: rest.join(':').trim(),\n      type: getMessageType(messageType),\n      lineNum,\n      linePos // TODO\n    });\n  }\n\n  return messages;\n}\n\n/** Ensure supported type */\nfunction getMessageType(messageType: string): 'warning' | 'error' | 'info' {\n  const MESSAGE_TYPES = ['warning', 'error', 'info'];\n  const lowerCaseType = messageType.toLowerCase();\n  return (MESSAGE_TYPES.includes(lowerCaseType) ? lowerCaseType : 'info') as\n    | 'warning'\n    | 'error'\n    | 'info';\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Shader, ShaderProps, CompilerMessage, log} from '@luma.gl/core';\nimport {GL} from '@luma.gl/webgl/constants';\nimport {parseShaderCompilerLog} from '../helpers/parse-shader-compiler-log';\nimport {WebGLDevice} from '../webgl-device';\n\n/**\n * An immutable compiled shader program that execute portions of the GPU Pipeline\n */\nexport class WEBGLShader extends Shader {\n  readonly device: WebGLDevice;\n  readonly handle: WebGLShader;\n\n  constructor(device: WebGLDevice, props: ShaderProps) {\n    super(device, props);\n    this.device = device;\n    switch (this.props.stage) {\n      case 'vertex':\n        this.handle = this.props.handle || this.device.gl.createShader(GL.VERTEX_SHADER);\n        break;\n      case 'fragment':\n        this.handle = this.props.handle || this.device.gl.createShader(GL.FRAGMENT_SHADER);\n        break;\n      default:\n        throw new Error(this.props.stage);\n    }\n\n    // default framebuffer handle is null, so we can't set spector metadata...\n    device._setWebGLDebugMetadata(this.handle, this, {spector: this.props});\n\n    const compilationStatus = this._compile(this.source);\n    if (compilationStatus && typeof compilationStatus.catch === 'function') {\n      compilationStatus.catch(() => {\n        // Ensure any async compile status errors are consumed.\n        this.compilationStatus = 'error';\n      });\n    }\n  }\n\n  override destroy(): void {\n    if (this.handle) {\n      this.removeStats();\n      this.device.gl.deleteShader(this.handle);\n      this.destroyed = true;\n      // @ts-expect-error\n      this.handle.destroyed = true;\n      // this.handle = null;\n    }\n  }\n\n  get asyncCompilationStatus(): Promise<'pending' | 'success' | 'error'> {\n    return this._waitForCompilationComplete().then(() => {\n      this._getCompilationStatus();\n      return this.compilationStatus;\n    });\n  }\n\n  override async getCompilationInfo(): Promise<readonly CompilerMessage[]> {\n    await this._waitForCompilationComplete();\n    return this.getCompilationInfoSync();\n  }\n\n  override getCompilationInfoSync(): readonly CompilerMessage[] {\n    const shaderLog = this.device.gl.getShaderInfoLog(this.handle);\n    return shaderLog ? parseShaderCompilerLog(shaderLog) : [];\n  }\n\n  override getTranslatedSource(): string | null {\n    const extensions = this.device.getExtension('WEBGL_debug_shaders');\n    const ext = extensions.WEBGL_debug_shaders;\n    return ext?.getTranslatedShaderSource(this.handle) || null;\n  }\n\n  // PRIVATE METHODS\n\n  /** Compile a shader and get compilation status */\n  protected _compile(source: string): void | Promise<void> {\n    source = source.startsWith('#version ') ? source : `#version 300 es\\n${source}`;\n\n    const {gl} = this.device;\n    gl.shaderSource(this.handle, source);\n    gl.compileShader(this.handle);\n\n    // For performance reasons, avoid checking shader compilation errors on production\n    if (!this.device.props.debug) {\n      this.compilationStatus = 'pending';\n      return;\n    }\n\n    // Sync case - slower, but advantage is that it throws in the constructor, making break on error more useful\n    if (!this.device.features.has('compilation-status-async-webgl')) {\n      this._getCompilationStatus();\n      // The `Shader` base class will determine if debug window should be opened based on this.compilationStatus\n      this.debugShader();\n      if (this.compilationStatus === 'error') {\n        throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);\n      }\n      return;\n    }\n\n    // async case\n    log.once(1, 'Shader compilation is asynchronous')();\n    return this._waitForCompilationComplete().then(() => {\n      log.info(2, `Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)();\n      this._getCompilationStatus();\n\n      // The `Shader` base class will determine if debug window should be opened based on this.compilationStatus\n      this.debugShader();\n    });\n  }\n\n  /** Use KHR_parallel_shader_compile extension if available */\n  protected async _waitForCompilationComplete(): Promise<void> {\n    const waitMs = async (ms: number) => await new Promise(resolve => setTimeout(resolve, ms));\n    const DELAY_MS = 10; // Shader compilation is typically quite fast (with some exceptions)\n\n    // If status polling is not available, we can't wait for completion. Just wait a little to minimize blocking\n    if (!this.device.features.has('compilation-status-async-webgl')) {\n      await waitMs(DELAY_MS);\n      return;\n    }\n\n    const {gl} = this.device;\n    for (;;) {\n      const complete = gl.getShaderParameter(this.handle, GL.COMPLETION_STATUS_KHR);\n      if (complete) {\n        return;\n      }\n      await waitMs(DELAY_MS);\n    }\n  }\n\n  /**\n   * Get the shader compilation status\n   * TODO - Load log even when no error reported, to catch warnings?\n   * https://gamedev.stackexchange.com/questions/30429/how-to-detect-glsl-warnings\n   */\n  protected _getCompilationStatus() {\n    this.compilationStatus = this.device.gl.getShaderParameter(this.handle, GL.COMPILE_STATUS)\n      ? 'success'\n      : 'error';\n  }\n}\n\n// TODO - Original code from luma.gl v8 - keep until new debug functionality has matured\n// if (!compilationSuccess) {\n//   const parsedLog = shaderLog ? parseShaderCompilerLog(shaderLog) : [];\n//   const messages = parsedLog.filter(message => message.type === 'error');\n//   const formattedLog = formatCompilerLog(messages, source, {showSourceCode: 'all', html: true});\n//   const shaderDescription = `${this.stage} shader ${shaderName}`;\n//   log.error(`GLSL compilation errors in ${shaderDescription}\\n${formattedLog}`)();\n//   displayShaderLog(parsedLog, source, shaderName);\n// }\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {CompareFunction, StencilOperation, BlendOperation, BlendFactor} from '@luma.gl/core';\nimport {Device, log, Parameters, PolygonMode, ProvokingVertex} from '@luma.gl/core';\nimport {GL} from '@luma.gl/webgl/constants';\nimport type {\n  GLBlendEquation,\n  GLBlendFunction,\n  GLFunction,\n  GLParameters,\n  GLPolygonMode,\n  GLProvokingVertex,\n  GLStencilOp\n} from '@luma.gl/webgl/constants';\nimport {setGLParameters} from '../../context/parameters/unified-parameter-api';\nimport {WebGLDevice} from '../webgl-device';\n\n/* eslint-disable no-unused-expressions */ // For expression ? gl.enable() : gl.disable()\n\n/**\n * Execute a function with a set of temporary WebGL parameter overrides\n * - Saves current \"global\" WebGL context settings\n * - Sets the supplies WebGL context parameters,\n * - Executes supplied function\n * - Restores parameters\n * - Returns the return value of the supplied function\n */\nexport function withDeviceAndGLParameters<T = unknown>(\n  device: Device,\n  parameters: Parameters,\n  glParameters: GLParameters,\n  func: (_?: Device) => T\n): T {\n  if (isObjectEmpty(parameters)) {\n    // Avoid setting state if no parameters provided. Just call and return\n    return func(device);\n  }\n\n  // Wrap in a try-catch to ensure that parameters are restored on exceptions\n  const webglDevice = device as WebGLDevice;\n  webglDevice.pushState();\n  try {\n    setDeviceParameters(device, parameters);\n    setGLParameters(webglDevice.gl, glParameters);\n    return func(device);\n  } finally {\n    webglDevice.popState();\n  }\n}\n\n/**\n * Execute a function with a set of temporary WebGL parameter overrides\n * - Saves current \"global\" WebGL context settings\n * - Sets the supplies WebGL context parameters,\n * - Executes supplied function\n * - Restores parameters\n * - Returns the return value of the supplied function\n * @deprecated use withDeviceParameters instead\n */\nexport function withGLParameters<T = unknown>(\n  device: Device,\n  parameters: GLParameters,\n  func: (_?: Device) => T\n): T {\n  if (isObjectEmpty(parameters)) {\n    // Avoid setting state if no parameters provided. Just call and return\n    return func(device);\n  }\n\n  // Wrap in a try-catch to ensure that parameters are restored on exceptions\n  const webglDevice = device as WebGLDevice;\n  webglDevice.pushState();\n  try {\n    setGLParameters(webglDevice.gl, parameters);\n    return func(device);\n  } finally {\n    webglDevice.popState();\n  }\n}\n\n/**\n * Execute a function with a set of temporary WebGL parameter overrides\n * - Saves current \"global\" WebGL context settings\n * - Sets the supplies WebGL context parameters,\n * - Executes supplied function\n * - Restores parameters\n * - Returns the return value of the supplied function\n */\nexport function withDeviceParameters<T = unknown>(\n  device: Device,\n  parameters: Parameters,\n  func: (_?: Device) => T\n): T {\n  if (isObjectEmpty(parameters)) {\n    // Avoid setting state if no parameters provided. Just call and return\n    return func(device);\n  }\n\n  // Wrap in a try-catch to ensure that parameters are restored on exceptions'\n  const webglDevice = device as WebGLDevice;\n  webglDevice.pushState();\n  try {\n    setDeviceParameters(device, parameters);\n    return func(device);\n  } finally {\n    webglDevice.popState();\n  }\n}\n\n/** Set WebGPU Style Parameters */\nexport function setDeviceParameters(device: Device, parameters: Parameters) {\n  const webglDevice = device as WebGLDevice;\n  const {gl} = webglDevice;\n\n  // RASTERIZATION SETTINGS\n  if (parameters.cullMode) {\n    switch (parameters.cullMode) {\n      case 'none':\n        gl.disable(GL.CULL_FACE);\n        break;\n      case 'front':\n        gl.enable(GL.CULL_FACE);\n        gl.cullFace(GL.FRONT);\n        break;\n      case 'back':\n        gl.enable(GL.CULL_FACE);\n        gl.cullFace(GL.BACK);\n        break;\n    }\n  }\n\n  if (parameters.frontFace) {\n    gl.frontFace(\n      map('frontFace', parameters.frontFace, {\n        ccw: GL.CCW,\n        cw: GL.CW\n      })\n    );\n  }\n\n  if (parameters.unclippedDepth) {\n    if (device.features.has('depth-clip-control')) {\n      // EXT_depth_clamp\n      gl.enable(GL.DEPTH_CLAMP_EXT);\n    }\n  }\n\n  if (parameters.depthBias !== undefined) {\n    gl.enable(GL.POLYGON_OFFSET_FILL);\n    gl.polygonOffset(parameters.depthBias, parameters.depthBiasSlopeScale || 0);\n  }\n\n  // depthBiasSlopeScale: {\n  //   // Handled by depthBias\n  // },\n\n  // WEBGL EXTENSIONS\n\n  if (parameters.provokingVertex) {\n    if (device.features.has('provoking-vertex-webgl')) {\n      const extensions = webglDevice.getExtension('WEBGL_provoking_vertex');\n      const ext = extensions.WEBGL_provoking_vertex;\n\n      const vertex = map<ProvokingVertex, GLProvokingVertex>(\n        'provokingVertex',\n        parameters.provokingVertex,\n        {\n          first: GL.FIRST_VERTEX_CONVENTION_WEBGL,\n          last: GL.LAST_VERTEX_CONVENTION_WEBGL\n        }\n      );\n      ext?.provokingVertexWEBGL(vertex);\n    }\n  }\n\n  if (parameters.polygonMode || parameters.polygonOffsetLine) {\n    if (device.features.has('polygon-mode-webgl')) {\n      if (parameters.polygonMode) {\n        const extensions = webglDevice.getExtension('WEBGL_polygon_mode');\n        const ext = extensions.WEBGL_polygon_mode;\n        const mode = map<PolygonMode, GLPolygonMode>('polygonMode', parameters.polygonMode, {\n          fill: GL.FILL_WEBGL,\n          line: GL.LINE_WEBGL\n        });\n        ext?.polygonModeWEBGL(GL.FRONT, mode);\n        ext?.polygonModeWEBGL(GL.BACK, mode);\n      }\n\n      if (parameters.polygonOffsetLine) {\n        gl.enable(GL.POLYGON_OFFSET_LINE_WEBGL);\n      }\n    }\n  }\n\n  if (device.features.has('shader-clip-cull-distance-webgl')) {\n    if (parameters.clipDistance0) {\n      gl.enable(GL.CLIP_DISTANCE0_WEBGL);\n    }\n    if (parameters.clipDistance1) {\n      gl.enable(GL.CLIP_DISTANCE1_WEBGL);\n    }\n    if (parameters.clipDistance2) {\n      gl.enable(GL.CLIP_DISTANCE2_WEBGL);\n    }\n    if (parameters.clipDistance3) {\n      gl.enable(GL.CLIP_DISTANCE3_WEBGL);\n    }\n    if (parameters.clipDistance4) {\n      gl.enable(GL.CLIP_DISTANCE4_WEBGL);\n    }\n    if (parameters.clipDistance5) {\n      gl.enable(GL.CLIP_DISTANCE5_WEBGL);\n    }\n    if (parameters.clipDistance6) {\n      gl.enable(GL.CLIP_DISTANCE6_WEBGL);\n    }\n    if (parameters.clipDistance7) {\n      gl.enable(GL.CLIP_DISTANCE7_WEBGL);\n    }\n  }\n\n  // DEPTH STENCIL\n\n  if (parameters.depthWriteEnabled !== undefined) {\n    gl.depthMask(mapBoolean('depthWriteEnabled', parameters.depthWriteEnabled));\n  }\n\n  if (parameters.depthCompare) {\n    parameters.depthCompare !== 'always' ? gl.enable(GL.DEPTH_TEST) : gl.disable(GL.DEPTH_TEST);\n    gl.depthFunc(convertCompareFunction('depthCompare', parameters.depthCompare));\n  }\n\n  if (parameters.clearDepth !== undefined) {\n    gl.clearDepth(parameters.clearDepth);\n  }\n\n  if (parameters.stencilWriteMask) {\n    const mask = parameters.stencilWriteMask;\n    gl.stencilMaskSeparate(GL.FRONT, mask);\n    gl.stencilMaskSeparate(GL.BACK, mask);\n  }\n\n  if (parameters.stencilReadMask) {\n    // stencilReadMask is handle inside stencil***Compare.\n    log.warn('stencilReadMask not supported under WebGL');\n  }\n\n  if (parameters.stencilCompare) {\n    const mask = parameters.stencilReadMask || 0xffffffff;\n    const glValue = convertCompareFunction('depthCompare', parameters.stencilCompare);\n    // TODO - ensure back doesn't overwrite\n    parameters.stencilCompare !== 'always'\n      ? gl.enable(GL.STENCIL_TEST)\n      : gl.disable(GL.STENCIL_TEST);\n    gl.stencilFuncSeparate(GL.FRONT, glValue, 0, mask);\n    gl.stencilFuncSeparate(GL.BACK, glValue, 0, mask);\n  }\n\n  if (\n    parameters.stencilPassOperation &&\n    parameters.stencilFailOperation &&\n    parameters.stencilDepthFailOperation\n  ) {\n    const dppass = convertStencilOperation('stencilPassOperation', parameters.stencilPassOperation);\n    const sfail = convertStencilOperation('stencilFailOperation', parameters.stencilFailOperation);\n    const dpfail = convertStencilOperation(\n      'stencilDepthFailOperation',\n      parameters.stencilDepthFailOperation\n    );\n    gl.stencilOpSeparate(GL.FRONT, sfail, dpfail, dppass);\n    gl.stencilOpSeparate(GL.BACK, sfail, dpfail, dppass);\n  }\n\n  // stencilDepthFailOperation() {\n  //   // handled by stencilPassOperation\n  // },\n\n  // stencilFailOperation() {\n  //   // handled by stencilPassOperation\n  // },\n\n  // COLOR STATE\n  switch (parameters.blend) {\n    case true:\n      gl.enable(GL.BLEND);\n      break;\n    case false:\n      gl.disable(GL.BLEND);\n      break;\n    default:\n    // leave WebGL blend state unchanged if `parameters.blend` is not set\n  }\n\n  if (parameters.blendColorOperation || parameters.blendAlphaOperation) {\n    const colorEquation = convertBlendOperationToEquation(\n      'blendColorOperation',\n      parameters.blendColorOperation || 'add'\n    );\n    const alphaEquation = convertBlendOperationToEquation(\n      'blendAlphaOperation',\n      parameters.blendAlphaOperation || 'add'\n    );\n    gl.blendEquationSeparate(colorEquation, alphaEquation);\n\n    const colorSrcFactor = convertBlendFactorToFunction(\n      'blendColorSrcFactor',\n      parameters.blendColorSrcFactor || 'one'\n    );\n    const colorDstFactor = convertBlendFactorToFunction(\n      'blendColorDstFactor',\n      parameters.blendColorDstFactor || 'zero'\n    );\n    const alphaSrcFactor = convertBlendFactorToFunction(\n      'blendAlphaSrcFactor',\n      parameters.blendAlphaSrcFactor || 'one'\n    );\n    const alphaDstFactor = convertBlendFactorToFunction(\n      'blendAlphaDstFactor',\n      parameters.blendAlphaDstFactor || 'zero'\n    );\n    gl.blendFuncSeparate(colorSrcFactor, colorDstFactor, alphaSrcFactor, alphaDstFactor);\n  }\n}\n\n/*\n      rasterizationState: {\n        cullMode: \"back\",\n      },\n\n      depthStencilState: {\n        depthWriteEnabled: true,\n        depthCompare: \"less\",\n        format: \"depth24plus-stencil8\",\n      },\n\n      colorStates: [\n        {\n          format: \"bgra8unorm\",\n          // colorBlend.srcFactor = wgpu::BlendFactor::SrcAlpha;\n          // colorBlend.dstFactor = wgpu::BlendFactor::OneMinusSrcAlpha;\n          // alphaBlend.srcFactor = wgpu::BlendFactor::SrcAlpha;\n          // alphaBlend.dstFactor = wgpu::BlendFactor::OneMinusSrcAlpha;\n        },\n      ],\n    });\n*/\n\nexport function convertCompareFunction(parameter: string, value: CompareFunction): GLFunction {\n  return map<CompareFunction, GLFunction>(parameter, value, {\n    never: GL.NEVER,\n    less: GL.LESS,\n    equal: GL.EQUAL,\n    'less-equal': GL.LEQUAL,\n    greater: GL.GREATER,\n    'not-equal': GL.NOTEQUAL,\n    'greater-equal': GL.GEQUAL,\n    always: GL.ALWAYS\n  });\n}\n\nexport function convertToCompareFunction(parameter: string, value: GLFunction): CompareFunction {\n  return map<GLFunction, CompareFunction>(parameter, value, {\n    [GL.NEVER]: 'never',\n    [GL.LESS]: 'less',\n    [GL.EQUAL]: 'equal',\n    [GL.LEQUAL]: 'less-equal',\n    [GL.GREATER]: 'greater',\n    [GL.NOTEQUAL]: 'not-equal',\n    [GL.GEQUAL]: 'greater-equal',\n    [GL.ALWAYS]: 'always'\n  });\n}\n\nfunction convertStencilOperation(parameter: string, value: StencilOperation): GL {\n  return map<StencilOperation, GLStencilOp>(parameter, value, {\n    keep: GL.KEEP,\n    zero: GL.ZERO,\n    replace: GL.REPLACE,\n    invert: GL.INVERT,\n    'increment-clamp': GL.INCR,\n    'decrement-clamp': GL.DECR,\n    'increment-wrap': GL.INCR_WRAP,\n    'decrement-wrap': GL.DECR_WRAP\n  });\n}\n\nfunction convertBlendOperationToEquation(\n  parameter: string,\n  value: BlendOperation\n): GLBlendEquation {\n  return map<BlendOperation, GLBlendEquation>(parameter, value, {\n    add: GL.FUNC_ADD,\n    subtract: GL.FUNC_SUBTRACT,\n    'reverse-subtract': GL.FUNC_REVERSE_SUBTRACT,\n    min: GL.MIN,\n    max: GL.MAX\n  });\n}\n\nfunction convertBlendFactorToFunction(\n  parameter: string,\n  value: BlendFactor,\n  type: 'color' | 'alpha' = 'color'\n): GLBlendFunction {\n  return map<BlendFactor, GLBlendFunction>(parameter, value, {\n    one: GL.ONE,\n    zero: GL.ZERO,\n    src: GL.SRC_COLOR,\n    'one-minus-src': GL.ONE_MINUS_SRC_COLOR,\n    dst: GL.DST_COLOR,\n    'one-minus-dst': GL.ONE_MINUS_DST_COLOR,\n    'src-alpha': GL.SRC_ALPHA,\n    'one-minus-src-alpha': GL.ONE_MINUS_SRC_ALPHA,\n    'dst-alpha': GL.DST_ALPHA,\n    'one-minus-dst-alpha': GL.ONE_MINUS_DST_ALPHA,\n    'src-alpha-saturated': GL.SRC_ALPHA_SATURATE,\n    constant: type === 'color' ? GL.CONSTANT_COLOR : GL.CONSTANT_ALPHA,\n    'one-minus-constant':\n      type === 'color' ? GL.ONE_MINUS_CONSTANT_COLOR : GL.ONE_MINUS_CONSTANT_ALPHA,\n    // 'constant-alpha': GL.CONSTANT_ALPHA,\n    // 'one-minus-constant-alpha': GL.ONE_MINUS_CONSTANT_ALPHA,\n    // TODO not supported in WebGL2\n    src1: GL.SRC_COLOR,\n    'one-minus-src1': GL.ONE_MINUS_SRC_COLOR,\n    'src1-alpha': GL.SRC_ALPHA,\n    'one-minus-src1-alpha': GL.ONE_MINUS_SRC_ALPHA\n  });\n}\n\nfunction message(parameter: string, value: any): string {\n  return `Illegal parameter ${value} for ${parameter}`;\n}\n\nfunction map<K extends string | number, V>(parameter: string, value: K, valueMap: Record<K, V>): V {\n  if (!(value in valueMap)) {\n    throw new Error(message(parameter, value));\n  }\n  return valueMap[value];\n}\n\nfunction mapBoolean(parameter: string, value: boolean): boolean {\n  return value;\n}\n\n/** Returns true if given object is empty, false otherwise. */\nfunction isObjectEmpty(obj: object): boolean {\n  let isEmpty = true;\n  // @ts-ignore key is unused\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  for (const key in obj) {\n    isEmpty = false;\n    break;\n  }\n  return isEmpty;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// SAMPLER FILTERS\nimport {SamplerProps} from '@luma.gl/core';\nimport {GL, GLSamplerParameters} from '@luma.gl/webgl/constants';\nimport {convertCompareFunction} from './device-parameters';\n\n/**\n * Convert WebGPU-style sampler props to WebGL\n * @param props\n * @returns\n */\nexport function convertSamplerParametersToWebGL(props: SamplerProps): GLSamplerParameters {\n  const params: GLSamplerParameters = {};\n  if (props.addressModeU) {\n    params[GL.TEXTURE_WRAP_S] = convertAddressMode(props.addressModeU);\n  }\n  if (props.addressModeV) {\n    params[GL.TEXTURE_WRAP_T] = convertAddressMode(props.addressModeV);\n  }\n  if (props.addressModeW) {\n    params[GL.TEXTURE_WRAP_R] = convertAddressMode(props.addressModeW);\n  }\n  if (props.magFilter) {\n    params[GL.TEXTURE_MAG_FILTER] = convertMaxFilterMode(props.magFilter);\n  }\n  if (props.minFilter || props.mipmapFilter) {\n    // TODO - arbitrary choice of linear?\n    params[GL.TEXTURE_MIN_FILTER] = convertMinFilterMode(\n      props.minFilter || 'linear',\n      props.mipmapFilter\n    );\n  }\n  if (props.lodMinClamp !== undefined) {\n    params[GL.TEXTURE_MIN_LOD] = props.lodMinClamp;\n  }\n  if (props.lodMaxClamp !== undefined) {\n    params[GL.TEXTURE_MAX_LOD] = props.lodMaxClamp;\n  }\n  if (props.type === 'comparison-sampler') {\n    // Setting prop.compare turns this into a comparison sampler\n    params[GL.TEXTURE_COMPARE_MODE] = GL.COMPARE_REF_TO_TEXTURE;\n  }\n  if (props.compare) {\n    params[GL.TEXTURE_COMPARE_FUNC] = convertCompareFunction('compare', props.compare);\n  }\n  // Note depends on WebGL extension\n  if (props.maxAnisotropy) {\n    params[GL.TEXTURE_MAX_ANISOTROPY_EXT] = props.maxAnisotropy;\n  }\n  return params;\n}\n\n// HELPERS\n\n/** Convert address more */\nfunction convertAddressMode(\n  addressMode: 'clamp-to-edge' | 'repeat' | 'mirror-repeat'\n): GL.CLAMP_TO_EDGE | GL.REPEAT | GL.MIRRORED_REPEAT {\n  switch (addressMode) {\n    case 'clamp-to-edge':\n      return GL.CLAMP_TO_EDGE;\n    case 'repeat':\n      return GL.REPEAT;\n    case 'mirror-repeat':\n      return GL.MIRRORED_REPEAT;\n  }\n}\n\nfunction convertMaxFilterMode(maxFilter: 'nearest' | 'linear'): GL.NEAREST | GL.LINEAR {\n  switch (maxFilter) {\n    case 'nearest':\n      return GL.NEAREST;\n    case 'linear':\n      return GL.LINEAR;\n  }\n}\n\n/**\n * WebGPU has separate min filter and mipmap filter,\n * WebGL is combined and effectively offers 6 options\n */\nfunction convertMinFilterMode(\n  minFilter: 'nearest' | 'linear',\n  mipmapFilter: 'none' | 'nearest' | 'linear' = 'none'\n):\n  | GL.NEAREST\n  | GL.LINEAR\n  | GL.NEAREST_MIPMAP_NEAREST\n  | GL.LINEAR_MIPMAP_NEAREST\n  | GL.NEAREST_MIPMAP_LINEAR\n  | GL.LINEAR_MIPMAP_LINEAR {\n  if (!mipmapFilter) {\n    return convertMaxFilterMode(minFilter);\n  }\n  switch (mipmapFilter) {\n    case 'none':\n      return convertMaxFilterMode(minFilter);\n    case 'nearest':\n      switch (minFilter) {\n        case 'nearest':\n          return GL.NEAREST_MIPMAP_NEAREST;\n        case 'linear':\n          return GL.LINEAR_MIPMAP_NEAREST;\n      }\n      break;\n    case 'linear':\n      switch (minFilter) {\n        case 'nearest':\n          return GL.NEAREST_MIPMAP_LINEAR;\n        case 'linear':\n          return GL.LINEAR_MIPMAP_LINEAR;\n      }\n  }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Sampler, SamplerProps} from '@luma.gl/core';\nimport {GL, GLSamplerParameters} from '@luma.gl/webgl/constants';\nimport {convertSamplerParametersToWebGL} from '../converters/sampler-parameters';\nimport type {WebGLDevice} from '../webgl-device';\n\n/**\n * Sampler object -\n * so that they can be set directly on the texture\n * https://github.com/WebGLSamples/WebGL2Samples/blob/master/samples/sampler_object.html\n */\nexport class WEBGLSampler extends Sampler {\n  readonly device: WebGLDevice;\n  readonly handle: WebGLSampler;\n  readonly parameters: GLSamplerParameters;\n\n  constructor(device: WebGLDevice, props: SamplerProps) {\n    super(device, props);\n    this.device = device;\n    this.parameters = convertSamplerParametersToWebGL(props);\n    this.handle = props.handle || this.device.gl.createSampler();\n    this._setSamplerParameters(this.parameters);\n  }\n\n  override destroy(): void {\n    if (this.handle) {\n      this.device.gl.deleteSampler(this.handle);\n      // @ts-expect-error read-only/undefined\n      this.handle = undefined;\n    }\n  }\n\n  override toString(): string {\n    return `Sampler(${this.id},${JSON.stringify(this.props)})`;\n  }\n\n  /** Set sampler parameters on the sampler */\n  private _setSamplerParameters(parameters: GLSamplerParameters): void {\n    for (const [pname, value] of Object.entries(parameters)) {\n      // Apparently there are integer/float conversion issues requires two parameter setting functions in JavaScript.\n      // For now, pick the float version for parameters specified as GLfloat.\n      const param = Number(pname) as GL.TEXTURE_MIN_LOD | GL.TEXTURE_MAX_LOD;\n      switch (param) {\n        case GL.TEXTURE_MIN_LOD:\n        case GL.TEXTURE_MAX_LOD:\n          this.device.gl.samplerParameterf(this.handle, param, value);\n          break;\n        default:\n          this.device.gl.samplerParameteri(this.handle, param, value);\n          break;\n      }\n    }\n  }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {GLParameters, setGLParameters} from '../parameters/unified-parameter-api';\nimport {WebGLStateTracker} from './webgl-state-tracker';\n\n/**\n * Execute a function with a set of temporary WebGL parameter overrides\n * - Saves current \"global\" WebGL context settings\n * - Sets the supplies WebGL context parameters,\n * - Executes supplied function\n * - Restores parameters\n * - Returns the return value of the supplied function\n */\nexport function withGLParameters(\n  gl: WebGL2RenderingContext,\n  parameters: GLParameters & {nocatch?: boolean},\n  func: any\n): any {\n  if (isObjectEmpty(parameters)) {\n    // Avoid setting state if no parameters provided. Just call and return\n    return func(gl);\n  }\n\n  const {nocatch = true} = parameters;\n\n  const webglState = WebGLStateTracker.get(gl);\n  webglState.push();\n  setGLParameters(gl, parameters);\n\n  // Setup is done, call the function\n  let value;\n\n  if (nocatch) {\n    // Avoid try catch to minimize stack size impact for safe execution paths\n    value = func(gl);\n    webglState.pop();\n  } else {\n    // Wrap in a try-catch to ensure that parameters are restored on exceptions\n    try {\n      value = func(gl);\n    } finally {\n      webglState.pop();\n    }\n  }\n\n  return value;\n}\n\n// Helpers\n\n// Returns true if given object is empty, false otherwise.\nfunction isObjectEmpty(object: unknown): boolean {\n  // @ts-ignore - dummy key variable\n  for (const key in object) {\n    return false;\n  }\n  return true;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Device, TextureViewProps} from '@luma.gl/core';\n// import {getTextureFormatInfo} from '@luma.gl/core';\nimport {TextureView, Texture} from '@luma.gl/core';\n\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLTexture} from './webgl-texture';\n\nexport class WEBGLTextureView extends TextureView {\n  readonly device: WebGLDevice;\n  readonly gl: WebGL2RenderingContext;\n  readonly handle: null; // Does not have a WebGL representation\n  readonly texture: WEBGLTexture;\n\n  constructor(device: Device, props: TextureViewProps & {texture: WEBGLTexture}) {\n    super(device, {...Texture.defaultProps, ...props});\n\n    this.device = device as WebGLDevice;\n    this.gl = this.device.gl;\n    this.handle = null;\n    this.texture = props.texture;\n  }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {GL, GLDataType, GLPixelType} from '@luma.gl/webgl/constants';\nimport {SignedDataType} from '@luma.gl/core';\n\n/** Get shadertypes data type from GL constants */\nexport function convertGLDataTypeToDataType(type: GLDataType | GLPixelType): SignedDataType {\n  return GL_DATA_TYPE_MAP[type];\n}\n\nconst GL_DATA_TYPE_MAP: Record<GLDataType | GLPixelType, SignedDataType> = {\n  [GL.INT]: 'sint32',\n  [GL.UNSIGNED_INT]: 'uint32',\n  [GL.SHORT]: 'sint16',\n  [GL.UNSIGNED_SHORT]: 'uint16',\n  [GL.BYTE]: 'sint8',\n  [GL.UNSIGNED_BYTE]: 'uint8',\n  [GL.FLOAT]: 'float32',\n  [GL.HALF_FLOAT]: 'float16',\n  [GL.UNSIGNED_SHORT_5_6_5]: 'uint16',\n  [GL.UNSIGNED_SHORT_4_4_4_4]: 'uint16',\n  [GL.UNSIGNED_SHORT_5_5_5_1]: 'uint16',\n  [GL.UNSIGNED_INT_2_10_10_10_REV]: 'uint32',\n  [GL.UNSIGNED_INT_10F_11F_11F_REV]: 'uint32',\n  [GL.UNSIGNED_INT_5_9_9_9_REV]: 'uint32',\n  [GL.UNSIGNED_INT_24_8]: 'uint32',\n  [GL.FLOAT_32_UNSIGNED_INT_24_8_REV]: 'uint32'\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// @ts-nocheck\n\nimport {\n  type Device,\n  type TextureProps,\n  type TextureViewProps,\n  type Sampler,\n  type SamplerProps,\n  type CopyExternalImageOptions,\n  type TextureReadOptions,\n  type TextureWriteOptions,\n  type TextureFormat,\n  Buffer,\n  getTypedArrayConstructor,\n  Texture,\n  log\n} from '@luma.gl/core';\n\nimport {\n  GLSamplerParameters,\n  GLValueParameters,\n  GL,\n  GLTextureTarget,\n  GLTextureCubeMapTarget,\n  GLTexelDataFormat,\n  GLPixelType\n} from '@luma.gl/webgl/constants';\n\nimport {getTextureFormatWebGL} from '../converters/webgl-texture-table';\nimport {convertSamplerParametersToWebGL} from '../converters/sampler-parameters';\nimport {withGLParameters} from '../../context/state-tracker/with-parameters';\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from './webgl-buffer';\nimport {WEBGLFramebuffer} from './webgl-framebuffer';\nimport {WEBGLSampler} from './webgl-sampler';\nimport {WEBGLTextureView} from './webgl-texture-view';\nimport {convertGLDataTypeToDataType} from '../converters/shader-formats';\n\n/**\n * WebGL... the texture API from hell... hopefully made simpler\n */\nexport class WEBGLTexture extends Texture {\n  // readonly MAX_ATTRIBUTES: number;\n  readonly device: WebGLDevice;\n  readonly gl: WebGL2RenderingContext;\n  handle: WebGLTexture;\n\n  // @ts-ignore TODO - currently unused in WebGL. Create dummy sampler?\n  sampler: WEBGLSampler = undefined;\n  view: WEBGLTextureView;\n\n  /**\n   * The WebGL target corresponding to the texture type\n   * @note `target` cannot be modified by bind:\n   * textures are special because when you first bind them to a target,\n   * When you first bind a texture as a GL_TEXTURE_2D, you are saying that this texture is a 2D texture.\n   * And it will always be a 2D texture; this state cannot be changed ever.\n   * A texture that was first bound as a GL_TEXTURE_2D, must always be bound as a GL_TEXTURE_2D;\n   * attempting to bind it as GL_TEXTURE_3D will give rise to a run-time error\n   */\n  glTarget: GLTextureTarget;\n  /** The WebGL format - essentially channel structure */\n  glFormat: GLTexelDataFormat;\n  /** The WebGL data format - the type of each channel */\n  glType: GLPixelType;\n  /** The WebGL constant corresponding to the WebGPU style constant in format */\n  glInternalFormat: GL;\n  /** Whether the internal format is compressed */\n  compressed: boolean;\n\n  // state\n  /** Texture binding slot - TODO - move to texture view? */\n  _textureUnit: number = 0;\n  /** Cached framebuffer reused for color texture readback. */\n  _framebuffer: WEBGLFramebuffer | null = null;\n  /** Cache key for the currently attached readback subresource `${mipLevel}:${layer}`. */\n  _framebufferAttachmentKey: string | null = null;\n\n  constructor(device: Device, props: TextureProps) {\n    // const byteAlignment = this._getRowByteAlignment(props.format, props.width);\n    super(device, props, {byteAlignment: 1});\n\n    this.device = device as WebGLDevice;\n    this.gl = this.device.gl;\n\n    const formatInfo = getTextureFormatWebGL(this.props.format);\n\n    // Note: In WebGL the texture target defines the type of texture on first bind.\n    this.glTarget = getWebGLTextureTarget(this.props.dimension);\n    this.glInternalFormat = formatInfo.internalFormat;\n    this.glFormat = formatInfo.format;\n    this.glType = formatInfo.type;\n    this.compressed = formatInfo.compressed;\n\n    this.handle = this.props.handle || this.gl.createTexture();\n    this.device._setWebGLDebugMetadata(this.handle, this, {spector: this.props});\n\n    /**\n     * Use WebGL immutable texture storage to allocate and clear texture memory.\n     * - texStorage2D should be considered a preferred alternative to texImage2D. It may have lower memory costs than texImage2D in some implementations.\n     * - Once texStorage*D has been called, the texture is immutable and can only be updated with texSubImage*(), not texImage()\n     * @see https://registry.khronos.org/webgl/specs/latest/2.0/ WebGL 2 spec section 3.7.6\n     */\n    this.gl.bindTexture(this.glTarget, this.handle);\n    const {dimension, width, height, depth, mipLevels, glTarget, glInternalFormat} = this;\n    if (!this.compressed) {\n      switch (dimension) {\n        case '2d':\n        case 'cube':\n          this.gl.texStorage2D(glTarget, mipLevels, glInternalFormat, width, height);\n          break;\n        case '2d-array':\n        case '3d':\n          this.gl.texStorage3D(glTarget, mipLevels, glInternalFormat, width, height, depth);\n          break;\n        default:\n          throw new Error(dimension);\n      }\n    }\n    this.gl.bindTexture(this.glTarget, null);\n\n    // Set data\n    this._initializeData(props.data);\n\n    if (!this.props.handle) {\n      this.trackAllocatedMemory(this.getAllocatedByteLength(), 'Texture');\n    } else {\n      this.trackReferencedMemory(this.getAllocatedByteLength(), 'Texture');\n    }\n\n    // Set texture sampler parameters\n    this.setSampler(this.props.sampler);\n    // @ts-ignore TODO - fix types\n    this.view = new WEBGLTextureView(this.device, {...this.props, texture: this});\n\n    Object.seal(this);\n  }\n\n  override destroy(): void {\n    if (this.handle) {\n      // Destroy any cached framebuffer\n      this._framebuffer?.destroy();\n      this._framebuffer = null;\n      this._framebufferAttachmentKey = null;\n\n      this.removeStats();\n      if (!this.props.handle) {\n        this.gl.deleteTexture(this.handle);\n        this.trackDeallocatedMemory('Texture');\n      } else {\n        this.trackDeallocatedReferencedMemory('Texture');\n      }\n      // this.handle = null;\n      this.destroyed = true;\n    }\n  }\n\n  createView(props: TextureViewProps): WEBGLTextureView {\n    return new WEBGLTextureView(this.device, {...props, texture: this});\n  }\n\n  override setSampler(sampler: Sampler | SamplerProps = {}): void {\n    super.setSampler(sampler);\n    // Apply sampler parameters to texture\n    const parameters = convertSamplerParametersToWebGL(this.sampler.props);\n    this._setSamplerParameters(parameters);\n  }\n\n  copyExternalImage(options_: CopyExternalImageOptions): {width: number; height: number} {\n    const options = this._normalizeCopyExternalImageOptions(options_);\n\n    if (options.sourceX || options.sourceY) {\n      // requires copyTexSubImage2D from a framebuffer'\n      throw new Error('WebGL does not support sourceX/sourceY)');\n    }\n\n    const {glFormat, glType} = this;\n    const {image, depth, mipLevel, x, y, z, width, height} = options;\n\n    // WebGL cube maps specify faces by overriding target instead of using the z parameter\n    const glTarget = getWebGLCubeFaceTarget(this.glTarget, this.dimension, z);\n    const glParameters: GLValueParameters = options.flipY ? {[GL.UNPACK_FLIP_Y_WEBGL]: true} : {};\n\n    this.gl.bindTexture(this.glTarget, this.handle);\n\n    withGLParameters(this.gl, glParameters, () => {\n      switch (this.dimension) {\n        case '2d':\n        case 'cube':\n          // biome-ignore format: preserve layout\n          this.gl.texSubImage2D(glTarget, mipLevel, x, y, width, height, glFormat, glType, image);\n          break;\n        case '2d-array':\n        case '3d':\n          // biome-ignore format: preserve layout\n          this.gl.texSubImage3D(glTarget, mipLevel, x, y, z, width, height, depth, glFormat, glType, image);\n          break;\n        default:\n        // Can never happen in WebGL\n      }\n    });\n\n    this.gl.bindTexture(this.glTarget, null);\n\n    return {width: options.width, height: options.height};\n  }\n\n  override copyImageData(options_): void {\n    super.copyImageData(options_);\n  }\n\n  /**\n   * Reads a color texture subresource into a GPU buffer using `PIXEL_PACK_BUFFER`.\n   *\n   * @note Only first-pass color readback is supported. Unsupported formats and aspects throw\n   * before any WebGL calls are issued.\n   */\n  readBuffer(options: TextureReadOptions & {byteOffset?: number} = {}, buffer?: Buffer): Buffer {\n    if (!buffer) {\n      throw new Error(`${this} readBuffer requires a destination buffer`);\n    }\n    const normalizedOptions = this._getSupportedColorReadOptions(options);\n    const byteOffset = options.byteOffset ?? 0;\n    const memoryLayout = this.computeMemoryLayout(normalizedOptions);\n\n    if (buffer.byteLength < byteOffset + memoryLayout.byteLength) {\n      throw new Error(\n        `${this} readBuffer target is too small (${buffer.byteLength} < ${byteOffset + memoryLayout.byteLength})`\n      );\n    }\n\n    const webglBuffer = buffer as WEBGLBuffer;\n    this.gl.bindBuffer(GL.PIXEL_PACK_BUFFER, webglBuffer.handle);\n    try {\n      this._readColorTextureLayers(normalizedOptions, memoryLayout, destinationByteOffset => {\n        this.gl.readPixels(\n          normalizedOptions.x,\n          normalizedOptions.y,\n          normalizedOptions.width,\n          normalizedOptions.height,\n          this.glFormat,\n          this.glType,\n          byteOffset + destinationByteOffset\n        );\n      });\n    } finally {\n      this.gl.bindBuffer(GL.PIXEL_PACK_BUFFER, null);\n    }\n\n    return buffer;\n  }\n\n  async readDataAsync(options: TextureReadOptions = {}): Promise<ArrayBuffer> {\n    throw new Error(\n      `${this} readDataAsync is deprecated; use readBuffer() with an explicit destination buffer or DynamicTexture.readAsync()`\n    );\n  }\n\n  writeBuffer(buffer: Buffer, options_: TextureWriteOptions = {}) {\n    const options = this._normalizeTextureWriteOptions(options_);\n    const {width, height, depthOrArrayLayers, mipLevel, byteOffset, x, y, z} = options;\n    const {glFormat, glType, compressed} = this;\n    const glTarget = getWebGLCubeFaceTarget(this.glTarget, this.dimension, z);\n\n    if (compressed) {\n      throw new Error('writeBuffer for compressed textures is not implemented in WebGL');\n    }\n\n    const {bytesPerPixel} = this.device.getTextureFormatInfo(this.format);\n    const unpackRowLength = bytesPerPixel ? options.bytesPerRow / bytesPerPixel : undefined;\n    const glParameters: GLValueParameters = {\n      [GL.UNPACK_ALIGNMENT]: this.byteAlignment,\n      ...(unpackRowLength !== undefined ? {[GL.UNPACK_ROW_LENGTH]: unpackRowLength} : {}),\n      [GL.UNPACK_IMAGE_HEIGHT]: options.rowsPerImage\n    };\n\n    this.gl.bindTexture(this.glTarget, this.handle);\n    this.gl.bindBuffer(GL.PIXEL_UNPACK_BUFFER, buffer.handle);\n\n    withGLParameters(this.gl, glParameters, () => {\n      switch (this.dimension) {\n        case '2d':\n        case 'cube':\n          this.gl.texSubImage2D(\n            glTarget,\n            mipLevel,\n            x,\n            y,\n            width,\n            height,\n            glFormat,\n            glType,\n            byteOffset\n          );\n          break;\n        case '2d-array':\n        case '3d':\n          this.gl.texSubImage3D(\n            glTarget,\n            mipLevel,\n            x,\n            y,\n            z,\n            width,\n            height,\n            depthOrArrayLayers,\n            glFormat,\n            glType,\n            byteOffset\n          );\n          break;\n        default:\n      }\n    });\n\n    this.gl.bindBuffer(GL.PIXEL_UNPACK_BUFFER, null);\n    this.gl.bindTexture(this.glTarget, null);\n  }\n\n  writeData(\n    data: ArrayBuffer | SharedArrayBuffer | ArrayBufferView,\n    options_: TextureWriteOptions = {}\n  ): void {\n    const options = this._normalizeTextureWriteOptions(options_);\n\n    const typedArray = ArrayBuffer.isView(data) ? data : new Uint8Array(data);\n    const {width, height, depthOrArrayLayers, mipLevel, x, y, z, byteOffset} = options;\n    const {glFormat, glType, compressed} = this;\n    const glTarget = getWebGLCubeFaceTarget(this.glTarget, this.dimension, z);\n\n    let unpackRowLength: number | undefined;\n    if (!compressed) {\n      const {bytesPerPixel} = this.device.getTextureFormatInfo(this.format);\n      if (bytesPerPixel) {\n        unpackRowLength = options.bytesPerRow / bytesPerPixel;\n      }\n    }\n\n    const glParameters: GLValueParameters = !this.compressed\n      ? {\n          [GL.UNPACK_ALIGNMENT]: this.byteAlignment,\n          ...(unpackRowLength !== undefined ? {[GL.UNPACK_ROW_LENGTH]: unpackRowLength} : {}),\n          [GL.UNPACK_IMAGE_HEIGHT]: options.rowsPerImage\n        }\n      : {};\n    const sourceElementOffset = getWebGLTextureSourceElementOffset(typedArray, byteOffset);\n    const compressedData = compressed ? getArrayBufferView(typedArray, byteOffset) : typedArray;\n    const mipLevelSize = this._getMipLevelSize(mipLevel);\n    const isFullMipUpload =\n      x === 0 &&\n      y === 0 &&\n      z === 0 &&\n      width === mipLevelSize.width &&\n      height === mipLevelSize.height &&\n      depthOrArrayLayers === mipLevelSize.depthOrArrayLayers;\n\n    this.gl.bindTexture(this.glTarget, this.handle);\n    this.gl.bindBuffer(GL.PIXEL_UNPACK_BUFFER, null);\n\n    withGLParameters(this.gl, glParameters, () => {\n      switch (this.dimension) {\n        case '2d':\n        case 'cube':\n          if (compressed) {\n            if (isFullMipUpload) {\n              // biome-ignore format: preserve layout\n              this.gl.compressedTexImage2D(glTarget, mipLevel, glFormat, width, height, 0, compressedData);\n            } else {\n              // biome-ignore format: preserve layout\n              this.gl.compressedTexSubImage2D(glTarget, mipLevel, x, y, width, height, glFormat, compressedData);\n            }\n          } else {\n            // biome-ignore format: preserve layout\n            this.gl.texSubImage2D(glTarget, mipLevel, x, y, width, height, glFormat, glType, typedArray, sourceElementOffset);\n          }\n          break;\n        case '2d-array':\n        case '3d':\n          if (compressed) {\n            if (isFullMipUpload) {\n              // biome-ignore format: preserve layout\n              this.gl.compressedTexImage3D(\n                glTarget,\n                mipLevel,\n                glFormat,\n                width,\n                height,\n                depthOrArrayLayers,\n                0,\n                compressedData\n              );\n            } else {\n              // biome-ignore format: preserve layout\n              this.gl.compressedTexSubImage3D(\n                glTarget,\n                mipLevel,\n                x,\n                y,\n                z,\n                width,\n                height,\n                depthOrArrayLayers,\n                glFormat,\n                compressedData\n              );\n            }\n          } else {\n            // biome-ignore format: preserve layout\n            this.gl.texSubImage3D(glTarget, mipLevel, x, y, z, width, height, depthOrArrayLayers, glFormat, glType, typedArray, sourceElementOffset);\n          }\n          break;\n        default:\n        // Can never happen in WebGL\n      }\n    });\n\n    this.gl.bindTexture(this.glTarget, null);\n  }\n\n  // IMPLEMENTATION SPECIFIC\n\n  /** @todo - for now we always use 1 for maximum compatibility, we can fine tune later */\n  private _getRowByteAlignment(format: TextureFormat, width: number): 1 | 2 | 4 | 8 {\n    // For best texture data read/write performance, calculate the biggest pack/unpack alignment\n    // that fits with the provided texture row byte length\n    // Note: Any RGBA or 32 bit type will be at least 4 bytes, which should result in good performance.\n    // const info = this.device.getTextureFormatInfo(format);\n    // const rowByteLength = width * info.bytesPerPixel;\n    // if (rowByteLength % 8 === 0) return 8;\n    // if (rowByteLength % 4 === 0) return 4;\n    // if (rowByteLength % 2 === 0) return 2;\n    return 1;\n  }\n\n  /**\n   * Wraps a given texture into a framebuffer object, that can be further used\n   * to read data from the texture object.\n   */\n  _getFramebuffer() {\n    this._framebuffer ||= this.device.createFramebuffer({\n      id: `framebuffer-for-${this.id}`,\n      width: this.width,\n      height: this.height,\n      colorAttachments: [this]\n    });\n    return this._framebuffer;\n  }\n\n  // WEBGL SPECIFIC\n\n  override readDataSyncWebGL(options_: TextureReadOptions = {}): ArrayBuffer {\n    const options = this._getSupportedColorReadOptions(options_);\n    const memoryLayout = this.computeMemoryLayout(options);\n\n    // const formatInfo = getTextureFormatInfo(format);\n    // Allocate pixel array if not already available, using supplied type\n    const shaderType = convertGLDataTypeToDataType(this.glType);\n    const ArrayType = getTypedArrayConstructor(shaderType);\n    const targetArray = new ArrayType(memoryLayout.byteLength / ArrayType.BYTES_PER_ELEMENT) as\n      | Uint8Array\n      | Uint16Array\n      | Float32Array\n      | Int8Array\n      | Int16Array\n      | Int32Array\n      | Uint32Array;\n\n    this._readColorTextureLayers(options, memoryLayout, destinationByteOffset => {\n      const layerView = new ArrayType(\n        targetArray.buffer,\n        targetArray.byteOffset + destinationByteOffset,\n        memoryLayout.bytesPerImage / ArrayType.BYTES_PER_ELEMENT\n      );\n      this.gl.readPixels(\n        options.x,\n        options.y,\n        options.width,\n        options.height,\n        this.glFormat,\n        this.glType,\n        layerView\n      );\n    });\n\n    return targetArray.buffer as ArrayBuffer;\n  }\n\n  /**\n   * Iterates the requested mip/layer/slice range, reattaching the cached read framebuffer as\n   * needed before delegating the actual `readPixels()` call to the supplied callback.\n   */\n  private _readColorTextureLayers(\n    options: Required<TextureReadOptions>,\n    memoryLayout: ReturnType<Texture['computeMemoryLayout']>,\n    readLayer: (destinationByteOffset: number) => void\n  ): void {\n    const framebuffer = this._getFramebuffer();\n    const packRowLength = memoryLayout.bytesPerRow / memoryLayout.bytesPerPixel;\n    const glParameters: GLValueParameters = {\n      [GL.PACK_ALIGNMENT]: this.byteAlignment,\n      ...(packRowLength !== options.width ? {[GL.PACK_ROW_LENGTH]: packRowLength} : {})\n    };\n\n    // Note: luma.gl overrides bindFramebuffer so that we can reliably restore the previous framebuffer.\n    const prevReadBuffer = this.gl.getParameter(GL.READ_BUFFER) as GL;\n    const prevHandle = this.gl.bindFramebuffer(\n      GL.FRAMEBUFFER,\n      framebuffer.handle\n    ) as unknown as WebGLFramebuffer | null;\n\n    try {\n      this.gl.readBuffer(GL.COLOR_ATTACHMENT0);\n      withGLParameters(this.gl, glParameters, () => {\n        for (let layerIndex = 0; layerIndex < options.depthOrArrayLayers; layerIndex++) {\n          this._attachReadSubresource(framebuffer, options.mipLevel, options.z + layerIndex);\n          readLayer(layerIndex * memoryLayout.bytesPerImage);\n        }\n      });\n    } finally {\n      this.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);\n      this.gl.readBuffer(prevReadBuffer);\n    }\n  }\n\n  /**\n   * Attaches a single color subresource to the cached read framebuffer.\n   *\n   * @note Repeated attachments of the same `(mipLevel, layer)` tuple are skipped.\n   */\n  private _attachReadSubresource(\n    framebuffer: WEBGLFramebuffer,\n    mipLevel: number,\n    layer: number\n  ): void {\n    const attachmentKey = `${mipLevel}:${layer}`;\n    if (this._framebufferAttachmentKey === attachmentKey) {\n      return;\n    }\n\n    switch (this.dimension) {\n      case '2d':\n        this.gl.framebufferTexture2D(\n          GL.FRAMEBUFFER,\n          GL.COLOR_ATTACHMENT0,\n          GL.TEXTURE_2D,\n          this.handle,\n          mipLevel\n        );\n        break;\n\n      case 'cube':\n        this.gl.framebufferTexture2D(\n          GL.FRAMEBUFFER,\n          GL.COLOR_ATTACHMENT0,\n          getWebGLCubeFaceTarget(this.glTarget, this.dimension, layer),\n          this.handle,\n          mipLevel\n        );\n        break;\n\n      case '2d-array':\n      case '3d':\n        this.gl.framebufferTextureLayer(\n          GL.FRAMEBUFFER,\n          GL.COLOR_ATTACHMENT0,\n          this.handle,\n          mipLevel,\n          layer\n        );\n        break;\n\n      default:\n        throw new Error(`${this} color readback does not support ${this.dimension} textures`);\n    }\n\n    if (this.device.props.debug) {\n      const status = Number(this.gl.checkFramebufferStatus(GL.FRAMEBUFFER));\n      if (status !== Number(GL.FRAMEBUFFER_COMPLETE)) {\n        throw new Error(`${framebuffer} incomplete for ${this} readback (${status})`);\n      }\n    }\n\n    this._framebufferAttachmentKey = attachmentKey;\n  }\n\n  /**\n   * @note - this is used by the DynamicTexture class to generate mipmaps on WebGL\n   */\n  override generateMipmapsWebGL(options?: {force?: boolean}): void {\n    const isFilterableAndRenderable =\n      this.device.isTextureFormatRenderable(this.props.format) &&\n      this.device.isTextureFormatFilterable(this.props.format);\n    if (!isFilterableAndRenderable) {\n      log.warn(`${this} is not renderable or filterable, may not be able to generate mipmaps`)();\n      if (!options?.force) {\n        return;\n      }\n    }\n\n    try {\n      this.gl.bindTexture(this.glTarget, this.handle);\n      this.gl.generateMipmap(this.glTarget);\n    } catch (error) {\n      log.warn(`Error generating mipmap for ${this}: ${(error as Error).message}`)();\n    } finally {\n      this.gl.bindTexture(this.glTarget, null);\n    }\n  }\n\n  // INTERNAL\n\n  /**\n   * Sets sampler parameters on texture\n   */\n  _setSamplerParameters(parameters: GLSamplerParameters): void {\n    log.log(2, `${this.id} sampler parameters`, this.device.getGLKeys(parameters))();\n\n    this.gl.bindTexture(this.glTarget, this.handle);\n\n    for (const [pname, pvalue] of Object.entries(parameters)) {\n      const param = Number(pname) as keyof GLSamplerParameters;\n      const value = pvalue;\n\n      // Apparently integer/float issues require two different texture parameter setting functions in JavaScript.\n      // For now, pick the float version for parameters specified as GLfloat.\n      switch (param) {\n        case GL.TEXTURE_MIN_LOD:\n        case GL.TEXTURE_MAX_LOD:\n          this.gl.texParameterf(this.glTarget, param, value);\n          break;\n\n        case GL.TEXTURE_MAG_FILTER:\n        case GL.TEXTURE_MIN_FILTER:\n          this.gl.texParameteri(this.glTarget, param, value);\n          break;\n\n        case GL.TEXTURE_WRAP_S:\n        case GL.TEXTURE_WRAP_T:\n        case GL.TEXTURE_WRAP_R:\n          this.gl.texParameteri(this.glTarget, param, value);\n          break;\n\n        case GL.TEXTURE_MAX_ANISOTROPY_EXT:\n          // We have to query feature before using it\n          if (this.device.features.has('texture-filterable-anisotropic-webgl')) {\n            this.gl.texParameteri(this.glTarget, param, value);\n          }\n          break;\n\n        case GL.TEXTURE_COMPARE_MODE:\n        case GL.TEXTURE_COMPARE_FUNC:\n          this.gl.texParameteri(this.glTarget, param, value);\n          break;\n      }\n    }\n\n    this.gl.bindTexture(this.glTarget, null);\n  }\n\n  _getActiveUnit(): number {\n    return this.gl.getParameter(GL.ACTIVE_TEXTURE) - GL.TEXTURE0;\n  }\n\n  _bind(_textureUnit?: number): number {\n    const {gl} = this;\n\n    if (_textureUnit !== undefined) {\n      this._textureUnit = _textureUnit;\n      gl.activeTexture(gl.TEXTURE0 + _textureUnit);\n    }\n\n    gl.bindTexture(this.glTarget, this.handle);\n    // @ts-ignore TODO fix types\n    return _textureUnit;\n  }\n\n  _unbind(_textureUnit?: number): number | undefined {\n    const {gl} = this;\n\n    if (_textureUnit !== undefined) {\n      this._textureUnit = _textureUnit;\n      gl.activeTexture(gl.TEXTURE0 + _textureUnit);\n    }\n\n    gl.bindTexture(this.glTarget, null);\n    return _textureUnit;\n  }\n}\n\nfunction getArrayBufferView(typedArray: ArrayBufferView, byteOffset = 0): ArrayBufferView {\n  if (!byteOffset) {\n    return typedArray;\n  }\n\n  return new typedArray.constructor(\n    typedArray.buffer,\n    typedArray.byteOffset + byteOffset,\n    (typedArray.byteLength - byteOffset) / typedArray.BYTES_PER_ELEMENT\n  ) as ArrayBufferView;\n}\n\nfunction getWebGLTextureSourceElementOffset(\n  typedArray: ArrayBufferView,\n  byteOffset: number\n): number {\n  if (byteOffset % typedArray.BYTES_PER_ELEMENT !== 0) {\n    throw new Error(\n      `Texture byteOffset ${byteOffset} must align to typed array element size ${typedArray.BYTES_PER_ELEMENT}`\n    );\n  }\n\n  return byteOffset / typedArray.BYTES_PER_ELEMENT;\n}\n\n// INTERNAL HELPERS\n\n/** Convert a WebGPU style texture constant to a WebGL style texture constant */\nexport function getWebGLTextureTarget(\n  dimension: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d'\n): GLTextureTarget {\n  // biome-ignore format: preserve layout\n  switch (dimension) {\n    case '1d': break; // not supported in any WebGL version\n    case '2d': return GL.TEXTURE_2D; // supported in WebGL1\n    case '3d': return GL.TEXTURE_3D; // supported in WebGL2\n    case 'cube': return GL.TEXTURE_CUBE_MAP; // supported in WebGL1\n    case '2d-array': return GL.TEXTURE_2D_ARRAY; // supported in WebGL2\n    case 'cube-array': break; // not supported in any WebGL version\n  }\n  throw new Error(dimension);\n}\n\n/**\n * In WebGL, cube maps specify faces by overriding target instead of using the depth parameter.\n * @note We still bind the texture using GL.TEXTURE_CUBE_MAP, but we need to use the face-specific target when setting mip levels.\n * @returns glTarget unchanged, if dimension !== 'cube'.\n */\nexport function getWebGLCubeFaceTarget(\n  glTarget: GLTextureTarget,\n  dimension: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d',\n  level: number\n): GLTextureTarget | GLTextureCubeMapTarget {\n  return dimension === 'cube' ? GL.TEXTURE_CUBE_MAP_POSITIVE_X + level : glTarget;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable */\n\n// Uniforms\nimport type {UniformValue} from '@luma.gl/core';\nimport {GL, GLUniformType, GLSamplerType} from '@luma.gl/webgl/constants';\n\n/** Set a raw uniform (without type conversion and caching) */\n/* eslint-disable max-len */\nexport function setUniform(\n  gl: WebGL2RenderingContext,\n  location: WebGLUniformLocation,\n  type: GLUniformType | GLSamplerType,\n  value: UniformValue\n): void {\n  const gl2 = gl as WebGL2RenderingContext;\n\n  // Prepare the value for WebGL setters\n  let uniformValue = value;\n  if (uniformValue === true) {\n    uniformValue = 1;\n  }\n  if (uniformValue === false) {\n    uniformValue = 0;\n  }\n  const arrayValue = typeof uniformValue === 'number' ? [uniformValue] : uniformValue;\n\n  // biome-ignore format: preserve layout\n  switch (type) {\n    case GL.SAMPLER_2D:\n    case GL.SAMPLER_CUBE:\n    case GL.SAMPLER_3D:\n    case GL.SAMPLER_2D_SHADOW:\n    case GL.SAMPLER_2D_ARRAY:\n    case GL.SAMPLER_2D_ARRAY_SHADOW:\n    case GL.SAMPLER_CUBE_SHADOW:\n    case GL.INT_SAMPLER_2D:\n    case GL.INT_SAMPLER_3D:\n    case GL.INT_SAMPLER_CUBE:\n    case GL.INT_SAMPLER_2D_ARRAY:\n    case GL.UNSIGNED_INT_SAMPLER_2D:\n    case GL.UNSIGNED_INT_SAMPLER_3D:\n    case GL.UNSIGNED_INT_SAMPLER_CUBE:\n    case GL.UNSIGNED_INT_SAMPLER_2D_ARRAY:\n      if (typeof value !== 'number') {\n        throw new Error('samplers must be set to integers');\n      }\n      return gl.uniform1i(location, value);\n\n    case GL.FLOAT: return gl.uniform1fv(location, arrayValue);\n    case GL.FLOAT_VEC2: return gl.uniform2fv(location, arrayValue);\n    case GL.FLOAT_VEC3: return gl.uniform3fv(location, arrayValue);\n    case GL.FLOAT_VEC4: return gl.uniform4fv(location, arrayValue);\n\n    case GL.INT: return gl.uniform1iv(location, arrayValue);\n    case GL.INT_VEC2: return gl.uniform2iv(location, arrayValue);\n    case GL.INT_VEC3: return gl.uniform3iv(location, arrayValue);\n    case GL.INT_VEC4: return gl.uniform4iv(location, arrayValue);\n\n    case GL.BOOL: return gl.uniform1iv(location, arrayValue);\n    case GL.BOOL_VEC2: return gl.uniform2iv(location, arrayValue);\n    case GL.BOOL_VEC3: return gl.uniform3iv(location, arrayValue);\n    case GL.BOOL_VEC4: return gl.uniform4iv(location, arrayValue);\n\n    // WEBGL2 - unsigned integers\n    case GL.UNSIGNED_INT: return gl2.uniform1uiv(location, arrayValue, 1);\n    case GL.UNSIGNED_INT_VEC2: return gl2.uniform2uiv(location, arrayValue, 2);\n    case GL.UNSIGNED_INT_VEC3: return gl2.uniform3uiv(location, arrayValue, 3);\n    case GL.UNSIGNED_INT_VEC4: return gl2.uniform4uiv(location, arrayValue, 4);\n\n    // WebGL2 - quadratic matrices\n    // false: don't transpose the matrix\n    case GL.FLOAT_MAT2: return gl.uniformMatrix2fv(location, false, arrayValue);\n    case GL.FLOAT_MAT3: return gl.uniformMatrix3fv(location, false, arrayValue);\n    case GL.FLOAT_MAT4: return gl.uniformMatrix4fv(location, false, arrayValue);\n\n    // WebGL2 - rectangular matrices\n    case GL.FLOAT_MAT2x3: return gl2.uniformMatrix2x3fv(location, false, arrayValue);\n    case GL.FLOAT_MAT2x4: return gl2.uniformMatrix2x4fv(location, false, arrayValue);\n    case GL.FLOAT_MAT3x2: return gl2.uniformMatrix3x2fv(location, false, arrayValue);\n    case GL.FLOAT_MAT3x4: return gl2.uniformMatrix3x4fv(location, false, arrayValue);\n    case GL.FLOAT_MAT4x2: return gl2.uniformMatrix4x2fv(location, false, arrayValue);\n    case GL.FLOAT_MAT4x3: return gl2.uniformMatrix4x3fv(location, false, arrayValue);\n  }\n\n  throw new Error('Illegal uniform');\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {GL, GLPrimitiveTopology, GLPrimitive} from '@luma.gl/webgl/constants';\nimport {PrimitiveTopology} from '@luma.gl/core';\n\n// Counts the number of complete primitives given a number of vertices and a drawMode\nexport function getPrimitiveDrawMode(drawMode: GLPrimitiveTopology): GLPrimitive {\n  switch (drawMode) {\n    case GL.POINTS:\n      return GL.POINTS;\n    case GL.LINES:\n      return GL.LINES;\n    case GL.LINE_STRIP:\n      return GL.LINES;\n    case GL.LINE_LOOP:\n      return GL.LINES;\n    case GL.TRIANGLES:\n      return GL.TRIANGLES;\n    case GL.TRIANGLE_STRIP:\n      return GL.TRIANGLES;\n    case GL.TRIANGLE_FAN:\n      return GL.TRIANGLES;\n    default:\n      throw new Error('drawMode');\n  }\n}\n\n// Counts the number of complete \"primitives\" given a number of vertices and a drawMode\nexport function getPrimitiveCount(options: {\n  drawMode: GLPrimitiveTopology;\n  vertexCount: number;\n}): number {\n  const {drawMode, vertexCount} = options;\n  switch (drawMode) {\n    case GL.POINTS:\n    case GL.LINE_LOOP:\n      return vertexCount;\n    case GL.LINES:\n      return vertexCount / 2;\n    case GL.LINE_STRIP:\n      return vertexCount - 1;\n    case GL.TRIANGLES:\n      return vertexCount / 3;\n    case GL.TRIANGLE_STRIP:\n    case GL.TRIANGLE_FAN:\n      return vertexCount - 2;\n    default:\n      throw new Error('drawMode');\n  }\n}\n\n// Counts the number of vertices after splitting the vertex stream into separate \"primitives\"\nexport function getVertexCount(options: {\n  drawMode: GLPrimitiveTopology;\n  vertexCount: number;\n}): number {\n  const {drawMode, vertexCount} = options;\n  const primitiveCount = getPrimitiveCount({drawMode, vertexCount});\n  switch (getPrimitiveDrawMode(drawMode)) {\n    case GL.POINTS:\n      return primitiveCount;\n    case GL.LINES:\n      return primitiveCount * 2;\n    case GL.TRIANGLES:\n      return primitiveCount * 3;\n    default:\n      throw new Error('drawMode');\n  }\n}\n\n/** Get the primitive type for draw */\nexport function getGLDrawMode(\n  topology: PrimitiveTopology\n):\n  | GL.POINTS\n  | GL.LINES\n  | GL.LINE_STRIP\n  | GL.LINE_LOOP\n  | GL.TRIANGLES\n  | GL.TRIANGLE_STRIP\n  | GL.TRIANGLE_FAN {\n  // biome-ignore format: preserve layout\n  switch (topology) {\n    case 'point-list': return GL.POINTS;\n    case 'line-list': return GL.LINES;\n    case 'line-strip': return GL.LINE_STRIP;\n    case 'triangle-list': return GL.TRIANGLES;\n    case 'triangle-strip': return GL.TRIANGLE_STRIP;\n    default: throw new Error(topology);\n  }\n}\n\n/** Get the primitive type for transform feedback */\nexport function getGLPrimitive(topology: PrimitiveTopology): GL.POINTS | GL.LINES | GL.TRIANGLES {\n  // biome-ignore format: preserve layout\n  switch (topology) {\n    case 'point-list': return GL.POINTS;\n    case 'line-list': return GL.LINES;\n    case 'line-strip': return GL.LINES;\n    case 'triangle-list': return GL.TRIANGLES;\n    case 'triangle-strip': return GL.TRIANGLES;\n    default: throw new Error(topology);\n  }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {\n  RenderPipelineProps,\n  RenderPipelineParameters,\n  PrimitiveTopology,\n  ShaderLayout,\n  UniformValue,\n  Bindings,\n  BindingsByGroup,\n  RenderPass,\n  VertexArray\n} from '@luma.gl/core';\nimport {RenderPipeline, flattenBindingsByGroup, log, normalizeBindingsByGroup} from '@luma.gl/core';\n// import {getAttributeInfosFromLayouts} from '@luma.gl/core';\nimport {GL} from '@luma.gl/webgl/constants';\n\nimport {withDeviceAndGLParameters} from '../converters/device-parameters';\nimport {setUniform} from '../helpers/set-uniform';\n// import {copyUniform, checkUniformValues} from '../../classes/uniforms';\n\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from './webgl-buffer';\nimport {WEBGLShader} from './webgl-shader';\nimport {WEBGLFramebuffer} from './webgl-framebuffer';\nimport {WEBGLTexture} from './webgl-texture';\nimport {WEBGLTextureView} from './webgl-texture-view';\nimport {WEBGLRenderPass} from './webgl-render-pass';\nimport {WEBGLTransformFeedback} from './webgl-transform-feedback';\nimport {getGLDrawMode} from '../helpers/webgl-topology-utils';\nimport {WEBGLSharedRenderPipeline} from './webgl-shared-render-pipeline';\n\n/** Creates a new render pipeline */\nexport class WEBGLRenderPipeline extends RenderPipeline {\n  /** The WebGL device that created this render pipeline */\n  readonly device: WebGLDevice;\n  /** Handle to underlying WebGL program */\n  readonly handle: WebGLProgram;\n  /** vertex shader */\n  vs: WEBGLShader;\n  /** fragment shader */\n  fs: WEBGLShader;\n  /** The layout extracted from shader by WebGL introspection APIs */\n  introspectedLayout: ShaderLayout;\n\n  /** Compatibility path for direct pipeline.setBindings() usage */\n  bindings: Bindings = {};\n  /** Compatibility path for direct pipeline.uniforms usage */\n  uniforms: Record<string, UniformValue> = {};\n  /** WebGL varyings */\n  varyings: string[] | null = null;\n\n  _uniformCount: number = 0;\n  _uniformSetters: Record<string, Function> = {}; // TODO are these used?\n\n  override get [Symbol.toStringTag]() {\n    return 'WEBGLRenderPipeline';\n  }\n\n  constructor(device: WebGLDevice, props: RenderPipelineProps) {\n    super(device, props);\n    this.device = device;\n    const webglSharedRenderPipeline =\n      (this.sharedRenderPipeline as WEBGLSharedRenderPipeline | null) ||\n      (this.device._createSharedRenderPipelineWebGL(props) as WEBGLSharedRenderPipeline);\n\n    this.sharedRenderPipeline = webglSharedRenderPipeline;\n    this.handle = webglSharedRenderPipeline.handle;\n    this.vs = webglSharedRenderPipeline.vs;\n    this.fs = webglSharedRenderPipeline.fs;\n    this.linkStatus = webglSharedRenderPipeline.linkStatus;\n    this.introspectedLayout = webglSharedRenderPipeline.introspectedLayout;\n    this.device._setWebGLDebugMetadata(this.handle, this, {spector: {id: this.props.id}});\n\n    // WebGL only honors shaderLayout overrides for attributes that already exist in the\n    // linked program, and only the `type` / `stepMode` fields participate in the merge.\n    // Bindings and unknown attributes are ignored. If WebGL cache keys ever depend on\n    // `shaderLayout`, they need to match these merge semantics rather than the raw prop.\n    this.shaderLayout = props.shaderLayout\n      ? mergeShaderLayout(this.introspectedLayout, props.shaderLayout)\n      : this.introspectedLayout;\n  }\n\n  override destroy(): void {\n    if (this.destroyed) {\n      return;\n    }\n    if (this.sharedRenderPipeline && !this.props._sharedRenderPipeline) {\n      this.sharedRenderPipeline.destroy();\n    }\n    this.destroyResource();\n  }\n\n  /**\n   * Compatibility shim for code paths that still set bindings on the pipeline.\n   * Shared-model draws pass bindings per draw and do not rely on this state.\n   */\n  setBindings(bindings: Bindings | BindingsByGroup, options?: {disableWarnings?: boolean}): void {\n    const flatBindings = flattenBindingsByGroup(\n      normalizeBindingsByGroup(this.shaderLayout, bindings)\n    );\n    for (const [name, value] of Object.entries(flatBindings)) {\n      const binding = getShaderLayoutBindingByName(this.shaderLayout, name);\n\n      if (!binding) {\n        const validBindings = this.shaderLayout.bindings\n          .map(binding_ => `\"${binding_.name}\"`)\n          .join(', ');\n        if (!options?.disableWarnings) {\n          log.warn(\n            `No binding \"${name}\" in render pipeline \"${this.id}\", expected one of ${validBindings}`,\n            value\n          )();\n        }\n      } else {\n        if (!value) {\n          log.warn(`Unsetting binding \"${name}\" in render pipeline \"${this.id}\"`)();\n        }\n        switch (binding.type) {\n          case 'uniform':\n            // @ts-expect-error\n            if (!(value instanceof WEBGLBuffer) && !(value.buffer instanceof WEBGLBuffer)) {\n              throw new Error('buffer value');\n            }\n            break;\n          case 'texture':\n            if (\n              !(\n                value instanceof WEBGLTextureView ||\n                value instanceof WEBGLTexture ||\n                value instanceof WEBGLFramebuffer\n              )\n            ) {\n              throw new Error(`${this} Bad texture binding for ${name}`);\n            }\n            break;\n          case 'sampler':\n            log.warn(`Ignoring sampler ${name}`)();\n            break;\n          default:\n            throw new Error(binding.type);\n        }\n\n        this.bindings[name] = value;\n      }\n    }\n  }\n\n  /** @todo needed for portable model\n   * @note The WebGL API is offers many ways to draw things\n   * This function unifies those ways into a single call using common parameters with sane defaults\n   */\n  draw(options: {\n    renderPass: RenderPass;\n    parameters?: RenderPipelineParameters;\n    topology?: PrimitiveTopology;\n    vertexArray: VertexArray;\n    isInstanced?: boolean;\n    vertexCount?: number;\n    indexCount?: number;\n    instanceCount?: number;\n    firstVertex?: number;\n    firstIndex?: number;\n    firstInstance?: number;\n    baseVertex?: number;\n    transformFeedback?: WEBGLTransformFeedback;\n    bindings?: Bindings;\n    bindGroups?: BindingsByGroup;\n    _bindGroupCacheKeys?: Partial<Record<number, object>>;\n    uniforms?: Record<string, UniformValue>;\n  }): boolean {\n    this._syncLinkStatus();\n    const drawBindings = options.bindGroups\n      ? flattenBindingsByGroup(options.bindGroups)\n      : options.bindings || this.bindings;\n\n    const {\n      renderPass,\n      parameters = this.props.parameters,\n      topology = this.props.topology,\n      vertexArray,\n      vertexCount,\n      // indexCount,\n      instanceCount,\n      isInstanced = false,\n      firstVertex = 0,\n      // firstIndex,\n      // firstInstance,\n      // baseVertex,\n      transformFeedback,\n      uniforms = this.uniforms\n    } = options;\n\n    const glDrawMode = getGLDrawMode(topology);\n    const isIndexed: boolean = Boolean(vertexArray.indexBuffer);\n    const glIndexType = (vertexArray.indexBuffer as WEBGLBuffer)?.glIndexType;\n    // Note that we sometimes get called with 0 instances\n\n    // If we are using async linking, we need to wait until linking completes\n    if (this.linkStatus !== 'success') {\n      log.info(2, `RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)();\n      return false;\n    }\n\n    // Avoid WebGL draw call when not rendering any data or values are incomplete\n    // Note: async textures set as uniforms might still be loading.\n    // Now that all uniforms have been updated, check if any texture\n    // in the uniforms is not yet initialized, then we don't draw\n    if (!this._areTexturesRenderable(drawBindings)) {\n      log.info(2, `RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)();\n      //  Note: false means that the app needs to redraw the pipeline again.\n      return false;\n    }\n\n    // (isInstanced && instanceCount === 0)\n    // if (vertexCount === 0) {\n    //   log.info(2, `RenderPipeline:${this.id}.draw() aborted - no vertices to draw`)();\n    //   Note: false means that the app needs to redraw the pipeline again.\n    //   return true;\n    // }\n\n    this.device.gl.useProgram(this.handle);\n\n    // Note: Rebinds constant attributes before each draw call\n    vertexArray.bindBeforeRender(renderPass);\n\n    if (transformFeedback) {\n      transformFeedback.begin(this.props.topology);\n    }\n\n    // We have to apply bindings before every draw call since other draw calls will overwrite\n    this._applyBindings(drawBindings, {disableWarnings: this.props.disableWarnings});\n    this._applyUniforms(uniforms);\n\n    const webglRenderPass = renderPass as WEBGLRenderPass;\n\n    withDeviceAndGLParameters(this.device, parameters, webglRenderPass.glParameters, () => {\n      if (isIndexed && isInstanced) {\n        this.device.gl.drawElementsInstanced(\n          glDrawMode,\n          vertexCount || 0, // indexCount?\n          glIndexType,\n          firstVertex,\n          instanceCount || 0\n        );\n        // } else if (isIndexed && this.device.isWebGL2 && !isNaN(start) && !isNaN(end)) {\n        //   this.device.gldrawRangeElements(glDrawMode, start, end, vertexCount, glIndexType, offset);\n      } else if (isIndexed) {\n        this.device.gl.drawElements(glDrawMode, vertexCount || 0, glIndexType, firstVertex); // indexCount?\n      } else if (isInstanced) {\n        this.device.gl.drawArraysInstanced(\n          glDrawMode,\n          firstVertex,\n          vertexCount || 0,\n          instanceCount || 0\n        );\n      } else {\n        this.device.gl.drawArrays(glDrawMode, firstVertex, vertexCount || 0);\n      }\n\n      if (transformFeedback) {\n        transformFeedback.end();\n      }\n    });\n\n    vertexArray.unbindAfterRender(renderPass);\n\n    return true;\n  }\n\n  /**\n   * Checks if all texture-values uniforms are renderable (i.e. loaded)\n   * Update a texture if needed (e.g. from video)\n   * Note: This is currently done before every draw call\n   */\n  _areTexturesRenderable(bindings: Bindings) {\n    let texturesRenderable = true;\n\n    for (const bindingInfo of this.shaderLayout.bindings) {\n      if (!getBindingValueForLayoutBinding(bindings, bindingInfo.name)) {\n        log.warn(`Binding ${bindingInfo.name} not found in ${this.id}`)();\n        texturesRenderable = false;\n      }\n    }\n\n    // TODO - remove this should be handled by ExternalTexture\n    // for (const [, texture] of Object.entries(this.bindings)) {\n    //   if (texture instanceof WEBGLTexture) {\n    //     texture.update();\n    //   }\n    // }\n\n    return texturesRenderable;\n  }\n\n  /** Apply any bindings (before each draw call) */\n  _applyBindings(bindings: Bindings, _options?: {disableWarnings?: boolean}) {\n    this._syncLinkStatus();\n\n    // If we are using async linking, we need to wait until linking completes\n    if (this.linkStatus !== 'success') {\n      return;\n    }\n\n    const {gl} = this.device;\n    gl.useProgram(this.handle);\n\n    let textureUnit = 0;\n    let uniformBufferIndex = 0;\n    for (const binding of this.shaderLayout.bindings) {\n      const value = getBindingValueForLayoutBinding(bindings, binding.name);\n      if (!value) {\n        throw new Error(`No value for binding ${binding.name} in ${this.id}`);\n      }\n      switch (binding.type) {\n        case 'uniform':\n          // Set buffer\n          const {name} = binding;\n          const location = gl.getUniformBlockIndex(this.handle, name);\n          if ((location as GL) === GL.INVALID_INDEX) {\n            throw new Error(`Invalid uniform block name ${name}`);\n          }\n          gl.uniformBlockBinding(this.handle, location, uniformBufferIndex);\n          if (value instanceof WEBGLBuffer) {\n            gl.bindBufferBase(GL.UNIFORM_BUFFER, uniformBufferIndex, value.handle);\n          } else {\n            const bufferBinding = value as {buffer: WEBGLBuffer; offset?: number; size?: number};\n            gl.bindBufferRange(\n              GL.UNIFORM_BUFFER,\n              uniformBufferIndex,\n              bufferBinding.buffer.handle,\n              bufferBinding.offset || 0,\n              bufferBinding.size || bufferBinding.buffer.byteLength - (bufferBinding.offset || 0)\n            );\n          }\n          uniformBufferIndex += 1;\n          break;\n\n        case 'texture':\n          if (\n            !(\n              value instanceof WEBGLTextureView ||\n              value instanceof WEBGLTexture ||\n              value instanceof WEBGLFramebuffer\n            )\n          ) {\n            throw new Error('texture');\n          }\n          let texture: WEBGLTexture;\n          if (value instanceof WEBGLTextureView) {\n            texture = value.texture;\n          } else if (value instanceof WEBGLTexture) {\n            texture = value;\n          } else if (\n            value instanceof WEBGLFramebuffer &&\n            value.colorAttachments[0] instanceof WEBGLTextureView\n          ) {\n            log.warn(\n              'Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead'\n            )();\n            texture = value.colorAttachments[0].texture;\n          } else {\n            throw new Error('No texture');\n          }\n\n          gl.activeTexture(GL.TEXTURE0 + textureUnit);\n          gl.bindTexture(texture.glTarget, texture.handle);\n          // gl.bindSampler(textureUnit, sampler.handle);\n          textureUnit += 1;\n          break;\n\n        case 'sampler':\n          // ignore\n          break;\n\n        case 'storage':\n        case 'read-only-storage':\n          throw new Error(`binding type '${binding.type}' not supported in WebGL`);\n      }\n    }\n  }\n\n  /**\n   * Due to program sharing, uniforms need to be reset before every draw call\n   * (though caching will avoid redundant WebGL calls)\n   */\n  _applyUniforms(uniforms: Record<string, UniformValue>) {\n    for (const uniformLayout of this.shaderLayout.uniforms || []) {\n      const {name, location, type, textureUnit} = uniformLayout;\n      const value = uniforms[name] ?? textureUnit;\n      if (value !== undefined) {\n        setUniform(this.device.gl, location, type, value);\n      }\n    }\n  }\n\n  private _syncLinkStatus(): void {\n    this.linkStatus = (this.sharedRenderPipeline as WEBGLSharedRenderPipeline).linkStatus;\n  }\n}\n\n/**\n * Merges an provided shader layout into a base shader layout\n * In WebGL, this allows the auto generated shader layout to be overridden by the application\n * Typically to change the format of the vertex attributes (from float32x4 to uint8x4 etc).\n * @todo Drop this? Aren't all use cases covered by mergeBufferLayout()?\n */\nfunction mergeShaderLayout(baseLayout: ShaderLayout, overrideLayout: ShaderLayout): ShaderLayout {\n  // Deep clone the base layout\n  const mergedLayout: ShaderLayout = {\n    ...baseLayout,\n    attributes: baseLayout.attributes.map(attribute => ({...attribute})),\n    bindings: baseLayout.bindings.map(binding => ({...binding}))\n  };\n  // Merge the attributes\n  for (const attribute of overrideLayout?.attributes || []) {\n    const baseAttribute = mergedLayout.attributes.find(attr => attr.name === attribute.name);\n    if (!baseAttribute) {\n      log.warn(`shader layout attribute ${attribute.name} not present in shader`);\n    } else {\n      baseAttribute.type = attribute.type || baseAttribute.type;\n      baseAttribute.stepMode = attribute.stepMode || baseAttribute.stepMode;\n    }\n  }\n\n  for (const binding of overrideLayout?.bindings || []) {\n    const baseBinding = getShaderLayoutBindingByName(mergedLayout, binding.name);\n    if (!baseBinding) {\n      log.warn(`shader layout binding ${binding.name} not present in shader`);\n      continue;\n    }\n    Object.assign(baseBinding, binding);\n  }\n  return mergedLayout;\n}\n\nfunction getShaderLayoutBindingByName(\n  shaderLayout: ShaderLayout,\n  bindingName: string\n): ShaderLayout['bindings'][number] | undefined {\n  return shaderLayout.bindings.find(\n    binding =>\n      binding.name === bindingName ||\n      binding.name === `${bindingName}Uniforms` ||\n      `${binding.name}Uniforms` === bindingName\n  );\n}\n\nfunction getBindingValueForLayoutBinding(\n  bindings: Bindings,\n  bindingName: string\n): Bindings[string] | undefined {\n  return (\n    bindings[bindingName] ||\n    bindings[`${bindingName}Uniforms`] ||\n    bindings[bindingName.replace(/Uniforms$/, '')]\n  );\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {VariableShaderType, SignedDataType, VertexFormat, NormalizedDataType} from '@luma.gl/core';\nimport {GL, GLUniformType, GLSamplerType, GLDataType} from '@luma.gl/webgl/constants';\n\nexport type TextureBindingInfo = {\n  viewDimension: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n  sampleType: 'float' | 'unfilterable-float' | 'depth' | 'sint' | 'uint';\n};\n\n/** Converts to a luma shadertype to a GL data type (GL.BYTE, GL.FLOAT32 etc)  */\nexport function convertDataTypeToGLDataType(normalizedType: NormalizedDataType): GLDataType {\n  return NORMALIZED_SHADER_TYPE_TO_WEBGL[normalizedType];\n}\n\n/** Convert a WebGL \"compisite type (e.g. GL.VEC3) into the corresponding luma shader uniform type */\nexport function convertGLUniformTypeToShaderVariableType(\n  glUniformType: GLUniformType\n): VariableShaderType {\n  return WEBGL_SHADER_TYPES[glUniformType];\n}\n\n/** Check if a WebGL \"uniform:\" is a texture binding */\nexport function isGLSamplerType(type: GLUniformType | GLSamplerType): type is GLSamplerType {\n  // @ts-ignore TODO\n  return Boolean(WEBGL_SAMPLER_TO_TEXTURE_BINDINGS[type]);\n}\n\n/* Get luma texture binding info (viewDimension and sampleType) from a WebGL \"sampler\" binding */\nexport function getTextureBindingFromGLSamplerType(\n  glSamplerType: GLSamplerType\n): TextureBindingInfo {\n  return WEBGL_SAMPLER_TO_TEXTURE_BINDINGS[glSamplerType];\n}\n\n/** Get vertex format from GL constants */\nexport function getVertexFormatFromGL(type: GLDataType, components: 1 | 2 | 3 | 4): VertexFormat {\n  const base = getVertexTypeFromGL(type);\n  // biome-ignore format: preserve layout\n  switch (components) {\n    case 1: return base;\n    case 2: return `${base}x2`;\n    // @ts-expect-error - deal with lack of \"unaligned\" formats\n    case 3: return `${base}x3`;\n    case 4: return `${base}x4`;\n  }\n  // @ts-ignore unreachable\n  throw new Error(String(components));\n}\n\n/** Get data type from GL constants */\nexport function getVertexTypeFromGL(glType: GLDataType, normalized = false): NormalizedDataType {\n  const index = normalized ? 1 : 0;\n  return WEBGL_TO_NORMALIZED_DATA_TYPE[glType][index];\n}\n\n// Composite types table\n// @ts-ignore TODO - fix the type confusion here\nconst WEBGL_SHADER_TYPES: Record<GLUniformType, VariableShaderType> = {\n  [GL.FLOAT]: 'f32',\n  [GL.FLOAT_VEC2]: 'vec2<f32>',\n  [GL.FLOAT_VEC3]: 'vec3<f32>',\n  [GL.FLOAT_VEC4]: 'vec4<f32>',\n\n  [GL.INT]: 'i32',\n  [GL.INT_VEC2]: 'vec2<i32>',\n  [GL.INT_VEC3]: 'vec3<i32>',\n  [GL.INT_VEC4]: 'vec4<i32>',\n\n  [GL.UNSIGNED_INT]: 'u32',\n  [GL.UNSIGNED_INT_VEC2]: 'vec2<u32>',\n  [GL.UNSIGNED_INT_VEC3]: 'vec3<u32>',\n  [GL.UNSIGNED_INT_VEC4]: 'vec4<u32>',\n\n  [GL.BOOL]: 'f32',\n  [GL.BOOL_VEC2]: 'vec2<f32>',\n  [GL.BOOL_VEC3]: 'vec3<f32>',\n  [GL.BOOL_VEC4]: 'vec4<f32>',\n\n  // TODO - are sizes/components below correct?\n  [GL.FLOAT_MAT2]: 'mat2x2<f32>',\n  [GL.FLOAT_MAT2x3]: 'mat2x3<f32>',\n  [GL.FLOAT_MAT2x4]: 'mat2x4<f32>',\n\n  [GL.FLOAT_MAT3x2]: 'mat3x2<f32>',\n  [GL.FLOAT_MAT3]: 'mat3x3<f32>',\n  [GL.FLOAT_MAT3x4]: 'mat3x4<f32>',\n\n  [GL.FLOAT_MAT4x2]: 'mat4x2<f32>',\n  [GL.FLOAT_MAT4x3]: 'mat4x3<f32>',\n  [GL.FLOAT_MAT4]: 'mat4x4<f32>'\n};\n\nconst WEBGL_SAMPLER_TO_TEXTURE_BINDINGS: Record<GLSamplerType, TextureBindingInfo> = {\n  [GL.SAMPLER_2D]: {viewDimension: '2d', sampleType: 'float'},\n  [GL.SAMPLER_CUBE]: {viewDimension: 'cube', sampleType: 'float'},\n  [GL.SAMPLER_3D]: {viewDimension: '3d', sampleType: 'float'},\n  [GL.SAMPLER_2D_SHADOW]: {viewDimension: '3d', sampleType: 'depth'},\n  [GL.SAMPLER_2D_ARRAY]: {viewDimension: '2d-array', sampleType: 'float'},\n  [GL.SAMPLER_2D_ARRAY_SHADOW]: {viewDimension: '2d-array', sampleType: 'depth'},\n  [GL.SAMPLER_CUBE_SHADOW]: {viewDimension: 'cube', sampleType: 'float'},\n  [GL.INT_SAMPLER_2D]: {viewDimension: '2d', sampleType: 'sint'},\n  [GL.INT_SAMPLER_3D]: {viewDimension: '3d', sampleType: 'sint'},\n  [GL.INT_SAMPLER_CUBE]: {viewDimension: 'cube', sampleType: 'sint'},\n  [GL.INT_SAMPLER_2D_ARRAY]: {viewDimension: '2d-array', sampleType: 'uint'},\n  [GL.UNSIGNED_INT_SAMPLER_2D]: {viewDimension: '2d', sampleType: 'uint'},\n  [GL.UNSIGNED_INT_SAMPLER_3D]: {viewDimension: '3d', sampleType: 'uint'},\n  [GL.UNSIGNED_INT_SAMPLER_CUBE]: {viewDimension: 'cube', sampleType: 'uint'},\n  [GL.UNSIGNED_INT_SAMPLER_2D_ARRAY]: {viewDimension: '2d-array', sampleType: 'uint'}\n};\n\n/** Map from WebGL normalized types to WebGL */\nconst NORMALIZED_SHADER_TYPE_TO_WEBGL: Record<NormalizedDataType, GLDataType> = {\n  uint8: GL.UNSIGNED_BYTE,\n  sint8: GL.BYTE,\n  unorm8: GL.UNSIGNED_BYTE,\n  snorm8: GL.BYTE,\n  uint16: GL.UNSIGNED_SHORT,\n  sint16: GL.SHORT,\n  unorm16: GL.UNSIGNED_SHORT,\n  snorm16: GL.SHORT,\n  uint32: GL.UNSIGNED_INT,\n  sint32: GL.INT,\n  // WebGPU does not support normalized 32 bit integer attributes\n  //  'unorm32': GL.UNSIGNED_INT,\n  //  'snorm32': GL.INT,\n  float16: GL.HALF_FLOAT,\n  float32: GL.FLOAT\n};\n\n/* Map from WebGL types to webgpu normalized types */\nconst WEBGL_TO_NORMALIZED_DATA_TYPE: Record<GLDataType, [SignedDataType, NormalizedDataType]> = {\n  [GL.BYTE]: ['sint8', 'snorm16'],\n  [GL.UNSIGNED_BYTE]: ['uint8', 'unorm8'],\n  [GL.SHORT]: ['sint16', 'unorm16'],\n  [GL.UNSIGNED_SHORT]: ['uint16', 'unorm16'],\n  [GL.INT]: ['sint32', 'sint32'],\n  [GL.UNSIGNED_INT]: ['uint32', 'uint32'],\n  [GL.FLOAT]: ['float32', 'float32'],\n  [GL.HALF_FLOAT]: ['float16', 'float16']\n};\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {\n  ShaderLayout,\n  UniformBinding,\n  UniformBlockBinding,\n  AttributeDeclaration,\n  VaryingBinding,\n  AttributeShaderType\n} from '@luma.gl/core';\nimport {getVariableShaderTypeInfo, assertDefined, log} from '@luma.gl/core';\n\nimport {GL, GLUniformType} from '@luma.gl/webgl/constants';\nimport {\n  isGLSamplerType,\n  getTextureBindingFromGLSamplerType,\n  convertGLUniformTypeToShaderVariableType\n} from '../converters/webgl-shadertypes';\n\n/**\n * Extract metadata describing binding information for a program's shaders\n * Note: `linkProgram()` needs to have been called\n * (although linking does not need to have been successful).\n */\nexport function getShaderLayoutFromGLSL(\n  gl: WebGL2RenderingContext,\n  program: WebGLProgram\n): ShaderLayout {\n  const shaderLayout: ShaderLayout = {\n    attributes: [],\n    bindings: []\n  };\n\n  shaderLayout.attributes = readAttributeDeclarations(gl, program);\n\n  // Uniform blocks\n  const uniformBlocks: UniformBlockBinding[] = readUniformBlocks(gl, program);\n  for (const uniformBlock of uniformBlocks) {\n    const uniforms = uniformBlock.uniforms.map(uniform => ({\n      name: uniform.name,\n      format: uniform.format,\n      byteOffset: uniform.byteOffset,\n      byteStride: uniform.byteStride,\n      arrayLength: uniform.arrayLength\n    }));\n    shaderLayout.bindings.push({\n      type: 'uniform',\n      name: uniformBlock.name,\n      group: 0,\n      location: uniformBlock.location,\n      visibility: (uniformBlock.vertex ? 0x1 : 0) & (uniformBlock.fragment ? 0x2 : 0),\n      minBindingSize: uniformBlock.byteLength,\n      uniforms\n    });\n  }\n\n  const uniforms: UniformBinding[] = readUniformBindings(gl, program);\n  let textureUnit = 0;\n  for (const uniform of uniforms) {\n    if (isGLSamplerType(uniform.type)) {\n      const {viewDimension, sampleType} = getTextureBindingFromGLSamplerType(uniform.type);\n      shaderLayout.bindings.push({\n        type: 'texture',\n        name: uniform.name,\n        group: 0,\n        location: textureUnit,\n        viewDimension,\n        sampleType\n      });\n\n      // @ts-expect-error\n      uniform.textureUnit = textureUnit;\n      textureUnit += 1;\n    }\n  }\n\n  if (uniforms.length) {\n    shaderLayout.uniforms = uniforms;\n  }\n\n  // Varyings\n  const varyings: VaryingBinding[] = readVaryings(gl, program);\n  // Note - samplers are always in unform bindings, even if uniform blocks are used\n  if (varyings?.length) {\n    shaderLayout.varyings = varyings;\n  }\n\n  return shaderLayout;\n}\n\n// HELPERS\n\n/**\n * Extract info about all transform feedback varyings\n *\n * linkProgram needs to have been called, although linking does not need to have been successful\n */\nfunction readAttributeDeclarations(\n  gl: WebGL2RenderingContext,\n  program: WebGLProgram\n): AttributeDeclaration[] {\n  const attributes: AttributeDeclaration[] = [];\n\n  const count = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n  for (let index = 0; index < count; index++) {\n    const activeInfo = gl.getActiveAttrib(program, index);\n    if (!activeInfo) {\n      throw new Error('activeInfo');\n    }\n    const {name, type: compositeType /* , size*/} = activeInfo;\n    const location = gl.getAttribLocation(program, name);\n    // Add only user provided attributes, for built-in attributes like `gl_InstanceID` location will be < 0\n    if (location >= 0) {\n      const attributeType = convertGLUniformTypeToShaderVariableType(compositeType);\n\n      // Whether an attribute is instanced is essentially fixed by the structure of the shader code,\n      // so it is arguably a static property of the shader.\n      // There is no hint in the shader declarations\n      // Heuristic: Any attribute name containing the word \"instance\" will be assumed to be instanced\n      const stepMode = /instance/i.test(name) ? 'instance' : 'vertex';\n\n      attributes.push({\n        name,\n        location,\n        stepMode,\n        type: attributeType as AttributeShaderType\n        // size - for arrays, size is the number of elements in the array\n      });\n    }\n  }\n\n  // Sort by declaration order\n  attributes.sort((a: AttributeDeclaration, b: AttributeDeclaration) => a.location - b.location);\n  return attributes;\n}\n\n/**\n * Extract info about all transform feedback varyings\n *\n * linkProgram needs to have been called, although linking does not need to have been successful\n */\nfunction readVaryings(gl: WebGL2RenderingContext, program: WebGLProgram): VaryingBinding[] {\n  const varyings: VaryingBinding[] = [];\n\n  const count = gl.getProgramParameter(program, GL.TRANSFORM_FEEDBACK_VARYINGS);\n  for (let location = 0; location < count; location++) {\n    const activeInfo = gl.getTransformFeedbackVarying(program, location);\n    if (!activeInfo) {\n      throw new Error('activeInfo');\n    }\n    const {name, type: glUniformType, size} = activeInfo;\n    const uniformType = convertGLUniformTypeToShaderVariableType(glUniformType as GLUniformType);\n    const {type, components} = getVariableShaderTypeInfo(uniformType);\n    varyings.push({location, name, type, size: size * components});\n  }\n\n  varyings.sort((a, b) => a.location - b.location);\n  return varyings;\n}\n\n/**\n * Extract info about all uniforms\n *\n * Query uniform locations and build name to setter map.\n */\nfunction readUniformBindings(gl: WebGL2RenderingContext, program: WebGLProgram): UniformBinding[] {\n  const uniforms: UniformBinding[] = [];\n\n  const uniformCount = gl.getProgramParameter(program, GL.ACTIVE_UNIFORMS);\n  for (let i = 0; i < uniformCount; i++) {\n    const activeInfo = gl.getActiveUniform(program, i);\n    if (!activeInfo) {\n      throw new Error('activeInfo');\n    }\n    const {name: rawName, size, type} = activeInfo;\n    const {name, isArray} = parseUniformName(rawName);\n    let webglLocation = gl.getUniformLocation(program, name);\n    const uniformInfo = {\n      // WebGL locations are uniquely typed but just numbers\n      location: webglLocation as number,\n      name,\n      size,\n      type,\n      isArray\n    };\n    uniforms.push(uniformInfo);\n\n    // Array (e.g. matrix) uniforms can occupy several 4x4 byte banks\n    if (uniformInfo.size > 1) {\n      for (let j = 0; j < uniformInfo.size; j++) {\n        const elementName = `${name}[${j}]`;\n\n        webglLocation = gl.getUniformLocation(program, elementName);\n\n        const arrayElementUniformInfo = {\n          ...uniformInfo,\n          name: elementName,\n          location: webglLocation as number\n        };\n\n        uniforms.push(arrayElementUniformInfo);\n      }\n    }\n  }\n  return uniforms;\n}\n\n/**\n * Extract info about all \"active\" uniform blocks\n * @note In WebGL, \"active\" just means that unused (inactive) blocks may have been optimized away during linking)\n */\nfunction readUniformBlocks(\n  gl: WebGL2RenderingContext,\n  program: WebGLProgram\n): UniformBlockBinding[] {\n  const getBlockParameter = (blockIndex: number, pname: GL): any =>\n    gl.getActiveUniformBlockParameter(program, blockIndex, pname);\n\n  const uniformBlocks: UniformBlockBinding[] = [];\n\n  const blockCount = gl.getProgramParameter(program, GL.ACTIVE_UNIFORM_BLOCKS);\n  for (let blockIndex = 0; blockIndex < blockCount; blockIndex++) {\n    const blockInfo: UniformBlockBinding = {\n      name: gl.getActiveUniformBlockName(program, blockIndex) || '',\n      location: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_BINDING),\n      byteLength: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_DATA_SIZE),\n      vertex: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),\n      fragment: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),\n      uniformCount: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_ACTIVE_UNIFORMS),\n      uniforms: [] as any[]\n    };\n\n    const uniformIndices =\n      (getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES) as number[]) || [];\n\n    const uniformType = gl.getActiveUniforms(program, uniformIndices, GL.UNIFORM_TYPE); // Array of GLenum indicating the types of the uniforms.\n    const uniformArrayLength = gl.getActiveUniforms(program, uniformIndices, GL.UNIFORM_SIZE); // Array of GLuint indicating the sizes of the uniforms.\n    // const uniformBlockIndex = gl.getActiveUniforms(\n    //   program,\n    //   uniformIndices,\n    //   GL.UNIFORM_BLOCK_INDEX\n    // ); // Array of GLint indicating the block indices of the uniforms.\n    const uniformOffset = gl.getActiveUniforms(program, uniformIndices, GL.UNIFORM_OFFSET); // Array of GLint indicating the uniform buffer offsets.\n    const uniformStride = gl.getActiveUniforms(program, uniformIndices, GL.UNIFORM_ARRAY_STRIDE); // Array of GLint indicating the strides between the elements.\n    // const uniformMatrixStride = gl.getActiveUniforms(\n    //   program,\n    //   uniformIndices,\n    //   GL.UNIFORM_MATRIX_STRIDE\n    // ); // Array of GLint indicating the strides between columns of a column-major matrix or a row-major matrix.\n    // const uniformRowMajor = gl.getActiveUniforms(program, uniformIndices, GL.UNIFORM_IS_ROW_MAJOR);\n    for (let i = 0; i < blockInfo.uniformCount; ++i) {\n      const uniformIndex = uniformIndices[i];\n      if (uniformIndex !== undefined) {\n        const activeInfo = gl.getActiveUniform(program, uniformIndex);\n        if (!activeInfo) {\n          throw new Error('activeInfo');\n        }\n\n        const format = convertGLUniformTypeToShaderVariableType(uniformType[i]);\n\n        blockInfo.uniforms.push({\n          name: activeInfo.name,\n          format,\n          type: uniformType[i],\n          arrayLength: uniformArrayLength[i],\n          byteOffset: uniformOffset[i],\n          byteStride: uniformStride[i]\n          // matrixStride: uniformStride[i],\n          // rowMajor: uniformRowMajor[i]\n        });\n      }\n    }\n\n    const uniformInstancePrefixes = new Set(\n      blockInfo.uniforms\n        .map(uniform => uniform.name.split('.')[0])\n        .filter((instanceName): instanceName is string => Boolean(instanceName))\n    );\n    const blockAlias = blockInfo.name.replace(/Uniforms$/, '');\n    if (\n      uniformInstancePrefixes.size === 1 &&\n      !uniformInstancePrefixes.has(blockInfo.name) &&\n      !uniformInstancePrefixes.has(blockAlias)\n    ) {\n      const [instanceName] = uniformInstancePrefixes;\n      log.warn(\n        `Uniform block \"${blockInfo.name}\" uses GLSL instance \"${instanceName}\". ` +\n          `luma.gl binds uniform buffers by block name (\"${blockInfo.name}\") and alias (\"${blockAlias}\"). ` +\n          'Prefer matching the instance name to one of those to avoid confusing silent mismatches.'\n      )();\n    }\n\n    uniformBlocks.push(blockInfo);\n  }\n\n  uniformBlocks.sort((a, b) => a.location - b.location);\n  return uniformBlocks;\n}\n\n/**\n * TOOD - compare with a above, confirm copy, then delete\n  const bindings: Binding[] = [];\n  const count = gl.getProgramParameter(program, gl.ACTIVE_UNIFORM_BLOCKS);\n  for (let blockIndex = 0; blockIndex < count; blockIndex++) {\n    const vertex = gl.getActiveUniformBlockParameter(program, blockIndex, gl.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),\n    const fragment = gl.getActiveUniformBlockParameter(program, blockIndex, gl.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),\n    const visibility = (vertex) + (fragment);\n    const binding: BufferBinding = {\n      location: gl.getActiveUniformBlockParameter(program, blockIndex, gl.UNIFORM_BLOCK_BINDING),\n      // name: gl.getActiveUniformBlockName(program, blockIndex),\n      type: 'uniform',\n      visibility,\n      minBindingSize: gl.getActiveUniformBlockParameter(program, blockIndex, gl.UNIFORM_BLOCK_DATA_SIZE),\n      // uniformCount: gl.getActiveUniformBlockParameter(program, blockIndex, gl.UNIFORM_BLOCK_ACTIVE_UNIFORMS),\n      // uniformIndices: gl.getActiveUniformBlockParameter(program, blockIndex, gl.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),\n    }\n    bindings.push(binding);\n  }\n*/\n\n// HELPERS\n\nfunction parseUniformName(name: string): {name: string; length: number; isArray: boolean} {\n  // Shortcut to avoid redundant or bad matches\n  if (name[name.length - 1] !== ']') {\n    return {\n      name,\n      length: 1,\n      isArray: false\n    };\n  }\n\n  // if array name then clean the array brackets\n  const UNIFORM_NAME_REGEXP = /([^[]*)(\\[[0-9]+\\])?/;\n  const matches = UNIFORM_NAME_REGEXP.exec(name);\n  const uniformName = assertDefined(matches?.[1], `Failed to parse GLSL uniform name ${name}`);\n  return {\n    name: uniformName,\n    // TODO - is this a bug, shouldn't we return the value?\n    length: matches?.[2] ? 1 : 0,\n    isArray: Boolean(matches?.[2])\n  };\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {GL} from '@luma.gl/webgl/constants';\nimport {\n  SharedRenderPipeline,\n  log,\n  type ShaderLayout,\n  type SharedRenderPipelineProps\n} from '@luma.gl/core';\n\nimport {getShaderLayoutFromGLSL} from '../helpers/get-shader-layout-from-glsl';\nimport {isGLSamplerType} from '../converters/webgl-shadertypes';\nimport type {WebGLDevice} from '../webgl-device';\nimport type {WEBGLShader} from './webgl-shader';\n\nconst LOG_PROGRAM_PERF_PRIORITY = 4;\n\nexport class WEBGLSharedRenderPipeline extends SharedRenderPipeline {\n  readonly device: WebGLDevice;\n  readonly handle: WebGLProgram;\n  readonly vs: WEBGLShader;\n  readonly fs: WEBGLShader;\n  introspectedLayout: ShaderLayout = {attributes: [], bindings: [], uniforms: []};\n  linkStatus: 'pending' | 'success' | 'error' = 'pending';\n\n  constructor(\n    device: WebGLDevice,\n    props: SharedRenderPipelineProps & {\n      handle?: WebGLProgram;\n      vs: WEBGLShader;\n      fs: WEBGLShader;\n    }\n  ) {\n    super(device, props);\n    this.device = device;\n    this.handle = props.handle || this.device.gl.createProgram();\n    this.vs = props.vs;\n    this.fs = props.fs;\n\n    if (props.varyings && props.varyings.length > 0) {\n      this.device.gl.transformFeedbackVaryings(\n        this.handle,\n        props.varyings,\n        props.bufferMode || GL.SEPARATE_ATTRIBS\n      );\n    }\n\n    this._linkShaders();\n    // Introspection happens after linking to build wrapper-facing layout metadata.\n    // It is not a prerequisite for deciding whether a shared `WebGLProgram` can be\n    // reused; that decision must remain based on the shared-pipeline cache key alone.\n    log.time(3, `RenderPipeline ${this.id} - shaderLayout introspection`)();\n    this.introspectedLayout = getShaderLayoutFromGLSL(this.device.gl, this.handle);\n    log.timeEnd(3, `RenderPipeline ${this.id} - shaderLayout introspection`)();\n  }\n\n  override destroy(): void {\n    if (this.destroyed) {\n      return;\n    }\n\n    this.device.gl.useProgram(null);\n    this.device.gl.deleteProgram(this.handle);\n    // @ts-expect-error\n    this.handle.destroyed = true;\n    this.destroyResource();\n  }\n\n  protected async _linkShaders() {\n    const {gl} = this.device;\n    gl.attachShader(this.handle, this.vs.handle);\n    gl.attachShader(this.handle, this.fs.handle);\n    log.time(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();\n    gl.linkProgram(this.handle);\n    log.timeEnd(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();\n\n    if (!this.device.features.has('compilation-status-async-webgl')) {\n      const status = this._getLinkStatus();\n      this._reportLinkStatus(status);\n      return;\n    }\n\n    log.once(1, 'RenderPipeline linking is asynchronous')();\n    await this._waitForLinkComplete();\n    log.info(2, `RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();\n    const status = this._getLinkStatus();\n    this._reportLinkStatus(status);\n  }\n\n  async _reportLinkStatus(status: 'success' | 'link-error' | 'validation-error'): Promise<void> {\n    switch (status) {\n      case 'success':\n        return;\n\n      default:\n        const errorType = status === 'link-error' ? 'Link error' : 'Validation error';\n        switch (this.vs.compilationStatus) {\n          case 'error':\n            this.vs.debugShader();\n            throw new Error(`${this} ${errorType} during compilation of ${this.vs}`);\n          case 'pending':\n            await this.vs.asyncCompilationStatus;\n            this.vs.debugShader();\n            break;\n          case 'success':\n            break;\n        }\n\n        switch (this.fs?.compilationStatus) {\n          case 'error':\n            this.fs.debugShader();\n            throw new Error(`${this} ${errorType} during compilation of ${this.fs}`);\n          case 'pending':\n            await this.fs.asyncCompilationStatus;\n            this.fs.debugShader();\n            break;\n          case 'success':\n            break;\n        }\n\n        const linkErrorLog = this.device.gl.getProgramInfoLog(this.handle);\n        this.device.reportError(\n          new Error(`${errorType} during ${status}: ${linkErrorLog}`),\n          this\n        )();\n        this.device.debug();\n    }\n  }\n\n  _getLinkStatus(): 'success' | 'link-error' | 'validation-error' {\n    const {gl} = this.device;\n    const linked = gl.getProgramParameter(this.handle, GL.LINK_STATUS);\n    if (!linked) {\n      this.linkStatus = 'error';\n      return 'link-error';\n    }\n\n    this._initializeSamplerUniforms();\n    gl.validateProgram(this.handle);\n    const validated = gl.getProgramParameter(this.handle, GL.VALIDATE_STATUS);\n    if (!validated) {\n      this.linkStatus = 'error';\n      return 'validation-error';\n    }\n\n    this.linkStatus = 'success';\n    return 'success';\n  }\n\n  _initializeSamplerUniforms(): void {\n    const {gl} = this.device;\n    gl.useProgram(this.handle);\n\n    let textureUnit = 0;\n    const uniformCount = gl.getProgramParameter(this.handle, GL.ACTIVE_UNIFORMS);\n    for (let uniformIndex = 0; uniformIndex < uniformCount; uniformIndex++) {\n      const activeInfo = gl.getActiveUniform(this.handle, uniformIndex);\n      if (activeInfo && isGLSamplerType(activeInfo.type)) {\n        const isArray = activeInfo.name.endsWith('[0]');\n        const uniformName = isArray ? activeInfo.name.slice(0, -3) : activeInfo.name;\n        const location = gl.getUniformLocation(this.handle, uniformName);\n\n        if (location !== null) {\n          textureUnit = this._assignSamplerUniform(location, activeInfo, isArray, textureUnit);\n        }\n      }\n    }\n  }\n\n  _assignSamplerUniform(\n    location: WebGLUniformLocation,\n    activeInfo: WebGLActiveInfo,\n    isArray: boolean,\n    textureUnit: number\n  ): number {\n    const {gl} = this.device;\n\n    if (isArray && activeInfo.size > 1) {\n      const textureUnits = Int32Array.from(\n        {length: activeInfo.size},\n        (_, arrayIndex) => textureUnit + arrayIndex\n      );\n      gl.uniform1iv(location, textureUnits);\n      return textureUnit + activeInfo.size;\n    }\n\n    gl.uniform1i(location, textureUnit);\n    return textureUnit + 1;\n  }\n\n  async _waitForLinkComplete(): Promise<void> {\n    const waitMs = async (ms: number) => await new Promise(resolve => setTimeout(resolve, ms));\n    const DELAY_MS = 10;\n\n    if (!this.device.features.has('compilation-status-async-webgl')) {\n      await waitMs(DELAY_MS);\n      return;\n    }\n\n    const {gl} = this.device;\n    for (;;) {\n      const complete = gl.getProgramParameter(this.handle, GL.COMPLETION_STATUS_KHR);\n      if (complete) {\n        return;\n      }\n      await waitMs(DELAY_MS);\n    }\n  }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n  type CommandBufferProps,\n  type CopyBufferToBufferOptions,\n  type CopyBufferToTextureOptions,\n  type CopyTextureToBufferOptions,\n  type CopyTextureToTextureOptions,\n  type TextureReadOptions,\n  // type ClearTextureOptions,\n  CommandBuffer,\n  Texture,\n  Framebuffer,\n  assertDefined\n} from '@luma.gl/core';\nimport {GL, type GLTextureTarget, type GLTextureCubeMapTarget} from '@luma.gl/webgl/constants';\n\nimport {getTextureFormatWebGL} from '../converters/webgl-texture-table';\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from './webgl-buffer';\nimport {WEBGLTexture} from './webgl-texture';\nimport {WEBGLFramebuffer} from './webgl-framebuffer';\n\ntype CopyBufferToBufferCommand = {\n  name: 'copy-buffer-to-buffer';\n  options: CopyBufferToBufferOptions;\n};\n\ntype CopyBufferToTextureCommand = {\n  name: 'copy-buffer-to-texture';\n  options: CopyBufferToTextureOptions;\n};\n\ntype CopyTextureToBufferCommand = {\n  name: 'copy-texture-to-buffer';\n  options: CopyTextureToBufferOptions;\n};\n\ntype CopyTextureToTextureCommand = {\n  name: 'copy-texture-to-texture';\n  options: CopyTextureToTextureOptions;\n};\n\ntype ClearTextureCommand = {\n  name: 'clear-texture';\n  options: {}; // ClearTextureOptions;\n};\n\ntype ReadTextureCommand = {\n  name: 'read-texture';\n  options: {}; // TextureReadOptions;\n};\n\ntype Command =\n  | CopyBufferToBufferCommand\n  | CopyBufferToTextureCommand\n  | CopyTextureToBufferCommand\n  | CopyTextureToTextureCommand\n  | ClearTextureCommand\n  | ReadTextureCommand;\n\nexport class WEBGLCommandBuffer extends CommandBuffer {\n  readonly device: WebGLDevice;\n  readonly handle = null;\n  commands: Command[] = [];\n\n  constructor(device: WebGLDevice, props: CommandBufferProps = {}) {\n    super(device, props);\n    this.device = device;\n  }\n\n  _executeCommands(commands: Command[] = this.commands) {\n    for (const command of commands) {\n      switch (command.name) {\n        case 'copy-buffer-to-buffer':\n          _copyBufferToBuffer(this.device, command.options);\n          break;\n        case 'copy-buffer-to-texture':\n          _copyBufferToTexture(this.device, command.options);\n          break;\n        case 'copy-texture-to-buffer':\n          _copyTextureToBuffer(this.device, command.options);\n          break;\n        case 'copy-texture-to-texture':\n          _copyTextureToTexture(this.device, command.options);\n          break;\n        // case 'clear-texture':\n        //   _clearTexture(this.device, command.options);\n        //   break;\n        default:\n          throw new Error(command.name);\n      }\n    }\n  }\n}\n\nfunction _copyBufferToBuffer(device: WebGLDevice, options: CopyBufferToBufferOptions): void {\n  const source = options.sourceBuffer as WEBGLBuffer;\n  const destination = options.destinationBuffer as WEBGLBuffer;\n\n  // {In WebGL2 we can p}erform the copy on the GPU\n  // Use GL.COPY_READ_BUFFER+GL.COPY_WRITE_BUFFER avoid disturbing other targets and locking type\n  device.gl.bindBuffer(GL.COPY_READ_BUFFER, source.handle);\n  device.gl.bindBuffer(GL.COPY_WRITE_BUFFER, destination.handle);\n  device.gl.copyBufferSubData(\n    GL.COPY_READ_BUFFER,\n    GL.COPY_WRITE_BUFFER,\n    options.sourceOffset ?? 0,\n    options.destinationOffset ?? 0,\n    options.size\n  );\n  device.gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n  device.gl.bindBuffer(GL.COPY_WRITE_BUFFER, null);\n}\n\n/**\n * Copies data from a Buffer object into a Texture object\n * NOTE: doesn't wait for copy to be complete\n */\nfunction _copyBufferToTexture(_device: WebGLDevice, _options: CopyBufferToTextureOptions): void {\n  throw new Error('copyBufferToTexture is not supported in WebGL');\n}\n\n/**\n * Copies data from a Texture object into a Buffer object.\n * NOTE: doesn't wait for copy to be complete\n */\nfunction _copyTextureToBuffer(device: WebGLDevice, options: CopyTextureToBufferOptions): void {\n  const {\n    sourceTexture,\n    mipLevel = 0,\n    aspect = 'all',\n    width = options.sourceTexture.width,\n    height = options.sourceTexture.height,\n    depthOrArrayLayers,\n    origin = [0, 0, 0],\n    destinationBuffer,\n    byteOffset = 0,\n    bytesPerRow,\n    rowsPerImage\n  } = options;\n\n  if (sourceTexture instanceof Texture) {\n    sourceTexture.readBuffer(\n      {\n        x: origin[0] ?? 0,\n        y: origin[1] ?? 0,\n        z: origin[2] ?? 0,\n        width,\n        height,\n        depthOrArrayLayers,\n        mipLevel,\n        aspect,\n        byteOffset\n      } as TextureReadOptions & {byteOffset?: number},\n      destinationBuffer\n    );\n    return;\n  }\n\n  // TODO - Not possible to read just stencil or depth part in WebGL?\n  if (aspect !== 'all') {\n    throw new Error('aspect not supported in WebGL');\n  }\n\n  // TODO - mipLevels are set when attaching texture to framebuffer\n  if (mipLevel !== 0 || depthOrArrayLayers !== undefined || bytesPerRow || rowsPerImage) {\n    throw new Error('not implemented');\n  }\n\n  // Asynchronous read (PIXEL_PACK_BUFFER) is WebGL2 only feature\n  const {framebuffer, destroyFramebuffer} = getFramebuffer(sourceTexture);\n  let prevHandle: WebGLFramebuffer | null | undefined;\n  try {\n    const webglBuffer = destinationBuffer as WEBGLBuffer;\n    const sourceWidth = width || framebuffer.width;\n    const sourceHeight = height || framebuffer.height;\n    const colorAttachment0 = assertDefined(framebuffer.colorAttachments[0]);\n\n    const sourceParams = getTextureFormatWebGL(colorAttachment0.texture.props.format);\n    const sourceFormat = sourceParams.format;\n    const sourceType = sourceParams.type;\n\n    // if (!target) {\n    //   // Create new buffer with enough size\n    //   const components = glFormatToComponents(sourceFormat);\n    //   const byteCount = glTypeToBytes(sourceType);\n    //   const byteLength = byteOffset + sourceWidth * sourceHeight * components * byteCount;\n    //   target = device.createBuffer({byteLength});\n    // }\n\n    device.gl.bindBuffer(GL.PIXEL_PACK_BUFFER, webglBuffer.handle);\n    // @ts-expect-error native bindFramebuffer is overridden by our state tracker\n    prevHandle = device.gl.bindFramebuffer(GL.FRAMEBUFFER, framebuffer.handle);\n\n    device.gl.readPixels(\n      origin[0],\n      origin[1],\n      sourceWidth,\n      sourceHeight,\n      sourceFormat,\n      sourceType,\n      byteOffset\n    );\n  } finally {\n    device.gl.bindBuffer(GL.PIXEL_PACK_BUFFER, null);\n    // prevHandle may be unassigned if the try block failed before binding\n    if (prevHandle !== undefined) {\n      device.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle);\n    }\n\n    if (destroyFramebuffer) {\n      framebuffer.destroy();\n    }\n  }\n}\n\n/**\n * Copies data from a Framebuffer or a Texture object into a Buffer object.\n * NOTE: doesn't wait for copy to be complete, it programs GPU to perform a DMA transfer.\nexport function readPixelsToBuffer(\n  source: Framebuffer | Texture,\n  options?: {\n    sourceX?: number;\n    sourceY?: number;\n    sourceFormat?: number;\n    target?: Buffer; // A new Buffer object is created when not provided.\n    targetByteOffset?: number; // byte offset in buffer object\n    // following parameters are auto deduced if not provided\n    sourceWidth?: number;\n    sourceHeight?: number;\n    sourceType?: number;\n  }\n): Buffer\n */\n\n/**\n * Copy a rectangle from a Framebuffer or Texture object into a texture (at an offset)\n */\n// eslint-disable-next-line complexity, max-statements\nfunction _copyTextureToTexture(device: WebGLDevice, options: CopyTextureToTextureOptions): void {\n  const {\n    /** Texture to copy to/from. */\n    sourceTexture,\n    /**  Mip-map level of the texture to copy to (Default 0) */\n    destinationMipLevel = 0,\n    /** Defines which aspects of the texture to copy to/from. */\n    // aspect = 'all',\n    /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy from. */\n    origin = [0, 0],\n\n    /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to. */\n    destinationOrigin = [0, 0, 0],\n\n    /** Texture to copy to/from. */\n    destinationTexture\n    /**  Mip-map level of the texture to copy to/from. (Default 0) */\n    // destinationMipLevel = options.mipLevel,\n    /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */\n    // destinationOrigin = [0, 0],\n    /** Defines which aspects of the texture to copy to/from. */\n    // destinationAspect = options.aspect,\n  } = options;\n\n  let {\n    width = options.destinationTexture.width,\n    height = options.destinationTexture.height\n    // depthOrArrayLayers = 0\n  } = options;\n\n  const {framebuffer, destroyFramebuffer} = getFramebuffer(sourceTexture);\n  const [sourceX = 0, sourceY = 0] = origin;\n  const [destinationX, destinationY, destinationZ] = destinationOrigin;\n\n  // @ts-expect-error native bindFramebuffer is overridden by our state tracker\n  const prevHandle: WebGLFramebuffer | null = device.gl.bindFramebuffer(\n    GL.FRAMEBUFFER,\n    framebuffer.handle\n  );\n  // TODO - support gl.readBuffer (WebGL2 only)\n  // const prevBuffer = gl.readBuffer(attachment);\n\n  let texture: WEBGLTexture;\n  let textureTarget: GL;\n  if (destinationTexture instanceof WEBGLTexture) {\n    texture = destinationTexture;\n    width = Number.isFinite(width) ? width : texture.width;\n    height = Number.isFinite(height) ? height : texture.height;\n    texture._bind(0);\n    textureTarget = texture.glTarget;\n  } else {\n    throw new Error('invalid destination');\n  }\n\n  switch (textureTarget) {\n    case GL.TEXTURE_2D:\n    case GL.TEXTURE_CUBE_MAP:\n      device.gl.copyTexSubImage2D(\n        textureTarget,\n        destinationMipLevel,\n        destinationX,\n        destinationY,\n        sourceX,\n        sourceY,\n        width,\n        height\n      );\n      break;\n    case GL.TEXTURE_2D_ARRAY:\n    case GL.TEXTURE_3D:\n      device.gl.copyTexSubImage3D(\n        textureTarget,\n        destinationMipLevel,\n        destinationX,\n        destinationY,\n        destinationZ,\n        sourceX,\n        sourceY,\n        width,\n        height\n      );\n      break;\n    default:\n  }\n\n  if (texture) {\n    texture._unbind();\n  }\n  device.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle);\n  if (destroyFramebuffer) {\n    framebuffer.destroy();\n  }\n}\n\n/** Clear one mip level of a texture *\nfunction _clearTexture(device: WebGLDevice, options: ClearTextureOptions) {\n  const BORDER = 0;\n  const {dimension, width, height, depth = 0, mipLevel = 0} = options;\n  const {glInternalFormat, glFormat, glType, compressed} = options;\n  const glTarget = getWebGLCubeFaceTarget(options.glTarget, dimension, depth);\n\n  switch (dimension) {\n    case '2d-array':\n    case '3d':\n      if (compressed) {\n        // biome-ignore format: preserve layout\n        device.gl.compressedTexImage3D(glTarget, mipLevel, glInternalFormat, width, height, depth, BORDER, null);\n      } else {\n        // biome-ignore format: preserve layout\n        device.gl.texImage3D( glTarget, mipLevel, glInternalFormat, width, height, depth, BORDER, glFormat, glType, null);\n      }\n      break;\n\n    case '2d':\n    case 'cube':\n      if (compressed) {\n        // biome-ignore format: preserve layout\n        device.gl.compressedTexImage2D(glTarget, mipLevel, glInternalFormat, width, height, BORDER, null);\n      } else {\n        // biome-ignore format: preserve layout\n        device.gl.texImage2D(glTarget, mipLevel, glInternalFormat, width, height, BORDER, glFormat, glType, null);\n      }\n      break;\n\n    default:\n      throw new Error(dimension);\n  }\n}\n  */\n\n// function _readTexture(device: WebGLDevice, options: CopyTextureToBufferOptions) {}\n\n// HELPERS\n\n/**\n * In WebGL, cube maps specify faces by overriding target instead of using the depth parameter.\n * @note We still bind the texture using GL.TEXTURE_CUBE_MAP, but we need to use the face-specific target when setting mip levels.\n * @returns glTarget unchanged, if dimension !== 'cube'.\n */\nexport function getWebGLCubeFaceTarget(\n  glTarget: GLTextureTarget,\n  dimension: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d',\n  level: number\n): GLTextureTarget | GLTextureCubeMapTarget {\n  return dimension === 'cube' ? GL.TEXTURE_CUBE_MAP_POSITIVE_X + level : glTarget;\n}\n\n/** Wrap a texture in a framebuffer so that we can use WebGL APIs that work on framebuffers */\nfunction getFramebuffer(source: Texture | Framebuffer): {\n  framebuffer: WEBGLFramebuffer;\n  destroyFramebuffer: boolean;\n} {\n  if (source instanceof Texture) {\n    const {width, height, id} = source;\n    const framebuffer = source.device.createFramebuffer({\n      id: `framebuffer-for-${id}`,\n      width,\n      height,\n      colorAttachments: [source]\n    }) as unknown as WEBGLFramebuffer;\n\n    return {framebuffer, destroyFramebuffer: true};\n  }\n  return {framebuffer: source as unknown as WEBGLFramebuffer, destroyFramebuffer: false};\n}\n\n/**\n * Returns number of components in a specific readPixels WebGL format\n * @todo use shadertypes utils instead?\n */\nexport function glFormatToComponents(format: GL): 1 | 2 | 3 | 4 {\n  switch (format) {\n    case GL.ALPHA:\n    case GL.R32F:\n    case GL.RED:\n      return 1;\n    case GL.RG32F:\n    case GL.RG:\n      return 2;\n    case GL.RGB:\n    case GL.RGB32F:\n      return 3;\n    case GL.RGBA:\n    case GL.RGBA32F:\n      return 4;\n    // TODO: Add support for additional WebGL2 formats\n    default:\n      throw new Error('GLFormat');\n  }\n}\n\n/**\n * Return byte count for given readPixels WebGL type\n * @todo use shadertypes utils instead?\n */\nexport function glTypeToBytes(type: GL): 1 | 2 | 4 {\n  switch (type) {\n    case GL.UNSIGNED_BYTE:\n      return 1;\n    case GL.UNSIGNED_SHORT_5_6_5:\n    case GL.UNSIGNED_SHORT_4_4_4_4:\n    case GL.UNSIGNED_SHORT_5_5_5_1:\n      return 2;\n    case GL.FLOAT:\n      return 4;\n    // TODO: Add support for additional WebGL2 types\n    default:\n      throw new Error('GLType');\n  }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {NumericArray, NumberArray4} from '@math.gl/types';\nimport {RenderPass, RenderPassProps, RenderPassParameters} from '@luma.gl/core';\nimport {WebGLDevice} from '../webgl-device';\nimport {GL, GLParameters} from '@luma.gl/webgl/constants';\nimport {withGLParameters} from '../../context/state-tracker/with-parameters';\nimport {setGLParameters} from '../../context/parameters/unified-parameter-api';\nimport {WEBGLQuerySet} from './webgl-query-set';\nimport {WEBGLFramebuffer} from './webgl-framebuffer';\n\nconst COLOR_CHANNELS: NumberArray4 = [0x1, 0x2, 0x4, 0x8]; // GPUColorWrite RED, GREEN, BLUE, ALPHA\n\nexport class WEBGLRenderPass extends RenderPass {\n  readonly device: WebGLDevice;\n  readonly handle = null;\n\n  /** Parameters that should be applied before each draw call */\n  glParameters: GLParameters = {};\n\n  constructor(device: WebGLDevice, props: RenderPassProps) {\n    super(device, props);\n    this.device = device;\n    const webglFramebuffer = this.props.framebuffer as WEBGLFramebuffer | null;\n    const isDefaultFramebuffer = !webglFramebuffer || webglFramebuffer.handle === null;\n\n    if (isDefaultFramebuffer) {\n      // Treat an explicit wrapper around the default framebuffer the same as the\n      // implicit default path so draw buffer and viewport state stay valid.\n      device.getDefaultCanvasContext()._resizeDrawingBufferIfNeeded();\n    }\n\n    // If no viewport is provided, apply reasonably defaults\n    let viewport: NumberArray4 | undefined;\n    if (!props?.parameters?.viewport) {\n      if (!isDefaultFramebuffer) {\n        // Set the viewport to the size of the framebuffer\n        const {width, height} = webglFramebuffer;\n        viewport = [0, 0, width, height];\n      } else {\n        // Instead of using our own book-keeping, we can just read the values from the WebGL context\n        const [width, height] = device.getDefaultCanvasContext().getDrawingBufferSize();\n        viewport = [0, 0, width, height];\n      }\n    }\n\n    // TODO - do parameters (scissorRect) affect the clear operation?\n    this.device.pushState();\n    this.setParameters({viewport, ...this.props.parameters});\n\n    // Specify mapping of draw buffer locations to color attachments\n    // Default framebuffers can only be set to GL.BACK or GL.NONE\n    if (!isDefaultFramebuffer) {\n      const drawBuffers = webglFramebuffer.colorAttachments.map((_, i) => GL.COLOR_ATTACHMENT0 + i);\n      this.device.gl.drawBuffers(drawBuffers);\n    } else {\n      // Default framebuffer only supports GL.BACK/GL.NONE draw buffers, even when\n      // passed through an explicit framebuffer wrapper.\n      this.device.gl.drawBuffers([GL.BACK]);\n    }\n\n    // Hack - for now WebGL draws in \"immediate mode\" (instead of queueing the operations)...\n    this.clear();\n\n    if (this.props.timestampQuerySet && this.props.beginTimestampIndex !== undefined) {\n      const webglQuerySet = this.props.timestampQuerySet as WEBGLQuerySet;\n      webglQuerySet.writeTimestamp(this.props.beginTimestampIndex);\n    }\n  }\n\n  end(): void {\n    if (this.destroyed) {\n      return;\n    }\n    if (this.props.timestampQuerySet && this.props.endTimestampIndex !== undefined) {\n      const webglQuerySet = this.props.timestampQuerySet as WEBGLQuerySet;\n      webglQuerySet.writeTimestamp(this.props.endTimestampIndex);\n    }\n    this.device.popState();\n    // should add commands to CommandEncoder.\n    this.destroy();\n  }\n\n  pushDebugGroup(groupLabel: string): void {}\n  popDebugGroup(): void {}\n  insertDebugMarker(markerLabel: string): void {}\n\n  // beginOcclusionQuery(queryIndex: number): void;\n  // endOcclusionQuery(): void;\n\n  // executeBundles(bundles: Iterable<GPURenderBundle>): void;\n\n  /**\n   * Maps RenderPass parameters to GL parameters\n   */\n  setParameters(parameters: RenderPassParameters = {}): void {\n    const glParameters: GLParameters = {...this.glParameters};\n\n    // Framebuffers are specified using parameters in WebGL\n    glParameters.framebuffer = this.props.framebuffer || null;\n\n    if (this.props.depthReadOnly) {\n      glParameters.depthMask = !this.props.depthReadOnly;\n    }\n\n    glParameters.stencilMask = this.props.stencilReadOnly ? 0 : 1;\n\n    glParameters[GL.RASTERIZER_DISCARD] = this.props.discard;\n\n    // Map the four renderpass parameters to WebGL parameters\n    if (parameters.viewport) {\n      // WebGPU viewports are 6 coordinates (X, Y, Z)\n      if (parameters.viewport.length >= 6) {\n        glParameters.viewport = parameters.viewport.slice(0, 4) as NumberArray4;\n        glParameters.depthRange = [\n          parameters.viewport[4] as number,\n          parameters.viewport[5] as number\n        ];\n      } else {\n        // WebGL viewports are 4 coordinates (X, Y)\n        glParameters.viewport = parameters.viewport as NumberArray4;\n      }\n    }\n    if (parameters.scissorRect) {\n      glParameters.scissorTest = true;\n      glParameters.scissor = parameters.scissorRect;\n    }\n    if (parameters.blendConstant) {\n      glParameters.blendColor = parameters.blendConstant;\n    }\n    if (parameters.stencilReference !== undefined) {\n      glParameters[GL.STENCIL_REF] = parameters.stencilReference;\n      glParameters[GL.STENCIL_BACK_REF] = parameters.stencilReference;\n    }\n\n    if ('colorMask' in parameters) {\n      glParameters.colorMask = COLOR_CHANNELS.map(channel =>\n        Boolean(channel & (parameters.colorMask as number))\n      );\n    }\n\n    this.glParameters = glParameters;\n\n    setGLParameters(this.device.gl, glParameters);\n  }\n\n  beginOcclusionQuery(queryIndex: number): void {\n    const webglQuerySet = this.props.occlusionQuerySet as WEBGLQuerySet;\n    webglQuerySet?.beginOcclusionQuery();\n  }\n\n  override endOcclusionQuery(): void {\n    const webglQuerySet = this.props.occlusionQuerySet as WEBGLQuerySet;\n    webglQuerySet?.endOcclusionQuery();\n  }\n\n  // PRIVATE\n\n  /**\n   * Optionally clears depth, color and stencil buffers based on parameters\n   */\n  protected clear(): void {\n    const glParameters: GLParameters = {...this.glParameters};\n\n    let clearMask = 0;\n\n    if (this.props.clearColors) {\n      this.props.clearColors.forEach((color, drawBufferIndex) => {\n        if (color) {\n          this.clearColorBuffer(drawBufferIndex, color);\n        }\n      });\n    }\n\n    if (this.props.clearColor !== false && this.props.clearColors === undefined) {\n      clearMask |= GL.COLOR_BUFFER_BIT;\n      glParameters.clearColor = this.props.clearColor;\n    }\n    if (this.props.clearDepth !== false) {\n      clearMask |= GL.DEPTH_BUFFER_BIT;\n      glParameters.clearDepth = this.props.clearDepth;\n    }\n    if (this.props.clearStencil !== false) {\n      clearMask |= GL.STENCIL_BUFFER_BIT;\n      glParameters.clearStencil = this.props.clearStencil;\n    }\n\n    if (clearMask !== 0) {\n      // Temporarily set any clear \"colors\" and call clear\n      withGLParameters(this.device.gl, glParameters, () => {\n        this.device.gl.clear(clearMask);\n      });\n    }\n  }\n\n  /**\n   * WebGL2 - clear a specific color buffer\n   */\n  protected clearColorBuffer(drawBuffer: number = 0, value: NumericArray = [0, 0, 0, 0]) {\n    withGLParameters(this.device.gl, {framebuffer: this.props.framebuffer}, () => {\n      // Method selection per OpenGL ES 3 docs\n      switch (value.constructor) {\n        case Int8Array:\n        case Int16Array:\n        case Int32Array:\n          this.device.gl.clearBufferiv(GL.COLOR, drawBuffer, value);\n          break;\n        case Uint8Array:\n        case Uint8ClampedArray:\n        case Uint16Array:\n        case Uint32Array:\n          this.device.gl.clearBufferuiv(GL.COLOR, drawBuffer, value);\n          break;\n        case Float32Array:\n          this.device.gl.clearBufferfv(GL.COLOR, drawBuffer, value);\n          break;\n        default:\n          throw new Error('clearColorBuffer: color must be typed array');\n      }\n    });\n  }\n\n  /*\n  clearDepthStencil() {\n      case GL.DEPTH:\n        this.device.gl.clearBufferfv(GL.DEPTH, 0, [value]);\n        break;\n\n      case GL_STENCIL:\n        this.device.gl.clearBufferiv(GL.STENCIL, 0, [value]);\n        break;\n\n      case GL.DEPTH_STENCIL:\n        const [depth, stencil] = value;\n        this.device.gl.clearBufferfi(GL.DEPTH_STENCIL, 0, depth, stencil);\n        break;\n\n      default:\n        assert(false, ERR_ARGUMENTS);\n    }\n  });\n  */\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {CommandBufferProps, CommandEncoder, CommandEncoderProps} from '@luma.gl/core';\nimport type {\n  RenderPassProps,\n  ComputePass,\n  ComputePassProps,\n  QuerySet,\n  Buffer,\n  CopyBufferToBufferOptions,\n  CopyBufferToTextureOptions,\n  CopyTextureToBufferOptions,\n  CopyTextureToTextureOptions\n  // ClearTextureOptions,\n  // TextureReadOptions,\n} from '@luma.gl/core';\n\nimport {WEBGLCommandBuffer} from './webgl-command-buffer';\nimport {WEBGLRenderPass} from './webgl-render-pass';\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLQuerySet} from './webgl-query-set';\n\nexport class WEBGLCommandEncoder extends CommandEncoder {\n  readonly device: WebGLDevice;\n  readonly handle = null;\n\n  readonly commandBuffer: WEBGLCommandBuffer;\n\n  constructor(device: WebGLDevice, props: CommandEncoderProps) {\n    super(device, props);\n    this.device = device;\n    this.commandBuffer = new WEBGLCommandBuffer(device, {\n      id: `${this.props.id}-command-buffer`\n    });\n  }\n\n  override destroy(): void {\n    this.destroyResource();\n  }\n\n  override finish(props?: CommandBufferProps): WEBGLCommandBuffer {\n    if (props?.id && this.commandBuffer.id !== props.id) {\n      this.commandBuffer.id = props.id;\n      this.commandBuffer.props.id = props.id;\n    }\n    this.destroy();\n    return this.commandBuffer;\n  }\n\n  beginRenderPass(props: RenderPassProps = {}): WEBGLRenderPass {\n    return new WEBGLRenderPass(this.device, this._applyTimeProfilingToPassProps(props));\n  }\n\n  beginComputePass(props: ComputePassProps = {}): ComputePass {\n    throw new Error('ComputePass not supported in WebGL');\n  }\n\n  copyBufferToBuffer(options: CopyBufferToBufferOptions): void {\n    this.commandBuffer.commands.push({name: 'copy-buffer-to-buffer', options});\n  }\n\n  copyBufferToTexture(options: CopyBufferToTextureOptions) {\n    this.commandBuffer.commands.push({name: 'copy-buffer-to-texture', options});\n  }\n\n  copyTextureToBuffer(options: CopyTextureToBufferOptions): void {\n    this.commandBuffer.commands.push({name: 'copy-texture-to-buffer', options});\n  }\n\n  copyTextureToTexture(options: CopyTextureToTextureOptions): void {\n    this.commandBuffer.commands.push({name: 'copy-texture-to-texture', options});\n  }\n\n  // clearTexture(options: ClearTextureOptions): void {\n  //   this.commandBuffer.commands.push({name: 'copy-texture-to-texture', options});\n  // }\n\n  override pushDebugGroup(groupLabel: string): void {}\n  override popDebugGroup() {}\n\n  override insertDebugMarker(markerLabel: string): void {}\n\n  override resolveQuerySet(\n    _querySet: QuerySet,\n    _destination: Buffer,\n    _options?: {\n      firstQuery?: number;\n      queryCount?: number;\n      destinationOffset?: number;\n    }\n  ): void {\n    throw new Error('resolveQuerySet is not supported in WebGL');\n  }\n\n  writeTimestamp(querySet: QuerySet, queryIndex: number): void {\n    const webglQuerySet = querySet as WEBGLQuerySet;\n    webglQuerySet.writeTimestamp(queryIndex);\n  }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {NumericArray} from '@math.gl/types';\n\n// Uses copyWithin to significantly speed up typed array value filling\nexport function fillArray(options: {\n  target: NumericArray;\n  source: NumericArray;\n  start?: number;\n  count?: number;\n}): NumericArray {\n  const {target, source, start = 0, count = 1} = options;\n  const length = source.length;\n  const total = count * length;\n  let copied = 0;\n  for (let i = start; copied < length; copied++) {\n    target[i++] = source[copied] ?? 0;\n  }\n\n  while (copied < total) {\n    // If we have copied less than half, copy everything we got\n    // else copy remaining in one operation\n    if (copied < total - copied) {\n      target.copyWithin(start + copied, start, start + copied);\n      copied *= 2;\n    } else {\n      target.copyWithin(start + copied, start, start + total - copied);\n      copied = total;\n    }\n  }\n\n  return options.target;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {TypedArray, NumericArray} from '@math.gl/types';\nimport type {Device, Buffer, VertexArrayProps} from '@luma.gl/core';\nimport {VertexArray, getScratchArray} from '@luma.gl/core';\nimport {GL} from '@luma.gl/webgl/constants';\nimport {getBrowser} from '@probe.gl/env';\n\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from '../resources/webgl-buffer';\n\nimport {getGLFromVertexType} from '../converters/webgl-vertex-formats';\nimport {fillArray} from '../../utils/fill-array';\n\n/** VertexArrayObject wrapper */\nexport class WEBGLVertexArray extends VertexArray {\n  override get [Symbol.toStringTag](): string {\n    return 'VertexArray';\n  }\n\n  readonly device: WebGLDevice;\n  readonly handle: WebGLVertexArrayObject;\n\n  /** Attribute 0 buffer constant */\n  private buffer: WEBGLBuffer | null = null;\n  private bufferValue: TypedArray | null = null;\n\n  /** * Attribute 0 can not be disable on most desktop OpenGL based browsers */\n  static isConstantAttributeZeroSupported(device: Device): boolean {\n    return getBrowser() === 'Chrome';\n  }\n\n  // Create a VertexArray\n  constructor(device: WebGLDevice, props: VertexArrayProps) {\n    super(device, props);\n    this.device = device;\n    this.handle = this.device.gl.createVertexArray()!;\n  }\n\n  override destroy(): void {\n    super.destroy();\n    if (this.buffer) {\n      this.buffer?.destroy();\n    }\n    if (this.handle) {\n      this.device.gl.deleteVertexArray(this.handle);\n      // @ts-expect-error read-only/undefined\n      this.handle = undefined!;\n    }\n\n    // Auto-delete elements?\n    // return [this.elements];\n  }\n\n  /**\n  // Set (bind/unbind) an elements buffer, for indexed rendering.\n  // Must be a Buffer bound to GL.ELEMENT_ARRAY_BUFFER or null. Constants not supported\n   *\n   * @param elementBuffer\n   */\n  setIndexBuffer(indexBuffer: Buffer | null): void {\n    const buffer = indexBuffer as WEBGLBuffer;\n    // Explicitly allow `null` to support clearing the index buffer\n    if (buffer && buffer.glTarget !== GL.ELEMENT_ARRAY_BUFFER) {\n      throw new Error('Use .setBuffer()');\n    }\n    // In WebGL The GL.ELEMENT_ARRAY_BUFFER_BINDING is stored on the VertexArrayObject\n    this.device.gl.bindVertexArray(this.handle);\n    this.device.gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, buffer ? buffer.handle : null);\n\n    this.indexBuffer = buffer;\n\n    // Unbind to prevent unintended changes to the VAO.\n    this.device.gl.bindVertexArray(null);\n  }\n\n  /** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */\n  setBuffer(location: number, attributeBuffer: Buffer): void {\n    const buffer = attributeBuffer as WEBGLBuffer;\n    // Sanity check target\n    if (buffer.glTarget === GL.ELEMENT_ARRAY_BUFFER) {\n      throw new Error('Use .setIndexBuffer()');\n    }\n\n    const {size, type, stride, offset, normalized, integer, divisor} = this._getAccessor(location);\n\n    this.device.gl.bindVertexArray(this.handle);\n    // A non-zero buffer object must be bound to the GL_ARRAY_BUFFER target\n    this.device.gl.bindBuffer(GL.ARRAY_BUFFER, buffer.handle);\n\n    // WebGL2 supports *integer* data formats, i.e. GPU will see integer values\n    if (integer) {\n      this.device.gl.vertexAttribIPointer(location, size, type, stride, offset);\n    } else {\n      // Attaches ARRAY_BUFFER with specified buffer format to location\n      this.device.gl.vertexAttribPointer(location, size, type, normalized, stride, offset);\n    }\n    // Clear binding - keeping it may cause [.WebGL-0x12804417100]\n    // GL_INVALID_OPERATION: A transform feedback buffer that would be written to is also bound to a non-transform-feedback target\n    this.device.gl.bindBuffer(GL.ARRAY_BUFFER, null);\n\n    // Mark as non-constant\n    this.device.gl.enableVertexAttribArray(location);\n    // Set the step mode 0=vertex, 1=instance\n    this.device.gl.vertexAttribDivisor(location, divisor || 0);\n\n    this.attributes[location] = buffer;\n\n    // Unbind to prevent unintended changes to the VAO.\n    this.device.gl.bindVertexArray(null);\n  }\n\n  /** Set a location in vertex attributes array to a constant value, disables the location */\n  override setConstantWebGL(location: number, value: TypedArray): void {\n    this._enable(location, false);\n    this.attributes[location] = value;\n  }\n\n  override bindBeforeRender(): void {\n    this.device.gl.bindVertexArray(this.handle);\n    this._applyConstantAttributes();\n  }\n\n  override unbindAfterRender(): void {\n    // Unbind to prevent unintended changes to the VAO.\n    this.device.gl.bindVertexArray(null);\n  }\n\n  // Internal methods\n\n  /**\n   * Constant attributes need to be reset before every draw call\n   * Any attribute that is disabled in the current vertex array object\n   * is read from the context's global constant value for that attribute location.\n   * @note Constant attributes are only supported in WebGL, not in WebGPU\n   */\n  protected _applyConstantAttributes(): void {\n    for (let location = 0; location < this.maxVertexAttributes; ++location) {\n      const constant = this.attributes[location];\n      // A typed array means this is a constant\n      if (ArrayBuffer.isView(constant)) {\n        this.device.setConstantAttributeWebGL(location, constant);\n      }\n    }\n  }\n\n  /**\n   * Set a location in vertex attributes array to a buffer, enables the location, sets divisor\n   * @note requires vertex array to be bound\n   */\n  // protected _setAttributeLayout(location: number): void {\n  //   const {size, type, stride, offset, normalized, integer, divisor} = this._getAccessor(location);\n\n  //   // WebGL2 supports *integer* data formats, i.e. GPU will see integer values\n  //   if (integer) {\n  //     this.device.gl.vertexAttribIPointer(location, size, type, stride, offset);\n  //   } else {\n  //     // Attaches ARRAY_BUFFER with specified buffer format to location\n  //     this.device.gl.vertexAttribPointer(location, size, type, normalized, stride, offset);\n  //   }\n  //   this.device.gl.vertexAttribDivisor(location, divisor || 0);\n  // }\n\n  /** Get an accessor from the  */\n  protected _getAccessor(location: number) {\n    const attributeInfo = this.attributeInfos[location];\n    if (!attributeInfo) {\n      throw new Error(`Unknown attribute location ${location}`);\n    }\n    const glType = getGLFromVertexType(attributeInfo.bufferDataType);\n    return {\n      size: attributeInfo.bufferComponents,\n      type: glType,\n      stride: attributeInfo.byteStride,\n      offset: attributeInfo.byteOffset,\n      normalized: attributeInfo.normalized,\n      // it is the shader attribute declaration, not the vertex memory format,\n      // that determines if the data in the buffer will be treated as integers.\n      //\n      // Also note that WebGL supports assigning non-normalized integer data to floating point attributes,\n      // but as far as we can tell, WebGPU does not.\n      integer: attributeInfo.integer,\n      divisor: attributeInfo.stepMode === 'instance' ? 1 : 0\n    };\n  }\n\n  /**\n   * Enabling an attribute location makes it reference the currently bound buffer\n   * Disabling an attribute location makes it reference the global constant value\n   * TODO - handle single values for size 1 attributes?\n   * TODO - convert classic arrays based on known type?\n   */\n  protected _enable(location: number, enable = true): void {\n    // Attribute 0 cannot be disabled in most desktop OpenGL based browsers...\n    const canDisableAttributeZero = WEBGLVertexArray.isConstantAttributeZeroSupported(this.device);\n    const canDisableAttribute = canDisableAttributeZero || location !== 0;\n\n    if (enable || canDisableAttribute) {\n      location = Number(location);\n      this.device.gl.bindVertexArray(this.handle);\n      if (enable) {\n        this.device.gl.enableVertexAttribArray(location);\n      } else {\n        this.device.gl.disableVertexAttribArray(location);\n      }\n      this.device.gl.bindVertexArray(null);\n    }\n  }\n\n  /**\n   * Provide a means to create a buffer that is equivalent to a constant.\n   * NOTE: Desktop OpenGL cannot disable attribute 0.\n   * https://stackoverflow.com/questions/20305231/webgl-warning-attribute-0-is-disabled-\n   * this-has-significant-performance-penalty\n   */\n  getConstantBuffer(elementCount: number, value: TypedArray): Buffer {\n    // Create buffer only when needed, and reuse it (avoids inflating buffer creation statistics)\n\n    const constantValue = normalizeConstantArrayValue(value);\n\n    const byteLength = constantValue.byteLength * elementCount;\n    const length = constantValue.length * elementCount;\n\n    if (this.buffer && byteLength !== this.buffer.byteLength) {\n      throw new Error(\n        `Buffer size is immutable, byte length ${byteLength} !== ${this.buffer.byteLength}.`\n      );\n    }\n    let updateNeeded = !this.buffer;\n\n    this.buffer = this.buffer || this.device.createBuffer({byteLength});\n\n    // Reallocate and update contents if needed\n    // @ts-ignore TODO fix types\n    updateNeeded ||= !compareConstantArrayValues(constantValue, this.bufferValue);\n\n    if (updateNeeded) {\n      // Create a typed array that is big enough, and fill it with the required data\n      const typedArray = getScratchArray(value.constructor, length);\n      fillArray({target: typedArray, source: constantValue, start: 0, count: length});\n      this.buffer.write(typedArray);\n      this.bufferValue = value;\n    }\n\n    return this.buffer;\n  }\n}\n\n// HELPER FUNCTIONS\n\n/**\n * TODO - convert Arrays based on known type? (read type from accessor, don't assume Float32Array)\n * TODO - handle single values for size 1 attributes?\n */\nfunction normalizeConstantArrayValue(arrayValue: NumericArray) {\n  if (Array.isArray(arrayValue)) {\n    return new Float32Array(arrayValue);\n  }\n  return arrayValue;\n}\n\n/**\n *\n */\nfunction compareConstantArrayValues(v1: NumericArray, v2: NumericArray): boolean {\n  if (!v1 || !v2 || v1.length !== v2.length || v1.constructor !== v2.constructor) {\n    return false;\n  }\n  for (let i = 0; i < v1.length; ++i) {\n    if (v1[i] !== v2[i]) {\n      return false;\n    }\n  }\n  return true;\n}\n", "import type {PrimitiveTopology, ShaderLayout, TransformFeedbackProps} from '@luma.gl/core';\nimport {log, TransformFeedback, Buffer, BufferRange} from '@luma.gl/core';\nimport {GL} from '@luma.gl/webgl/constants';\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from '../../index';\nimport {getGLPrimitive} from '../helpers/webgl-topology-utils';\n\nexport class WEBGLTransformFeedback extends TransformFeedback {\n  readonly device: WebGLDevice;\n  readonly gl: WebGL2RenderingContext;\n  readonly handle: WebGLTransformFeedback;\n\n  /**\n   * NOTE: The Model already has this information while drawing, but\n   * TransformFeedback currently needs it internally, to look up\n   * varying information outside of a draw() call.\n   */\n  readonly layout: ShaderLayout;\n  buffers: Record<string, BufferRange> = {};\n  unusedBuffers: Record<string, Buffer> = {};\n  /**\n   * Allows us to avoid a Chrome bug where a buffer that is already bound to a\n   * different target cannot be bound to 'TRANSFORM_FEEDBACK_BUFFER' target.\n   * This a major workaround, see: https://github.com/KhronosGroup/WebGL/issues/2346\n   */\n  bindOnUse = true;\n  private _bound: boolean = false;\n\n  constructor(device: WebGLDevice, props: TransformFeedbackProps) {\n    super(device, props);\n\n    this.device = device;\n    this.gl = device.gl;\n    this.handle = this.props.handle || this.gl.createTransformFeedback();\n    this.layout = this.props.layout;\n\n    if (props.buffers) {\n      this.setBuffers(props.buffers);\n    }\n\n    Object.seal(this);\n  }\n\n  override destroy(): void {\n    this.gl.deleteTransformFeedback(this.handle);\n    super.destroy();\n  }\n\n  begin(topology: PrimitiveTopology = 'point-list'): void {\n    this.gl.bindTransformFeedback(GL.TRANSFORM_FEEDBACK, this.handle);\n    if (this.bindOnUse) {\n      this._bindBuffers();\n    }\n    this.gl.beginTransformFeedback(getGLPrimitive(topology));\n  }\n\n  end(): void {\n    this.gl.endTransformFeedback();\n    if (this.bindOnUse) {\n      this._unbindBuffers();\n    }\n    this.gl.bindTransformFeedback(GL.TRANSFORM_FEEDBACK, null);\n  }\n\n  // SUBCLASS\n\n  setBuffers(buffers: Record<string, Buffer | BufferRange>): void {\n    this.buffers = {};\n    this.unusedBuffers = {};\n\n    this.bind(() => {\n      for (const [bufferName, buffer] of Object.entries(buffers)) {\n        this.setBuffer(bufferName, buffer);\n      }\n    });\n  }\n\n  setBuffer(locationOrName: string | number, bufferOrRange: Buffer | BufferRange): void {\n    const location = this._getVaryingIndex(locationOrName);\n    const {buffer, byteLength, byteOffset} = this._getBufferRange(bufferOrRange);\n\n    if (location < 0) {\n      this.unusedBuffers[locationOrName] = buffer;\n      log.warn(`${this.id} unusedBuffers varying buffer ${locationOrName}`)();\n      return;\n    }\n\n    this.buffers[location] = {buffer, byteLength, byteOffset};\n\n    // Need to avoid chrome bug where buffer that is already bound to a different target\n    // cannot be bound to 'TRANSFORM_FEEDBACK_BUFFER' target.\n    if (!this.bindOnUse) {\n      this._bindBuffer(location, buffer, byteOffset, byteLength);\n    }\n  }\n\n  getBuffer(locationOrName: string | number): Buffer | BufferRange | null {\n    if (isIndex(locationOrName)) {\n      return this.buffers[locationOrName] || null;\n    }\n    const location = this._getVaryingIndex(locationOrName);\n    return this.buffers[location] ?? null;\n  }\n\n  bind(funcOrHandle: (() => void) | WebGLTransformFeedback | null = this.handle) {\n    if (typeof funcOrHandle !== 'function') {\n      this.gl.bindTransformFeedback(GL.TRANSFORM_FEEDBACK, funcOrHandle);\n      return this;\n    }\n\n    let value: unknown;\n\n    if (!this._bound) {\n      this.gl.bindTransformFeedback(GL.TRANSFORM_FEEDBACK, this.handle);\n      this._bound = true;\n      value = funcOrHandle();\n      this._bound = false;\n      this.gl.bindTransformFeedback(GL.TRANSFORM_FEEDBACK, null);\n    } else {\n      value = funcOrHandle();\n    }\n\n    return value;\n  }\n\n  unbind() {\n    this.bind(null);\n  }\n\n  // PRIVATE METHODS\n\n  /** Extract offsets for bindBufferRange */\n  protected _getBufferRange(\n    bufferOrRange: Buffer | {buffer: Buffer; byteOffset?: number; byteLength?: number}\n  ): Required<BufferRange> {\n    if (bufferOrRange instanceof WEBGLBuffer) {\n      return {buffer: bufferOrRange, byteOffset: 0, byteLength: bufferOrRange.byteLength};\n    }\n\n    // To use bindBufferRange either offset or size must be specified.\n    // @ts-expect-error Must be a BufferRange.\n    const {buffer, byteOffset = 0, byteLength = bufferOrRange.buffer.byteLength} = bufferOrRange;\n    return {buffer, byteOffset, byteLength};\n  }\n\n  protected _getVaryingIndex(locationOrName: string | number): number {\n    if (isIndex(locationOrName)) {\n      return Number(locationOrName);\n    }\n\n    for (const varying of this.layout.varyings || []) {\n      if (locationOrName === varying.name) {\n        return varying.location;\n      }\n    }\n\n    return -1;\n  }\n\n  /**\n   * Need to avoid chrome bug where buffer that is already bound to a different target\n   * cannot be bound to 'TRANSFORM_FEEDBACK_BUFFER' target.\n   */\n  protected _bindBuffers(): void {\n    for (const [bufferIndex, bufferEntry] of Object.entries(this.buffers)) {\n      const {buffer, byteLength, byteOffset} = this._getBufferRange(bufferEntry);\n      this._bindBuffer(Number(bufferIndex), buffer, byteOffset, byteLength);\n    }\n  }\n\n  protected _unbindBuffers(): void {\n    for (const bufferIndex in this.buffers) {\n      this.gl.bindBufferBase(GL.TRANSFORM_FEEDBACK_BUFFER, Number(bufferIndex), null);\n    }\n  }\n\n  protected _bindBuffer(index: number, buffer: Buffer, byteOffset = 0, byteLength?: number): void {\n    const handle = buffer && (buffer as WEBGLBuffer).handle;\n    if (!handle || byteLength === undefined) {\n      this.gl.bindBufferBase(GL.TRANSFORM_FEEDBACK_BUFFER, index, handle);\n    } else {\n      this.gl.bindBufferRange(GL.TRANSFORM_FEEDBACK_BUFFER, index, handle, byteOffset, byteLength);\n    }\n  }\n}\n\n/**\n * Returns true if the given value is an integer, or a string that\n * trivially converts to an integer (only numeric characters).\n */\nfunction isIndex(value: string | number): boolean {\n  if (typeof value === 'number') {\n    return Number.isInteger(value);\n  }\n  return /^\\d+$/.test(value);\n}\n", "// WebGL2 QuerySet (also handles disjoint timer extensions)\nimport {QuerySet, QuerySetProps} from '@luma.gl/core';\nimport {GL} from '@luma.gl/webgl/constants';\nimport {WebGLDevice} from '../webgl-device';\n\ntype WebGLPendingQuery = {\n  handle: WebGLQuery;\n  promise: Promise<bigint> | null;\n  result: bigint | null;\n  disjoint: boolean;\n  cancelled: boolean;\n  pollRequestId: number | null;\n  resolve: ((value: bigint) => void) | null;\n  reject: ((error: Error) => void) | null;\n};\n\ntype WebGLTimestampPair = {\n  activeQuery: WebGLPendingQuery | null;\n  completedQueries: WebGLPendingQuery[];\n};\n\n/**\n * Asynchronous queries for different kinds of information\n */\nexport class WEBGLQuerySet extends QuerySet {\n  readonly device: WebGLDevice;\n  readonly handle: WebGLQuery | null;\n\n  protected _timestampPairs: WebGLTimestampPair[] = [];\n  protected _pendingReads: Set<WebGLPendingQuery> = new Set();\n  protected _occlusionQuery: WebGLPendingQuery | null = null;\n  protected _occlusionActive = false;\n\n  override get [Symbol.toStringTag](): string {\n    return 'QuerySet';\n  }\n\n  constructor(device: WebGLDevice, props: QuerySetProps) {\n    super(device, props);\n    this.device = device;\n\n    if (props.type === 'timestamp') {\n      if (props.count < 2) {\n        throw new Error('Timestamp QuerySet requires at least two query slots');\n      }\n      this._timestampPairs = new Array(Math.ceil(props.count / 2))\n        .fill(null)\n        .map(() => ({activeQuery: null, completedQueries: []}));\n      this.handle = null;\n    } else {\n      if (props.count > 1) {\n        throw new Error('WebGL occlusion QuerySet can only have one value');\n      }\n      const handle = this.device.gl.createQuery();\n      if (!handle) {\n        throw new Error('WebGL query not supported');\n      }\n      this.handle = handle;\n    }\n\n    Object.seal(this);\n  }\n\n  override destroy(): void {\n    if (this.destroyed) {\n      return;\n    }\n\n    if (this.handle) {\n      this.device.gl.deleteQuery(this.handle);\n    }\n\n    for (const pair of this._timestampPairs) {\n      if (pair.activeQuery) {\n        this._cancelPendingQuery(pair.activeQuery);\n        this.device.gl.deleteQuery(pair.activeQuery.handle);\n      }\n      for (const query of pair.completedQueries) {\n        this._cancelPendingQuery(query);\n        this.device.gl.deleteQuery(query.handle);\n      }\n    }\n\n    if (this._occlusionQuery) {\n      this._cancelPendingQuery(this._occlusionQuery);\n      this.device.gl.deleteQuery(this._occlusionQuery.handle);\n    }\n\n    for (const query of Array.from(this._pendingReads)) {\n      this._cancelPendingQuery(query);\n    }\n\n    this.destroyResource();\n  }\n\n  isResultAvailable(queryIndex?: number): boolean {\n    if (this.props.type === 'timestamp') {\n      if (queryIndex === undefined) {\n        return this._timestampPairs.some((_, pairIndex) =>\n          this._isTimestampPairAvailable(pairIndex)\n        );\n      }\n      return this._isTimestampPairAvailable(this._getTimestampPairIndex(queryIndex));\n    }\n\n    if (!this._occlusionQuery) {\n      return false;\n    }\n\n    return this._pollQueryAvailability(this._occlusionQuery);\n  }\n\n  async readResults(options?: {firstQuery?: number; queryCount?: number}): Promise<bigint[]> {\n    const firstQuery = options?.firstQuery || 0;\n    const queryCount = options?.queryCount || this.props.count - firstQuery;\n    this._validateRange(firstQuery, queryCount);\n\n    if (this.props.type === 'timestamp') {\n      const results = new Array<bigint>(queryCount).fill(0n);\n      const startPairIndex = Math.floor(firstQuery / 2);\n      const endPairIndex = Math.floor((firstQuery + queryCount - 1) / 2);\n\n      for (let pairIndex = startPairIndex; pairIndex <= endPairIndex; pairIndex++) {\n        const duration = await this._consumeTimestampPairResult(pairIndex);\n        const beginSlot = pairIndex * 2;\n        const endSlot = beginSlot + 1;\n\n        if (beginSlot >= firstQuery && beginSlot < firstQuery + queryCount) {\n          results[beginSlot - firstQuery] = 0n;\n        }\n        if (endSlot >= firstQuery && endSlot < firstQuery + queryCount) {\n          results[endSlot - firstQuery] = duration;\n        }\n      }\n\n      return results;\n    }\n\n    if (!this._occlusionQuery) {\n      throw new Error('Occlusion query has not been started');\n    }\n\n    return [await this._consumeQueryResult(this._occlusionQuery)];\n  }\n\n  async readTimestampDuration(beginIndex: number, endIndex: number): Promise<number> {\n    if (this.props.type !== 'timestamp') {\n      throw new Error('Timestamp durations require a timestamp QuerySet');\n    }\n    if (beginIndex < 0 || endIndex >= this.props.count || endIndex <= beginIndex) {\n      throw new Error('Timestamp duration range is out of bounds');\n    }\n    if (beginIndex % 2 !== 0 || endIndex !== beginIndex + 1) {\n      throw new Error('WebGL timestamp durations require adjacent even/odd query indices');\n    }\n\n    const result = await this._consumeTimestampPairResult(this._getTimestampPairIndex(beginIndex));\n    return Number(result) / 1e6;\n  }\n\n  beginOcclusionQuery(): void {\n    if (this.props.type !== 'occlusion') {\n      throw new Error('Occlusion queries require an occlusion QuerySet');\n    }\n    if (!this.handle) {\n      throw new Error('WebGL occlusion query is not available');\n    }\n    if (this._occlusionActive) {\n      throw new Error('Occlusion query is already active');\n    }\n\n    this.device.gl.beginQuery(GL.ANY_SAMPLES_PASSED, this.handle);\n    this._occlusionQuery = {\n      handle: this.handle,\n      promise: null,\n      result: null,\n      disjoint: false,\n      cancelled: false,\n      pollRequestId: null,\n      resolve: null,\n      reject: null\n    };\n    this._occlusionActive = true;\n  }\n\n  endOcclusionQuery(): void {\n    if (!this._occlusionActive) {\n      throw new Error('Occlusion query is not active');\n    }\n\n    this.device.gl.endQuery(GL.ANY_SAMPLES_PASSED);\n    this._occlusionActive = false;\n  }\n\n  writeTimestamp(queryIndex: number): void {\n    if (this.props.type !== 'timestamp') {\n      throw new Error('Timestamp writes require a timestamp QuerySet');\n    }\n\n    const pairIndex = this._getTimestampPairIndex(queryIndex);\n    const pair = this._timestampPairs[pairIndex];\n\n    if (queryIndex % 2 === 0) {\n      if (pair.activeQuery) {\n        throw new Error('Timestamp query pair is already active');\n      }\n\n      const handle = this.device.gl.createQuery();\n      if (!handle) {\n        throw new Error('WebGL query not supported');\n      }\n\n      const query: WebGLPendingQuery = {\n        handle,\n        promise: null,\n        result: null,\n        disjoint: false,\n        cancelled: false,\n        pollRequestId: null,\n        resolve: null,\n        reject: null\n      };\n\n      this.device.gl.beginQuery(GL.TIME_ELAPSED_EXT, handle);\n      pair.activeQuery = query;\n      return;\n    }\n\n    if (!pair.activeQuery) {\n      throw new Error('Timestamp query pair was ended before it was started');\n    }\n\n    this.device.gl.endQuery(GL.TIME_ELAPSED_EXT);\n    pair.completedQueries.push(pair.activeQuery);\n    pair.activeQuery = null;\n  }\n\n  protected _validateRange(firstQuery: number, queryCount: number): void {\n    if (firstQuery < 0 || queryCount < 0 || firstQuery + queryCount > this.props.count) {\n      throw new Error('Query read range is out of bounds');\n    }\n  }\n\n  protected _getTimestampPairIndex(queryIndex: number): number {\n    if (queryIndex < 0 || queryIndex >= this.props.count) {\n      throw new Error('Query index is out of bounds');\n    }\n\n    return Math.floor(queryIndex / 2);\n  }\n\n  protected _isTimestampPairAvailable(pairIndex: number): boolean {\n    const pair = this._timestampPairs[pairIndex];\n    if (!pair || pair.completedQueries.length === 0) {\n      return false;\n    }\n\n    return this._pollQueryAvailability(pair.completedQueries[0]);\n  }\n\n  protected _pollQueryAvailability(query: WebGLPendingQuery): boolean {\n    if (query.cancelled || this.destroyed) {\n      query.result = 0n;\n      return true;\n    }\n\n    if (query.result !== null || query.disjoint) {\n      return true;\n    }\n\n    const resultAvailable = this.device.gl.getQueryParameter(\n      query.handle,\n      GL.QUERY_RESULT_AVAILABLE\n    );\n    if (!resultAvailable) {\n      return false;\n    }\n\n    const isDisjoint = Boolean(this.device.gl.getParameter(GL.GPU_DISJOINT_EXT));\n    query.disjoint = isDisjoint;\n    query.result = isDisjoint\n      ? 0n\n      : BigInt(this.device.gl.getQueryParameter(query.handle, GL.QUERY_RESULT));\n    return true;\n  }\n\n  protected async _consumeTimestampPairResult(pairIndex: number): Promise<bigint> {\n    const pair = this._timestampPairs[pairIndex];\n    if (!pair || pair.completedQueries.length === 0) {\n      throw new Error('Timestamp query pair has no completed result');\n    }\n\n    const query = pair.completedQueries.shift()!;\n\n    try {\n      return await this._consumeQueryResult(query);\n    } finally {\n      this.device.gl.deleteQuery(query.handle);\n    }\n  }\n\n  protected _consumeQueryResult(query: WebGLPendingQuery): Promise<bigint> {\n    if (query.promise) {\n      return query.promise;\n    }\n\n    this._pendingReads.add(query);\n    query.promise = new Promise((resolve, reject) => {\n      query.resolve = resolve;\n      query.reject = reject;\n\n      const poll = () => {\n        query.pollRequestId = null;\n\n        if (query.cancelled || this.destroyed) {\n          this._pendingReads.delete(query);\n          query.promise = null;\n          query.resolve = null;\n          query.reject = null;\n          resolve(0n);\n          return;\n        }\n\n        if (!this._pollQueryAvailability(query)) {\n          query.pollRequestId = this._requestAnimationFrame(poll);\n          return;\n        }\n\n        this._pendingReads.delete(query);\n        query.promise = null;\n        query.resolve = null;\n        query.reject = null;\n        if (query.disjoint) {\n          reject(new Error('GPU timestamp query was invalidated by a disjoint event'));\n        } else {\n          resolve(query.result || 0n);\n        }\n      };\n\n      poll();\n    });\n\n    return query.promise;\n  }\n\n  protected _cancelPendingQuery(query: WebGLPendingQuery): void {\n    this._pendingReads.delete(query);\n    query.cancelled = true;\n    if (query.pollRequestId !== null) {\n      this._cancelAnimationFrame(query.pollRequestId);\n      query.pollRequestId = null;\n    }\n    if (query.resolve) {\n      const resolve = query.resolve;\n      query.promise = null;\n      query.resolve = null;\n      query.reject = null;\n      resolve(0n);\n    }\n  }\n\n  protected _requestAnimationFrame(callback: FrameRequestCallback): number {\n    return requestAnimationFrame(callback);\n  }\n\n  protected _cancelAnimationFrame(requestId: number): void {\n    cancelAnimationFrame(requestId);\n  }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Fence, type FenceProps} from '@luma.gl/core';\nimport {WebGLDevice} from '../webgl-device';\n\n/** WebGL fence implemented with gl.fenceSync */\nexport class WEBGLFence extends Fence {\n  readonly device: WebGLDevice;\n  readonly gl: WebGL2RenderingContext;\n  readonly handle: WebGLSync;\n  readonly signaled: Promise<void>;\n  private _signaled = false;\n\n  constructor(device: WebGLDevice, props: FenceProps = {}) {\n    super(device, {});\n    this.device = device;\n    this.gl = device.gl;\n\n    const sync = this.props.handle || this.gl.fenceSync(this.gl.SYNC_GPU_COMMANDS_COMPLETE, 0);\n    if (!sync) {\n      throw new Error('Failed to create WebGL fence');\n    }\n    this.handle = sync;\n\n    this.signaled = new Promise(resolve => {\n      const poll = () => {\n        const status = this.gl.clientWaitSync(this.handle, 0, 0);\n        if (status === this.gl.ALREADY_SIGNALED || status === this.gl.CONDITION_SATISFIED) {\n          this._signaled = true;\n          resolve();\n        } else {\n          setTimeout(poll, 1);\n        }\n      };\n      poll();\n    });\n  }\n\n  isSignaled(): boolean {\n    if (this._signaled) {\n      return true;\n    }\n    const status = this.gl.getSyncParameter(this.handle, this.gl.SYNC_STATUS);\n    this._signaled = status === this.gl.SIGNALED;\n    return this._signaled;\n  }\n\n  destroy(): void {\n    if (!this.destroyed) {\n      this.gl.deleteSync(this.handle);\n    }\n  }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {GL} from '@luma.gl/webgl/constants';\n\n// Returns number of components in a specific readPixels WebGL format\nexport function glFormatToComponents(format: GL): 0 | 1 | 2 | 3 | 4 {\n  switch (format) {\n    case GL.ALPHA:\n    case GL.R32F:\n    case GL.RED:\n    case GL.RED_INTEGER:\n      return 1;\n    case GL.RG32I:\n    case GL.RG32UI:\n    case GL.RG32F:\n    case GL.RG_INTEGER:\n    case GL.RG:\n      return 2;\n    case GL.RGB:\n    case GL.RGB_INTEGER:\n    case GL.RGB32F:\n      return 3;\n    case GL.RGBA:\n    case GL.RGBA_INTEGER:\n    case GL.RGBA32F:\n      return 4;\n    // TODO: Add support for additional WebGL2 formats\n    default:\n      return 0;\n  }\n}\n\n// Return byte count for given readPixels WebGL type\nexport function glTypeToBytes(type: GL): 0 | 1 | 2 | 4 {\n  switch (type) {\n    case GL.UNSIGNED_BYTE:\n      return 1;\n    case GL.UNSIGNED_SHORT_5_6_5:\n    case GL.UNSIGNED_SHORT_4_4_4_4:\n    case GL.UNSIGNED_SHORT_5_5_5_1:\n      return 2;\n    case GL.FLOAT:\n      return 4;\n    // TODO: Add support for additional WebGL2 types\n    default:\n      return 0;\n  }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// @ts-nocheck This file will be deleted in upcoming refactor\n\nimport type {Buffer, Texture, FramebufferProps} from '@luma.gl/core';\nimport {Framebuffer, dataTypeDecoder} from '@luma.gl/core';\nimport {\n  GL,\n  GLTextureTarget,\n  GLTextureCubeMapTarget,\n  GLTexelDataFormat,\n  GLPixelType,\n  GLDataType\n} from '@luma.gl/webgl/constants';\n\nimport {convertDataTypeToGLDataType} from '../converters/webgl-shadertypes';\nimport {WEBGLFramebuffer} from '../resources/webgl-framebuffer';\nimport {glFormatToComponents, glTypeToBytes} from './format-utils';\nimport {WEBGLBuffer} from '../resources/webgl-buffer';\nimport {WEBGLTexture} from '../resources/webgl-texture';\nimport {convertGLDataTypeToDataType} from '../converters/shader-formats';\n\n/** A \"border\" parameter is required in many WebGL texture APIs, but must always be 0... */\nconst BORDER = 0;\n\n/**\n * Options for setting data into a texture\n */\nexport type WebGLSetTextureOptions = {\n  dimension: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n  height: number;\n  width: number;\n  depth: number;\n  mipLevel?: number;\n  glTarget: GLTextureTarget;\n  glInternalFormat: GL;\n  glFormat: GLTexelDataFormat;\n  glType: GLPixelType;\n  compressed?: boolean;\n  byteOffset?: number;\n  byteLength?: number;\n};\n\n/**\n * Options for copying an image or data into a texture\n *\n * @param {GLenum} format - internal format of image data.\n * @param {GLenum} type\n *  - format of array (autodetect from type) or\n *  - (WEBGL2) format of buffer or ArrayBufferView\n * @param {GLenum} dataFormat - format of image data.\n * @param {Number} offset - (WEBGL2) offset from start of buffer\n * @parameters - temporary settings to be applied, can be used to supply pixel store settings.\n */\nexport type WebGLCopyTextureOptions = {\n  dimension: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n  /** mip level to be updated */\n  mipLevel?: number;\n  /** width of the sub image to be updated */\n  width: number;\n  /** height of the sub image to be updated */\n  height: number;\n  /** depth of texture to be updated */\n  depth?: number;\n  /** xOffset from where texture to be updated */\n  x?: number;\n  /** yOffset from where texture to be updated */\n  y?: number;\n  /** yOffset from where texture to be updated */\n  z?: number;\n\n  glTarget: GLTextureTarget;\n  glInternalFormat: GL;\n  glFormat: GL;\n  glType: GL;\n  compressed?: boolean;\n  byteOffset?: number;\n  byteLength?: number;\n};\n\n/**\n * Copy a region of compressed data from a GPU memory buffer into this texture.\n */\nexport function copyGPUBufferToMipLevel(\n  gl: WebGL2RenderingContext,\n  webglBuffer: WebGLBuffer,\n  byteLength: number,\n  options: WebGLCopyTextureOptions\n): void {\n  const {dimension, width, height, depth = 0, mipLevel = 0, byteOffset = 0} = options;\n  const {x = 0, y = 0, z = 0} = options;\n  const {glFormat, glType, compressed} = options;\n  const glTarget = getWebGLCubeFaceTarget(options.glTarget, dimension, depth);\n\n  gl.bindBuffer(GL.PIXEL_UNPACK_BUFFER, webglBuffer);\n\n  switch (dimension) {\n    case '2d-array':\n    case '3d':\n      // 3 dimensional textures requires 3D texture functions\n      if (compressed) {\n        // TODO enable extension?\n        // biome-ignore format: preserve layout\n        gl.compressedTexSubImage3D(glTarget, mipLevel, x, y, z, width, height, depth, glFormat, byteLength, byteOffset);\n      } else {\n        // biome-ignore format: preserve layout\n        gl.texSubImage3D(glTarget, mipLevel, x, y, z, width, height, depth, glFormat, glType, byteOffset);\n      }\n      break;\n\n    case '2d':\n    case 'cube':\n      if (compressed) {\n        // biome-ignore format: preserve layout\n        gl.compressedTexSubImage2D(glTarget, mipLevel, x, y, width, height, glFormat, byteLength, byteOffset);\n      } else {\n        // biome-ignore format: preserve layout\n        gl.texSubImage2D(glTarget, mipLevel, x, y, width, height, BORDER, glFormat, byteOffset);\n      }\n      break;\n\n    default:\n      throw new Error(dimension);\n  }\n}\n\n// INTERNAL HELPERS\n\n/** Convert a WebGPU style texture constant to a WebGL style texture constant */\nexport function getWebGLTextureTarget(\n  dimension: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d'\n): GLTextureTarget {\n  // biome-ignore format: preserve layout\n  switch (dimension) {\n    case '1d': break; // not supported in any WebGL version\n    case '2d': return GL.TEXTURE_2D; // supported in WebGL1\n    case '3d': return GL.TEXTURE_3D; // supported in WebGL2\n    case 'cube': return GL.TEXTURE_CUBE_MAP; // supported in WebGL1\n    case '2d-array': return GL.TEXTURE_2D_ARRAY; // supported in WebGL2\n    case 'cube-array': break; // not supported in any WebGL version\n  }\n  throw new Error(dimension);\n}\n\n/**\n * In WebGL, cube maps specify faces by overriding target instead of using the depth parameter.\n * @note We still bind the texture using GL.TEXTURE_CUBE_MAP, but we need to use the face-specific target when setting mip levels.\n * @returns glTarget unchanged, if dimension !== 'cube'.\n */\nexport function getWebGLCubeFaceTarget(\n  glTarget: GLTextureTarget,\n  dimension: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d',\n  level: number\n): GLTextureTarget | GLTextureCubeMapTarget {\n  return dimension === 'cube' ? GL.TEXTURE_CUBE_MAP_POSITIVE_X + level : glTarget;\n}\nexport type ReadPixelsToArrayOptions = {\n  sourceX?: number;\n  sourceY?: number;\n  sourceFormat?: number;\n  sourceAttachment?: number;\n  target?: Uint8Array | Uint16Array | Float32Array;\n  // following parameters are auto deduced if not provided\n  sourceWidth?: number;\n  sourceHeight?: number;\n  sourceDepth?: number;\n  sourceType?: number;\n};\n\nexport type ReadPixelsToBufferOptions = {\n  sourceX?: number;\n  sourceY?: number;\n  sourceFormat?: number;\n  target?: Buffer; // A new Buffer object is created when not provided.\n  targetByteOffset?: number; // byte offset in buffer object\n  // following parameters are auto deduced if not provided\n  sourceWidth?: number;\n  sourceHeight?: number;\n  sourceType?: number;\n};\n\n/**\n * Copies data from a type  or a Texture object into ArrayBuffer object.\n * App can provide targetPixelArray or have it auto allocated by this method\n *  newly allocated by this method unless provided by app.\n * @deprecated Use CommandEncoder.copyTextureToBuffer and Buffer.read\n * @note Slow requires roundtrip to GPU\n *\n * @param source\n * @param options\n * @returns pixel array,\n */\nexport function readPixelsToArray(\n  source: Framebuffer | Texture,\n  options?: ReadPixelsToArrayOptions\n): Uint8Array | Uint16Array | Float32Array {\n  const {\n    sourceX = 0,\n    sourceY = 0,\n    sourceAttachment = 0 // TODO - support gl.readBuffer\n  } = options || {};\n  let {\n    target = null,\n    // following parameters are auto deduced if not provided\n    sourceWidth,\n    sourceHeight,\n    sourceDepth,\n    sourceFormat,\n    sourceType\n  } = options || {};\n\n  const {framebuffer, deleteFramebuffer} = getFramebuffer(source);\n  // assert(framebuffer);\n  const {gl, handle} = framebuffer;\n\n  sourceWidth ||= framebuffer.width;\n  sourceHeight ||= framebuffer.height;\n\n  const texture = framebuffer.colorAttachments[sourceAttachment]?.texture;\n  if (!texture) {\n    throw new Error(`Invalid framebuffer attachment ${sourceAttachment}`);\n  }\n  sourceDepth = texture?.depth || 1;\n\n  sourceFormat ||= texture?.glFormat || GL.RGBA;\n  // Deduce the type from color attachment if not provided.\n  sourceType ||= texture?.glType || GL.UNSIGNED_BYTE;\n\n  // Deduce type and allocated pixelArray if needed\n  target = getPixelArray(target, sourceType, sourceFormat, sourceWidth, sourceHeight, sourceDepth);\n\n  // Pixel array available, if necessary, deduce type from it.\n  const signedType = dataTypeDecoder.getDataType(target);\n  sourceType = sourceType || convertDataTypeToGLDataType(signedType);\n\n  // Note: luma.gl overrides bindFramebuffer so that we can reliably restore the previous framebuffer (this is the only function for which we do that)\n  const prevHandle = gl.bindFramebuffer(\n    GL.FRAMEBUFFER,\n    handle\n  ) as unknown as WebGLFramebuffer | null;\n\n  // Select the color attachment to read from\n  gl.readBuffer(gl.COLOR_ATTACHMENT0 + sourceAttachment);\n\n  // There is a lot of hedging in the WebGL2 spec about what formats are guaranteed to be readable\n  // (It should always be possible to read RGBA/UNSIGNED_BYTE, but most other combinations are not guaranteed)\n  // Querying is possible but expensive:\n  // const {device} = framebuffer;\n  // texture.glReadFormat ||= gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_FORMAT);\n  // texture.glReadType ||= gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE);\n  // console.log('params', device.getGLKey(texture.glReadFormat), device.getGLKey(texture.glReadType));\n\n  gl.readPixels(sourceX, sourceY, sourceWidth, sourceHeight, sourceFormat, sourceType, target);\n  gl.readBuffer(gl.COLOR_ATTACHMENT0);\n  gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);\n\n  if (deleteFramebuffer) {\n    framebuffer.destroy();\n  }\n\n  return target;\n}\n\n/**\n * Copies data from a Framebuffer or a Texture object into a Buffer object.\n * NOTE: doesn't wait for copy to be complete, it programs GPU to perform a DMA transffer.\n * @deprecated Use CommandEncoder\n * @param source\n * @param options\n */\nexport function readPixelsToBuffer(\n  source: Framebuffer | Texture,\n  options?: ReadPixelsToBufferOptions\n): WEBGLBuffer {\n  const {\n    target,\n    sourceX = 0,\n    sourceY = 0,\n    sourceFormat = GL.RGBA,\n    targetByteOffset = 0\n  } = options || {};\n  // following parameters are auto deduced if not provided\n  let {sourceWidth, sourceHeight, sourceType} = options || {};\n  const {framebuffer, deleteFramebuffer} = getFramebuffer(source);\n  // assert(framebuffer);\n  sourceWidth = sourceWidth || framebuffer.width;\n  sourceHeight = sourceHeight || framebuffer.height;\n\n  // Asynchronous read (PIXEL_PACK_BUFFER) is WebGL2 only feature\n  const webglFramebuffer = framebuffer;\n\n  // deduce type if not available.\n  sourceType = sourceType || GL.UNSIGNED_BYTE;\n\n  let webglBufferTarget = target as unknown as WEBGLBuffer | undefined;\n  if (!webglBufferTarget) {\n    // Create new buffer with enough size\n    const components = glFormatToComponents(sourceFormat);\n    const byteCount = glTypeToBytes(sourceType);\n    const byteLength = targetByteOffset + sourceWidth * sourceHeight * components * byteCount;\n    webglBufferTarget = webglFramebuffer.device.createBuffer({byteLength});\n  }\n\n  // TODO(donmccurdy): Do we have tests to confirm this is working?\n  const commandEncoder = source.device.createCommandEncoder();\n  commandEncoder.copyTextureToBuffer({\n    sourceTexture: source as Texture,\n    width: sourceWidth,\n    height: sourceHeight,\n    origin: [sourceX, sourceY],\n    destinationBuffer: webglBufferTarget,\n    byteOffset: targetByteOffset\n  });\n  commandEncoder.destroy();\n\n  if (deleteFramebuffer) {\n    framebuffer.destroy();\n  }\n\n  return webglBufferTarget;\n}\n\n/**\n * Copy a rectangle from a Framebuffer or Texture object into a texture (at an offset)\n * @deprecated Use CommandEncoder\n */\n// eslint-disable-next-line complexity, max-statements\nexport function copyToTexture(\n  sourceTexture: Framebuffer | Texture,\n  destinationTexture: Texture | GL,\n  options?: {\n    sourceX?: number;\n    sourceY?: number;\n\n    targetX?: number;\n    targetY?: number;\n    targetZ?: number;\n    targetMipmaplevel?: number;\n    targetInternalFormat?: number;\n\n    width?: number; // defaults to target width\n    height?: number; // defaults to target height\n  }\n): Texture {\n  const {\n    sourceX = 0,\n    sourceY = 0,\n    // attachment = GL.COLOR_ATTACHMENT0, // TODO - support gl.readBuffer\n    targetMipmaplevel = 0,\n    targetInternalFormat = GL.RGBA\n  } = options || {};\n  let {\n    targetX,\n    targetY,\n    targetZ,\n    width, // defaults to target width\n    height // defaults to target height\n  } = options || {};\n\n  const {framebuffer, deleteFramebuffer} = getFramebuffer(sourceTexture);\n  // assert(framebuffer);\n  const webglFramebuffer = framebuffer;\n  const {device, handle} = webglFramebuffer;\n  const isSubCopy =\n    typeof targetX !== 'undefined' ||\n    typeof targetY !== 'undefined' ||\n    typeof targetZ !== 'undefined';\n  targetX = targetX || 0;\n  targetY = targetY || 0;\n  targetZ = targetZ || 0;\n  const prevHandle = device.gl.bindFramebuffer(GL.FRAMEBUFFER, handle);\n  // TODO - support gl.readBuffer (WebGL2 only)\n  // const prevBuffer = gl.readBuffer(attachment);\n  // assert(target);\n  let texture: WEBGLTexture | null = null;\n  let textureTarget: GL;\n  if (destinationTexture instanceof WEBGLTexture) {\n    texture = destinationTexture;\n    width = Number.isFinite(width) ? width : texture.width;\n    height = Number.isFinite(height) ? height : texture.height;\n    texture?._bind(0);\n    // @ts-ignore\n    textureTarget = texture.target;\n  } else {\n    // @ts-ignore\n    textureTarget = target;\n  }\n\n  if (!isSubCopy) {\n    device.gl.copyTexImage2D(\n      textureTarget,\n      targetMipmaplevel,\n      targetInternalFormat,\n      sourceX,\n      sourceY,\n      width,\n      height,\n      0 /* border must be 0 */\n    );\n  } else {\n    switch (textureTarget) {\n      case GL.TEXTURE_2D:\n      case GL.TEXTURE_CUBE_MAP:\n        device.gl.copyTexSubImage2D(\n          textureTarget,\n          targetMipmaplevel,\n          targetX,\n          targetY,\n          sourceX,\n          sourceY,\n          width,\n          height\n        );\n        break;\n      case GL.TEXTURE_2D_ARRAY:\n      case GL.TEXTURE_3D:\n        device.gl.copyTexSubImage3D(\n          textureTarget,\n          targetMipmaplevel,\n          targetX,\n          targetY,\n          targetZ,\n          sourceX,\n          sourceY,\n          width,\n          height\n        );\n        break;\n      default:\n    }\n  }\n  if (texture) {\n    texture._unbind();\n  }\n  // @ts-expect-error\n  device.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);\n  if (deleteFramebuffer) {\n    framebuffer.destroy();\n  }\n  return texture;\n}\n\nfunction getFramebuffer(source: Texture | Framebuffer): {\n  framebuffer: WEBGLFramebuffer;\n  deleteFramebuffer: boolean;\n} {\n  if (!(source instanceof Framebuffer)) {\n    return {framebuffer: toFramebuffer(source), deleteFramebuffer: true};\n  }\n  return {framebuffer: source as WEBGLFramebuffer, deleteFramebuffer: false};\n}\n\n/**\n * Wraps a given texture into a framebuffer object, that can be further used\n * to read data from the texture object.\n */\nexport function toFramebuffer(texture: Texture, props?: FramebufferProps): WEBGLFramebuffer {\n  const {device, width, height, id} = texture;\n  const framebuffer = device.createFramebuffer({\n    ...props,\n    id: `framebuffer-for-${id}`,\n    width,\n    height,\n    colorAttachments: [texture]\n  });\n  return framebuffer as WEBGLFramebuffer;\n}\n\n// eslint-disable-next-line max-params\nfunction getPixelArray(\n  pixelArray,\n  glType: GLDataType | GLPixelType,\n  glFormat: GL,\n  width: number,\n  height: number,\n  depth?: number\n): Uint8Array | Uint16Array | Float32Array {\n  if (pixelArray) {\n    return pixelArray;\n  }\n  // const formatInfo = getTextureFormatInfo(format);\n  // Allocate pixel array if not already available, using supplied type\n  glType ||= GL.UNSIGNED_BYTE;\n  const shaderType = convertGLDataTypeToDataType(glType);\n  const ArrayType = dataTypeDecoder.getTypedArrayConstructor(shaderType);\n  const components = glFormatToComponents(glFormat);\n  // TODO - check for composite type (components = 1).\n  return new ArrayType(width * height * components) as Uint8Array | Uint16Array | Float32Array;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {TypedArray} from '@math.gl/types';\nimport type {\n  DeviceProps,\n  DeviceInfo,\n  DeviceTextureFormatCapabilities,\n  CanvasContextProps,\n  PresentationContextProps,\n  PresentationContext,\n  Buffer,\n  Texture,\n  Framebuffer,\n  VertexArray,\n  VertexArrayProps,\n  BufferProps,\n  ShaderProps,\n  // Sampler,\n  SamplerProps,\n  TextureProps,\n  ExternalTexture,\n  ExternalTextureProps,\n  FramebufferProps,\n  // RenderPipeline,\n  RenderPipelineProps,\n  SharedRenderPipeline,\n  ComputePipeline,\n  ComputePipelineProps,\n  // CommandEncoder,\n  CommandEncoderProps,\n  TransformFeedbackProps,\n  QuerySetProps,\n  Resource,\n  VertexFormat\n} from '@luma.gl/core';\nimport {Device, CanvasContext, log} from '@luma.gl/core';\nimport type {GLExtensions} from '@luma.gl/webgl/constants';\nimport {WebGLStateTracker} from '../context/state-tracker/webgl-state-tracker';\nimport {createBrowserContext} from '../context/helpers/create-browser-context';\nimport {getWebGLContextData} from '../context/helpers/webgl-context-data';\nimport {getDeviceInfo} from './device-helpers/webgl-device-info';\nimport {WebGLDeviceFeatures} from './device-helpers/webgl-device-features';\nimport {WebGLDeviceLimits} from './device-helpers/webgl-device-limits';\nimport {WebGLCanvasContext} from './webgl-canvas-context';\nimport {WebGLPresentationContext} from './webgl-presentation-context';\nimport type {Spector} from '../context/debug/spector-types';\nimport {initializeSpectorJS} from '../context/debug/spector';\nimport {makeDebugContext} from '../context/debug/webgl-developer-tools';\nimport {getTextureFormatCapabilitiesWebGL} from './converters/webgl-texture-table';\nimport {uid} from '../utils/uid';\n\nimport {WEBGLBuffer} from './resources/webgl-buffer';\nimport {WEBGLShader} from './resources/webgl-shader';\nimport {WEBGLSampler} from './resources/webgl-sampler';\nimport {WEBGLTexture} from './resources/webgl-texture';\nimport {WEBGLFramebuffer} from './resources/webgl-framebuffer';\nimport {WEBGLRenderPipeline} from './resources/webgl-render-pipeline';\nimport {WEBGLSharedRenderPipeline} from './resources/webgl-shared-render-pipeline';\nimport {WEBGLCommandEncoder} from './resources/webgl-command-encoder';\nimport {WEBGLCommandBuffer} from './resources/webgl-command-buffer';\nimport {WEBGLVertexArray} from './resources/webgl-vertex-array';\nimport {WEBGLTransformFeedback} from './resources/webgl-transform-feedback';\nimport {WEBGLQuerySet} from './resources/webgl-query-set';\nimport {WEBGLFence} from './resources/webgl-fence';\n\nimport {readPixelsToArray, readPixelsToBuffer} from './helpers/webgl-texture-utils';\nimport {\n  setGLParameters,\n  getGLParameters,\n  resetGLParameters\n} from '../context/parameters/unified-parameter-api';\nimport {withGLParameters} from '../context/state-tracker/with-parameters';\nimport {getWebGLExtension} from '../context/helpers/webgl-extensions';\n\n/** WebGPU style Device API for a WebGL context */\nexport class WebGLDevice extends Device {\n  static getDeviceFromContext(gl: WebGL2RenderingContext | null): WebGLDevice | null {\n    if (!gl) {\n      return null;\n    }\n    // @ts-expect-error Ingore WebGL2RenderingContext type\n    return gl.luma?.device ?? null;\n  }\n  // Public `Device` API\n\n  /** type of this device */\n  readonly type = 'webgl';\n\n  // Use the ! assertion to handle the case where _reuseDevices causes the constructor to return early\n  /** The underlying WebGL context */\n  readonly handle!: WebGL2RenderingContext;\n  features!: WebGLDeviceFeatures;\n  limits!: WebGLDeviceLimits;\n  readonly info!: DeviceInfo;\n  readonly canvasContext!: WebGLCanvasContext;\n\n  readonly preferredColorFormat = 'rgba8unorm';\n  readonly preferredDepthFormat = 'depth24plus';\n\n  commandEncoder!: WEBGLCommandEncoder;\n\n  readonly lost: Promise<{reason: 'destroyed'; message: string}>;\n\n  private _resolveContextLost?: (value: {reason: 'destroyed'; message: string}) => void;\n\n  /** WebGL2 context. */\n  readonly gl!: WebGL2RenderingContext;\n\n  /** Store constants */\n  // @ts-ignore TODO fix\n  _constants: (TypedArray | null)[];\n\n  /** State used by luma.gl classes - TODO - not used? */\n  readonly extensions!: GLExtensions;\n  _polyfilled: boolean = false;\n\n  /** Instance of Spector.js (if initialized) */\n  spectorJS!: Spector | null;\n\n  //\n  // Public API\n  //\n\n  override get [Symbol.toStringTag](): string {\n    return 'WebGLDevice';\n  }\n\n  override toString(): string {\n    return `${this[Symbol.toStringTag]}(${this.id})`;\n  }\n\n  override isVertexFormatSupported(format: VertexFormat): boolean {\n    switch (format) {\n      case 'unorm8x4-bgra':\n        return false;\n      default:\n        return true;\n    }\n  }\n\n  constructor(props: DeviceProps) {\n    super({...props, id: props.id || uid('webgl-device')});\n\n    const canvasContextProps = Device._getCanvasContextProps(props)!;\n\n    // WebGL requires a canvas to be created before creating the context\n    if (!canvasContextProps) {\n      throw new Error('WebGLDevice requires props.createCanvasContext to be set');\n    }\n\n    // Check if the WebGL context is already associated with a device\n    // Note that this can be avoided in webgl2adapter.create() if\n    // DeviceProps._reuseDevices is set.\n    // @ts-expect-error device is attached to context\n    const existingContext = canvasContextProps.canvas?.gl ?? null;\n    let device: WebGLDevice | null = WebGLDevice.getDeviceFromContext(existingContext);\n    if (device) {\n      throw new Error(`WebGL context already attached to device ${device.id}`);\n    }\n\n    // Create and instrument context\n    this.canvasContext = new WebGLCanvasContext(this, canvasContextProps);\n\n    this.lost = new Promise<{reason: 'destroyed'; message: string}>(resolve => {\n      this._resolveContextLost = resolve;\n    });\n\n    const webglContextAttributes: WebGLContextAttributes = {...props.webgl};\n    // Copy props from CanvasContextProps\n    if (canvasContextProps.alphaMode === 'premultiplied') {\n      webglContextAttributes.premultipliedAlpha = true;\n    }\n    if (props.powerPreference !== undefined) {\n      webglContextAttributes.powerPreference = props.powerPreference;\n    }\n    if (props.failIfMajorPerformanceCaveat !== undefined) {\n      webglContextAttributes.failIfMajorPerformanceCaveat = props.failIfMajorPerformanceCaveat;\n    }\n\n    // Check if we should attach to an externally created context or create a new context\n    const externalGLContext = this.props._handle as WebGL2RenderingContext | null;\n\n    const gl =\n      externalGLContext ||\n      createBrowserContext(\n        this.canvasContext.canvas,\n        {\n          onContextLost: (event: Event) =>\n            this._resolveContextLost?.({\n              reason: 'destroyed',\n              message: 'Entered sleep mode, or too many apps or browser tabs are using the GPU.'\n            }),\n          // eslint-disable-next-line no-console\n          onContextRestored: (event: Event) => console.log('WebGL context restored')\n        },\n        webglContextAttributes\n      );\n\n    if (!gl) {\n      throw new Error('WebGL context creation failed');\n    }\n\n    // Note that the browser will only create one WebGL context per canvas.\n    // This means that a newly created gl context may already have a device attached to it.\n    device = WebGLDevice.getDeviceFromContext(gl);\n    if (device) {\n      if (props._reuseDevices) {\n        log.log(\n          1,\n          `Not creating a new Device, instead returning a reference to Device ${device.id} already attached to WebGL context`,\n          device\n        )();\n        // Destroy the orphaned canvas context that was created above (line 149)\n        // to prevent its ResizeObserver from firing callbacks with undefined device\n        this.canvasContext.destroy();\n        device._reused = true;\n        return device;\n      }\n      throw new Error(`WebGL context already attached to device ${device.id}`);\n    }\n\n    this.handle = gl;\n    this.gl = gl;\n\n    // Add spector debug instrumentation to context\n    // We need to trust spector integration to decide if spector should be initialized\n    // We also run spector instrumentation first, otherwise spector can clobber luma instrumentation.\n    this.spectorJS = initializeSpectorJS({...this.props, gl: this.handle});\n\n    // Instrument context\n    const contextData = getWebGLContextData(this.handle);\n    contextData.device = this; // Update GL context: Link webgl context back to device\n\n    if (!contextData.extensions) {\n      contextData.extensions = {};\n    }\n    this.extensions = contextData.extensions;\n\n    // initialize luma Device fields\n    this.info = getDeviceInfo(this.gl, this.extensions);\n    this.limits = new WebGLDeviceLimits(this.gl);\n    this.features = new WebGLDeviceFeatures(this.gl, this.extensions, this.props._disabledFeatures);\n    if (this.props._initializeFeatures) {\n      this.features.initializeFeatures();\n    }\n\n    // Install context state tracking\n    const glState = new WebGLStateTracker(this.gl, {\n      log: (...args: any[]) => log.log(1, ...args)()\n    });\n    glState.trackState(this.gl, {copyState: false});\n\n    // props.debug - instrument the WebGL context with Khronos debug tools\n    // props.debugWebGL - activate WebGL context tracing, force log level to at least 1\n    if (props.debug || props.debugWebGL) {\n      this.gl = makeDebugContext(this.gl, {debugWebGL: true, traceWebGL: props.debugWebGL});\n      log.warn('WebGL debug mode activated. Performance reduced.')();\n    }\n    if (props.debugWebGL) {\n      log.level = Math.max(log.level, 1);\n    }\n\n    this.commandEncoder = new WEBGLCommandEncoder(this, {id: `${this}-command-encoder`});\n    this.canvasContext._startObservers();\n  }\n\n  /**\n   * Destroys the device\n   *\n   * @note \"Detaches\" from the WebGL context unless _reuseDevices is true.\n   *\n   * @note The underlying WebGL context is not immediately destroyed,\n   * but may be destroyed later through normal JavaScript garbage collection.\n   * This is a fundamental limitation since WebGL does not offer any\n   * browser API for destroying WebGL contexts.\n   */\n  destroy(): void {\n    this.commandEncoder?.destroy();\n    // Note that deck.gl (especially in React strict mode) depends on being able\n    // to asynchronously create a Device against the same canvas (i.e. WebGL context)\n    // multiple times and getting the same device back. Since deck.gl is not aware\n    // of this sharing, it might call destroy() multiple times on the same device.\n    // Therefore we must do nothing in destroy() if props._reuseDevices is true\n    if (!this.props._reuseDevices && !this._reused) {\n      // Delete the reference to the device that we store on the WebGL context\n      const contextData = getWebGLContextData(this.handle);\n      contextData.device = null;\n    }\n  }\n\n  get isLost(): boolean {\n    return this.gl.isContextLost();\n  }\n\n  // IMPLEMENTATION OF ABSTRACT DEVICE\n\n  createCanvasContext(props?: CanvasContextProps): CanvasContext {\n    throw new Error('WebGL only supports a single canvas');\n  }\n\n  createPresentationContext(props?: PresentationContextProps): PresentationContext {\n    return new WebGLPresentationContext(this, props || {});\n  }\n\n  createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): WEBGLBuffer {\n    const newProps = this._normalizeBufferProps(props);\n    return new WEBGLBuffer(this, newProps);\n  }\n\n  createTexture(props: TextureProps): WEBGLTexture {\n    return new WEBGLTexture(this, props);\n  }\n\n  createExternalTexture(props: ExternalTextureProps): ExternalTexture {\n    throw new Error('createExternalTexture() not implemented'); // return new Program(props);\n  }\n\n  createSampler(props: SamplerProps): WEBGLSampler {\n    return new WEBGLSampler(this, props);\n  }\n\n  createShader(props: ShaderProps): WEBGLShader {\n    return new WEBGLShader(this, props);\n  }\n\n  createFramebuffer(props: FramebufferProps): WEBGLFramebuffer {\n    return new WEBGLFramebuffer(this, props);\n  }\n\n  createVertexArray(props: VertexArrayProps): VertexArray {\n    return new WEBGLVertexArray(this, props);\n  }\n\n  createTransformFeedback(props: TransformFeedbackProps): WEBGLTransformFeedback {\n    return new WEBGLTransformFeedback(this, props);\n  }\n\n  createQuerySet(props: QuerySetProps): WEBGLQuerySet {\n    return new WEBGLQuerySet(this, props);\n  }\n\n  override createFence(): WEBGLFence {\n    return new WEBGLFence(this);\n  }\n\n  createRenderPipeline(props: RenderPipelineProps): WEBGLRenderPipeline {\n    return new WEBGLRenderPipeline(this, props);\n  }\n\n  override _createSharedRenderPipelineWebGL(props: RenderPipelineProps): SharedRenderPipeline {\n    return new WEBGLSharedRenderPipeline(\n      this,\n      props as RenderPipelineProps & {vs: WEBGLShader; fs: WEBGLShader}\n    );\n  }\n\n  createComputePipeline(props?: ComputePipelineProps): ComputePipeline {\n    throw new Error('ComputePipeline not supported in WebGL');\n  }\n\n  override createCommandEncoder(props: CommandEncoderProps = {}): WEBGLCommandEncoder {\n    return new WEBGLCommandEncoder(this, props);\n  }\n\n  /**\n   * Offscreen Canvas Support: Commit the frame\n   * https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/commit\n   * Chrome's offscreen canvas does not require gl.commit\n   */\n  submit(commandBuffer?: WEBGLCommandBuffer): void {\n    let submittedCommandEncoder: WEBGLCommandEncoder | null = null;\n    if (!commandBuffer) {\n      ({submittedCommandEncoder, commandBuffer} = this._finalizeDefaultCommandEncoderForSubmit());\n    }\n\n    try {\n      commandBuffer._executeCommands();\n\n      if (submittedCommandEncoder) {\n        submittedCommandEncoder\n          .resolveTimeProfilingQuerySet()\n          .then(() => {\n            this.commandEncoder._gpuTimeMs = submittedCommandEncoder._gpuTimeMs;\n          })\n          .catch(() => {});\n      }\n    } finally {\n      commandBuffer.destroy();\n    }\n  }\n\n  private _finalizeDefaultCommandEncoderForSubmit(): {\n    submittedCommandEncoder: WEBGLCommandEncoder;\n    commandBuffer: WEBGLCommandBuffer;\n  } {\n    const submittedCommandEncoder = this.commandEncoder;\n    const commandBuffer = submittedCommandEncoder.finish();\n    this.commandEncoder.destroy();\n    this.commandEncoder = this.createCommandEncoder({\n      id: submittedCommandEncoder.props.id,\n      timeProfilingQuerySet: submittedCommandEncoder.getTimeProfilingQuerySet()\n    });\n    return {submittedCommandEncoder, commandBuffer};\n  }\n\n  //\n  // TEMPORARY HACKS - will be removed in v9.1\n  //\n\n  /** @deprecated - should use command encoder */\n  override readPixelsToArrayWebGL(\n    source: Framebuffer | Texture,\n    options?: {\n      sourceX?: number;\n      sourceY?: number;\n      sourceFormat?: number;\n      sourceAttachment?: number;\n      target?: Uint8Array | Uint16Array | Float32Array;\n      // following parameters are auto deduced if not provided\n      sourceWidth?: number;\n      sourceHeight?: number;\n      sourceType?: number;\n    }\n  ): Uint8Array | Uint16Array | Float32Array {\n    return readPixelsToArray(source, options);\n  }\n\n  /** @deprecated - should use command encoder */\n  override readPixelsToBufferWebGL(\n    source: Framebuffer | Texture,\n    options?: {\n      sourceX?: number;\n      sourceY?: number;\n      sourceFormat?: number;\n      target?: Buffer; // A new Buffer object is created when not provided.\n      targetByteOffset?: number; // byte offset in buffer object\n      // following parameters are auto deduced if not provided\n      sourceWidth?: number;\n      sourceHeight?: number;\n      sourceType?: number;\n    }\n  ): Buffer {\n    return readPixelsToBuffer(source, options);\n  }\n\n  override setParametersWebGL(parameters: any): void {\n    setGLParameters(this.gl, parameters);\n  }\n\n  override getParametersWebGL(parameters: any): any {\n    return getGLParameters(this.gl, parameters);\n  }\n\n  override withParametersWebGL(parameters: any, func: any): any {\n    return withGLParameters(this.gl, parameters, func);\n  }\n\n  override resetWebGL(): void {\n    log.warn('WebGLDevice.resetWebGL is deprecated, use only for debugging')();\n    resetGLParameters(this.gl);\n  }\n\n  override _getDeviceSpecificTextureFormatCapabilities(\n    capabilities: DeviceTextureFormatCapabilities\n  ): DeviceTextureFormatCapabilities {\n    return getTextureFormatCapabilitiesWebGL(this.gl, capabilities, this.extensions);\n  }\n\n  //\n  // WebGL-only API (not part of `Device` API)\n  //\n\n  /**\n   * Triggers device (or WebGL context) loss.\n   * @note primarily intended for testing how application reacts to device loss\n   */\n  override loseDevice(): boolean {\n    let deviceLossTriggered = false;\n    const extensions = this.getExtension('WEBGL_lose_context');\n    const ext = extensions.WEBGL_lose_context;\n    if (ext) {\n      deviceLossTriggered = true;\n      ext.loseContext();\n      // ext.loseContext should trigger context loss callback but the platform may not do this, so do it explicitly\n    }\n    this._resolveContextLost?.({\n      reason: 'destroyed',\n      message: 'Application triggered context loss'\n    });\n    return deviceLossTriggered;\n  }\n\n  /** Save current WebGL context state onto an internal stack */\n  pushState(): void {\n    const webglState = WebGLStateTracker.get(this.gl);\n    webglState.push();\n  }\n\n  /** Restores previously saved context state */\n  popState(): void {\n    const webglState = WebGLStateTracker.get(this.gl);\n    webglState.pop();\n  }\n\n  /**\n   * Returns the GL.<KEY> constant that corresponds to a numeric value of a GL constant\n   * Be aware that there are some duplicates especially for constants that are 0,\n   * so this isn't guaranteed to return the right key in all cases.\n   */\n  getGLKey(value: unknown, options?: {emptyIfUnknown?: boolean}): string {\n    const number = Number(value);\n    for (const key in this.gl) {\n      // @ts-ignore expect-error depends on settings\n      if (this.gl[key] === number) {\n        return `GL.${key}`;\n      }\n    }\n    // No constant found. Stringify the value and return it.\n    return options?.emptyIfUnknown ? '' : String(value);\n  }\n\n  /**\n   * Returns a map with any GL.<KEY> constants mapped to strings, both for keys and values\n   */\n  getGLKeys(glParameters: Record<number, unknown>): Record<string, string> {\n    const opts = {emptyIfUnknown: true};\n    return Object.entries(glParameters).reduce<Record<string, string>>((keys, [key, value]) => {\n      // eslint-disable-next-line @typescript-eslint/no-base-to-string\n      keys[`${key}:${this.getGLKey(key, opts)}`] = `${value}:${this.getGLKey(value, opts)}`;\n      return keys;\n    }, {});\n  }\n\n  /**\n   * Set a constant value for a location. Disabled attributes at that location will read from this value\n   * @note WebGL constants are stored globally on the WebGL context, not the VertexArray\n   * so they need to be updated before every render\n   * @todo - remember/cache values to avoid setting them unnecessarily?\n   */\n  setConstantAttributeWebGL(location: number, constant: TypedArray): void {\n    const maxVertexAttributes = this.limits.maxVertexAttributes;\n    this._constants = this._constants || new Array(maxVertexAttributes).fill(null);\n    const currentConstant = this._constants[location];\n    if (currentConstant && compareConstantArrayValues(currentConstant, constant)) {\n      log.info(\n        1,\n        `setConstantAttributeWebGL(${location}) could have been skipped, value unchanged`\n      )();\n    }\n    this._constants[location] = constant;\n\n    switch (constant.constructor) {\n      case Float32Array:\n        setConstantFloatArray(this, location, constant as Float32Array);\n        break;\n      case Int32Array:\n        setConstantIntArray(this, location, constant as Int32Array);\n        break;\n      case Uint32Array:\n        setConstantUintArray(this, location, constant as Uint32Array);\n        break;\n      default:\n        throw new Error('constant');\n    }\n  }\n\n  /** Ensure extensions are only requested once */\n  getExtension(name: keyof GLExtensions): GLExtensions {\n    getWebGLExtension(this.gl, name, this.extensions);\n    return this.extensions;\n  }\n\n  // INTERNAL SUPPORT METHODS FOR WEBGL RESOURCES\n\n  /**\n   * Storing data on a special field on WebGLObjects makes that data visible in SPECTOR chrome debug extension\n   * luma.gl ids and props can be inspected\n   */\n  _setWebGLDebugMetadata(\n    handle: unknown,\n    resource: Resource<any>,\n    options: {spector: Record<string, unknown>}\n  ): void {\n    // @ts-expect-error\n    handle.luma = resource;\n\n    const spectorMetadata = {props: options.spector, id: options.spector['id']};\n    // @ts-expect-error\n    // eslint-disable-next-line camelcase\n    handle.__SPECTOR_Metadata = spectorMetadata;\n  }\n}\n\n/** Set constant float array attribute */\nfunction setConstantFloatArray(device: WebGLDevice, location: number, array: Float32Array): void {\n  switch (array.length) {\n    case 1:\n      device.gl.vertexAttrib1fv(location, array);\n      break;\n    case 2:\n      device.gl.vertexAttrib2fv(location, array);\n      break;\n    case 3:\n      device.gl.vertexAttrib3fv(location, array);\n      break;\n    case 4:\n      device.gl.vertexAttrib4fv(location, array);\n      break;\n    default:\n    // assert(false);\n  }\n}\n\n/** Set constant signed int array attribute */\nfunction setConstantIntArray(device: WebGLDevice, location: number, array: Int32Array): void {\n  device.gl.vertexAttribI4iv(location, array);\n  // TODO - not clear if we need to use the special forms, more testing needed\n  // switch (array.length) {\n  //   case 1:\n  //     gl.vertexAttribI1iv(location, array);\n  //     break;\n  //   case 2:\n  //     gl.vertexAttribI2iv(location, array);\n  //     break;\n  //   case 3:\n  //     gl.vertexAttribI3iv(location, array);\n  //     break;\n  //   case 4:\n  //     break;\n  //   default:\n  //     assert(false);\n  // }\n}\n\n/** Set constant unsigned int array attribute */\nfunction setConstantUintArray(device: WebGLDevice, location: number, array: Uint32Array) {\n  device.gl.vertexAttribI4uiv(location, array);\n  // TODO - not clear if we need to use the special forms, more testing needed\n  // switch (array.length) {\n  //   case 1:\n  //     gl.vertexAttribI1uiv(location, array);\n  //     break;\n  //   case 2:\n  //     gl.vertexAttribI2uiv(location, array);\n  //     break;\n  //   case 3:\n  //     gl.vertexAttribI3uiv(location, array);\n  //     break;\n  //   case 4:\n  //     gl.vertexAttribI4uiv(location, array);\n  //     break;\n  //   default:\n  //     assert(false);\n  // }\n}\n\n/**\n * Compares contents of two typed arrays\n * @todo max length?\n */\nfunction compareConstantArrayValues(v1: TypedArray, v2: TypedArray): boolean {\n  if (!v1 || !v2 || v1.length !== v2.length || v1.constructor !== v2.constructor) {\n    return false;\n  }\n  for (let i = 0; i < v1.length; ++i) {\n    if (v1[i] !== v2[i]) {\n      return false;\n    }\n  }\n  return true;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {WebGLDevice} from './webgl-device';\nimport {Adapter, Device, DeviceProps, log} from '@luma.gl/core';\nimport {enforceWebGL2} from '../context/polyfills/polyfill-webgl1-extensions';\nimport {loadSpectorJS, DEFAULT_SPECTOR_PROPS} from '../context/debug/spector';\nimport {loadWebGLDeveloperTools} from '../context/debug/webgl-developer-tools';\n\nconst LOG_LEVEL = 1;\n\nexport class WebGLAdapter extends Adapter {\n  /** type of device's created by this adapter */\n  readonly type: Device['type'] = 'webgl';\n\n  constructor() {\n    super();\n    // Add spector default props to device default props, so that runtime settings are observed\n    Device.defaultProps = {...Device.defaultProps, ...DEFAULT_SPECTOR_PROPS};\n  }\n\n  /** Force any created WebGL contexts to be WebGL2 contexts, polyfilled with WebGL1 extensions */\n  enforceWebGL2(enable: boolean): void {\n    enforceWebGL2(enable);\n  }\n\n  /** Check if WebGL 2 is available */\n  isSupported(): boolean {\n    return typeof WebGL2RenderingContext !== 'undefined';\n  }\n\n  override isDeviceHandle(handle: unknown): boolean {\n    // WebGL\n    if (typeof WebGL2RenderingContext !== 'undefined' && handle instanceof WebGL2RenderingContext) {\n      return true;\n    }\n\n    if (typeof WebGLRenderingContext !== 'undefined' && handle instanceof WebGLRenderingContext) {\n      log.warn('WebGL1 is not supported', handle)();\n    }\n\n    return false;\n  }\n\n  /**\n   * Get a device instance from a GL context\n   * Creates a WebGLCanvasContext against the contexts canvas\n   * @note autoResize will be disabled, assuming that whoever created the external context will be handling resizes.\n   * @param gl\n   * @returns\n   */\n  async attach(gl: Device | WebGL2RenderingContext, props: DeviceProps = {}): Promise<WebGLDevice> {\n    const {WebGLDevice} = await import('./webgl-device');\n    if (gl instanceof WebGLDevice) {\n      return gl;\n    }\n    const existingDevice = WebGLDevice.getDeviceFromContext(gl as WebGL2RenderingContext | null);\n    if (existingDevice) {\n      return existingDevice;\n    }\n    if (!isWebGL(gl)) {\n      throw new Error('Invalid WebGL2RenderingContext');\n    }\n\n    const createCanvasContext = props.createCanvasContext === true ? {} : props.createCanvasContext;\n\n    // We create a new device using the provided WebGL context and its canvas\n    // Assume that whoever created the external context will be handling resizes.\n    return new WebGLDevice({\n      ...props,\n      _handle: gl,\n      createCanvasContext: {canvas: gl.canvas, autoResize: false, ...createCanvasContext}\n    });\n  }\n\n  async create(props: DeviceProps = {}): Promise<WebGLDevice> {\n    const {WebGLDevice} = await import('./webgl-device');\n\n    const promises: Promise<unknown>[] = [];\n\n    // Load webgl and spector debug scripts from CDN if requested\n    if (props.debugWebGL || props.debug) {\n      promises.push(loadWebGLDeveloperTools());\n    }\n\n    if (props.debugSpectorJS) {\n      promises.push(loadSpectorJS(props));\n    }\n\n    // Wait for all the loads to settle before creating the context.\n    // The Device.create() functions are async, so in contrast to the constructor, we can `await` here.\n    const results = await Promise.allSettled(promises);\n    for (const result of results) {\n      if (result.status === 'rejected') {\n        log.error(`Failed to initialize debug libraries ${result.reason}`)();\n      }\n    }\n\n    try {\n      const device = new WebGLDevice(props);\n\n      log.groupCollapsed(LOG_LEVEL, `WebGLDevice ${device.id} created`)();\n      // Log some debug info about the newly created context\n      const message = `\\\n${device._reused ? 'Reusing' : 'Created'} device with WebGL2 ${device.props.debug ? 'debug ' : ''}context: \\\n${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContext.id}`;\n      log.probe(LOG_LEVEL, message)();\n      log.table(LOG_LEVEL, device.info)();\n      return device;\n    } finally {\n      log.groupEnd(LOG_LEVEL)();\n      log.info(\n        LOG_LEVEL,\n        `%cWebGL call tracing: luma.log.set('debug-webgl') `,\n        'color: white; background: blue; padding: 2px 6px; border-radius: 3px;'\n      )();\n    }\n  }\n}\n\n/** Check if supplied parameter is a WebGL2RenderingContext */\nfunction isWebGL(gl: any): gl is WebGL2RenderingContext {\n  if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {\n    return true;\n  }\n  return Boolean(gl && typeof gl.createVertexArray === 'function');\n}\n\nexport const webgl2Adapter = new WebGLAdapter();\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// luma.gl Base WebGL wrapper library\n// Provides simple class/function wrappers around the low level webgl objects\n// These classes are intentionally close to the WebGL API\n// but make it easier to use.\n// Higher level abstractions can be built on these classes\n\n// Types\nexport type {WebGLDeviceLimits} from './adapter/device-helpers/webgl-device-limits';\nexport {GL} from './constants/webgl-constants';\nexport type {\n  GLTextureTarget,\n  GLTextureCubeMapTarget,\n  GLTexelDataFormat,\n  GLPrimitiveTopology,\n  GLPrimitive,\n  GLDataType,\n  GLPixelType,\n  GLUniformType,\n  GLSamplerType,\n  GLFunction,\n  GLBlendEquation,\n  GLBlendFunction,\n  GLStencilOp,\n  GLSamplerParameters,\n  GLValueParameters,\n  GLPackParameters,\n  GLUnpackParameters,\n  GLFunctionParameters,\n  GLParameters,\n  GLLimits,\n  GLExtensions,\n  GLPolygonMode,\n  GLProvokingVertex\n} from './constants/webgl-types';\n\n// WebGL adapter classes\nexport {webgl2Adapter} from './adapter/webgl-adapter';\nexport type {WebGLAdapter} from './adapter/webgl-adapter';\n\n// WebGL Device classes\nexport {WebGLDevice} from './adapter/webgl-device';\nexport {WebGLCanvasContext} from './adapter/webgl-canvas-context';\n\n// WebGL Resource classes\nexport {WEBGLBuffer} from './adapter/resources/webgl-buffer';\nexport {WEBGLTexture} from './adapter/resources/webgl-texture';\n// export {WEBGLExternalTexture} from './adapter/resources/webgl-external-texture';\nexport {WEBGLShader} from './adapter/resources/webgl-shader';\nexport {WEBGLSampler} from './adapter/resources/webgl-sampler';\nexport {WEBGLFramebuffer} from './adapter/resources/webgl-framebuffer';\nexport {WEBGLFence} from './adapter/resources/webgl-fence';\n\nexport {WEBGLRenderPipeline} from './adapter/resources/webgl-render-pipeline';\n// export {WEBGLComputePipeline} from './adapter/resources/webgl-compute-pipeline';\nexport {WEBGLCommandEncoder} from './adapter/resources/webgl-command-encoder';\nexport {WEBGLRenderPass} from './adapter/resources/webgl-render-pass';\n// export {WEBGLComputePass} from './adapter/resources/webgl-compute-pass';\nexport {WEBGLVertexArray} from './adapter/resources/webgl-vertex-array';\n\n// WebGL adapter classes\nexport {WEBGLTransformFeedback} from './adapter/resources/webgl-transform-feedback';\n\n// Unified parameter API\n\nexport {setDeviceParameters, withDeviceParameters} from './adapter/converters/device-parameters';\n\n// HELPERS - EXPERIMENTAL\nexport {getShaderLayoutFromGLSL} from './adapter/helpers/get-shader-layout-from-glsl';\nexport {WebGLStateTracker} from './context/state-tracker/webgl-state-tracker';\n\n// DEPRECATED TEST EXPORTS\nexport {\n  resetGLParameters,\n  setGLParameters,\n  getGLParameters\n} from './context/parameters/unified-parameter-api';\n\nexport {withGLParameters} from './context/state-tracker/with-parameters';\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAcK;AAdL;;;AAcA,KAAA,SAAKA,SAAM;AAKT,MAAAA,QAAAA,QAAA,kBAAA,IAAA,GAAA,IAAA;AAEA,MAAAA,QAAAA,QAAA,oBAAA,IAAA,IAAA,IAAA;AAEA,MAAAA,QAAAA,QAAA,kBAAA,IAAA,KAAA,IAAA;AAMA,MAAAA,QAAAA,QAAA,QAAA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MAEA,MAAM,OAAO,QAAqB,CAAA,GAAE;AAClC,cAAM,EAAC,aAAAA,aAAW,IAAI,MAAM;AAE5B,cAAM,WAA+B,CAAA;AAGrC,YAAI,MAAM,cAAc,MAAM,OAAO;AACnC,mBAAS,KAAK,wBAAuB,CAAE;QACzC;AAEA,YAAI,MAAM,gBAAgB;AACxB,mBAAS,KAAK,cAAc,KAAK,CAAC;QACpC;AAIA,cAAM,UAAU,MAAM,QAAQ,WAAW,QAAQ;AACjD,mBAAW,UAAU,SAAS;AAC5B,cAAI,OAAO,WAAW,YAAY;AAChC,8BAAI,MAAM,wCAAwC,OAAO,QAAQ,EAAC;UACpE;QACF;AAEA,YAAI;AACF,gBAAM,SAAS,IAAIA,aAAY,KAAK;AAEpC,4BAAI,eAAeF,YAAW,eAAe,OAAO,YAAY,EAAC;AAEjE,gBAAMG,WAAU,GACpB,OAAO,UAAU,YAAY,gCAAgC,OAAO,MAAM,QAAQ,WAAW,cAC7F,OAAO,KAAK,WAAW,OAAO,KAAK,wBAAwB,OAAO,cAAc;AAC5E,4BAAI,MAAMH,YAAWG,QAAO,EAAC;AAC7B,4BAAI,MAAMH,YAAW,OAAO,IAAI,EAAC;AACjC,iBAAO;QACT;AACE,4BAAI,SAASA,UAAS,EAAC;AACvB,4BAAI,KACFA,YACA,sDACA,uEAAuE,EACxE;QACH;MACF;;AAWK,IAAM,gBAAgB,IAAI,aAAY;;;;;ACjI7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA;AA4BA;AAIA;AACA;AAGA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AAGA;AAIA;AAGA;AACA;AAGA;AAMA;;;",
  "names": ["GLEnum", "getWebGLContextData", "GLEnum", "message", "import_core", "import_constants", "import_constants", "target", "isArray", "import_constants", "import_constants", "import_core", "import_constants", "import_core", "import_core", "import_constants", "import_core", "import_constants", "import_core", "import_core", "import_core", "import_constants", "messageType", "message", "import_core", "import_constants", "isObjectEmpty", "import_core", "import_constants", "import_constants", "import_core", "import_constants", "isObjectEmpty", "import_core", "import_constants", "import_core", "import_constants", "import_constants", "import_constants", "import_core", "import_constants", "import_constants", "uniforms", "isArray", "import_core", "import_constants", "import_constants", "import_core", "status", "isArray", "import_core", "import_constants", "import_core", "import_constants", "import_core", "target", "import_core", "import_constants", "import_env", "enable", "import_core", "import_constants", "import_core", "import_constants", "import_core", "import_constants", "target", "getFramebuffer", "import_core", "import_constants", "compareConstantArrayValues", "import_core", "_a", "import_core", "LOG_LEVEL", "enable", "WebGLDevice", "message"]
}
