@luma.gl/webgl 9.0.0-alpha.21 → 9.0.0-alpha.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/dist/adapter/converters/device-parameters.d.ts +1 -1
  2. package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
  3. package/dist/adapter/converters/device-parameters.js +9 -9
  4. package/dist/adapter/converters/device-parameters.js.map +1 -1
  5. package/dist/adapter/converters/sampler-parameters.d.ts +1 -1
  6. package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
  7. package/dist/adapter/converters/sampler-parameters.js +1 -1
  8. package/dist/adapter/converters/sampler-parameters.js.map +1 -1
  9. package/dist/adapter/converters/texture-formats.d.ts +27 -38
  10. package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
  11. package/dist/adapter/converters/texture-formats.js +152 -114
  12. package/dist/adapter/converters/texture-formats.js.map +1 -1
  13. package/dist/adapter/helpers/attribute-utils.d.ts +1 -1
  14. package/dist/adapter/helpers/attribute-utils.d.ts.map +1 -1
  15. package/dist/adapter/helpers/attribute-utils.js +1 -1
  16. package/dist/adapter/helpers/attribute-utils.js.map +1 -1
  17. package/dist/adapter/helpers/get-shader-info.d.ts.map +1 -1
  18. package/dist/adapter/helpers/get-shader-info.js.map +1 -1
  19. package/dist/adapter/helpers/uniforms.d.ts +7 -8
  20. package/dist/adapter/helpers/uniforms.d.ts.map +1 -1
  21. package/dist/adapter/helpers/uniforms.js +4 -4
  22. package/dist/adapter/helpers/uniforms.js.map +1 -1
  23. package/dist/adapter/objects/constants-to-keys.d.ts +0 -2
  24. package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
  25. package/dist/adapter/objects/constants-to-keys.js +0 -20
  26. package/dist/adapter/objects/constants-to-keys.js.map +1 -1
  27. package/dist/adapter/objects/webgl-renderbuffer.d.ts +11 -8
  28. package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
  29. package/dist/adapter/objects/webgl-renderbuffer.js +29 -19
  30. package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -1
  31. package/dist/adapter/objects/webgl-resource.d.ts +0 -1
  32. package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
  33. package/dist/adapter/objects/webgl-resource.js +4 -7
  34. package/dist/adapter/objects/webgl-resource.js.map +1 -1
  35. package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
  36. package/dist/adapter/resources/webgl-buffer.js +3 -2
  37. package/dist/adapter/resources/webgl-buffer.js.map +1 -1
  38. package/dist/adapter/resources/webgl-command-buffer.d.ts +8 -2
  39. package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
  40. package/dist/adapter/resources/webgl-command-buffer.js +168 -25
  41. package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
  42. package/dist/adapter/resources/webgl-command-encoder.d.ts +3 -2
  43. package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
  44. package/dist/adapter/resources/webgl-command-encoder.js +6 -2
  45. package/dist/adapter/resources/webgl-command-encoder.js.map +1 -1
  46. package/dist/adapter/resources/webgl-framebuffer.d.ts +9 -12
  47. package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
  48. package/dist/adapter/resources/webgl-framebuffer.js +29 -79
  49. package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
  50. package/dist/adapter/resources/webgl-render-pass.d.ts +16 -1
  51. package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
  52. package/dist/adapter/resources/webgl-render-pass.js +80 -0
  53. package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
  54. package/dist/adapter/resources/webgl-render-pipeline.d.ts +1 -1
  55. package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
  56. package/dist/adapter/resources/webgl-render-pipeline.js +3 -4
  57. package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
  58. package/dist/adapter/resources/webgl-sampler.d.ts +1 -1
  59. package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
  60. package/dist/adapter/resources/webgl-sampler.js +1 -1
  61. package/dist/adapter/resources/webgl-sampler.js.map +1 -1
  62. package/dist/adapter/resources/webgl-texture.d.ts +39 -19
  63. package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
  64. package/dist/adapter/resources/webgl-texture.js +32 -30
  65. package/dist/adapter/resources/webgl-texture.js.map +1 -1
  66. package/dist/adapter/webgl-canvas-context.d.ts +1 -2
  67. package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
  68. package/dist/adapter/webgl-canvas-context.js.map +1 -1
  69. package/dist/adapter/webgl-device.d.ts +13 -6
  70. package/dist/adapter/webgl-device.d.ts.map +1 -1
  71. package/dist/adapter/webgl-device.js +20 -2
  72. package/dist/adapter/webgl-device.js.map +1 -1
  73. package/dist/classic/buffer.d.ts +0 -1
  74. package/dist/classic/buffer.d.ts.map +1 -1
  75. package/dist/classic/buffer.js +0 -6
  76. package/dist/classic/buffer.js.map +1 -1
  77. package/dist/classic/typed-array-utils.d.ts +15 -17
  78. package/dist/classic/typed-array-utils.d.ts.map +1 -1
  79. package/dist/classic/typed-array-utils.js +1 -1
  80. package/dist/classic/typed-array-utils.js.map +1 -1
  81. package/dist/context/context/create-browser-context.js.map +1 -1
  82. package/dist/context/parameters/unified-parameter-api.d.ts +1 -1
  83. package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
  84. package/dist/context/parameters/unified-parameter-api.js.map +1 -1
  85. package/dist/context/parameters/webgl-parameter-tables.d.ts +1 -2
  86. package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
  87. package/dist/context/parameters/webgl-parameter-tables.js +1 -1
  88. package/dist/context/parameters/webgl-parameter-tables.js.map +1 -1
  89. package/dist/dist.dev.js +1102 -670
  90. package/dist/index.cjs +1085 -898
  91. package/dist/index.d.ts +3 -2
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +2 -1
  94. package/dist/index.js.map +1 -1
  95. package/dist.min.js +22 -21
  96. package/package.json +7 -4
  97. package/src/adapter/converters/device-parameters.ts +46 -22
  98. package/src/adapter/converters/sampler-parameters.ts +1 -2
  99. package/src/adapter/converters/texture-formats.ts +242 -161
  100. package/src/adapter/helpers/attribute-utils.ts +1 -2
  101. package/src/adapter/helpers/get-shader-info.ts +3 -0
  102. package/src/adapter/helpers/uniforms.ts +9 -10
  103. package/src/adapter/objects/constants-to-keys.ts +0 -25
  104. package/src/adapter/objects/webgl-renderbuffer.ts +32 -29
  105. package/src/adapter/objects/webgl-resource.ts +4 -8
  106. package/src/adapter/resources/webgl-buffer.ts +4 -5
  107. package/src/adapter/resources/webgl-command-buffer.ts +328 -21
  108. package/src/adapter/resources/webgl-command-encoder.ts +7 -2
  109. package/src/adapter/resources/webgl-framebuffer.ts +63 -111
  110. package/src/adapter/resources/webgl-render-pass.ts +146 -2
  111. package/src/adapter/resources/webgl-render-pipeline.ts +6 -3
  112. package/src/adapter/resources/webgl-sampler.ts +1 -2
  113. package/src/adapter/resources/webgl-texture.ts +61 -43
  114. package/src/adapter/webgl-canvas-context.ts +2 -2
  115. package/src/adapter/webgl-device.ts +37 -8
  116. package/src/classic/buffer.ts +3 -3
  117. package/src/classic/typed-array-utils.ts +15 -26
  118. package/src/context/context/create-browser-context.ts +2 -2
  119. package/src/context/parameters/unified-parameter-api.ts +1 -1
  120. package/src/context/parameters/webgl-parameter-tables.ts +2 -2
  121. package/src/index.ts +5 -3
  122. package/dist/adapter/converters/renderbuffer-formats.d.ts +0 -16
  123. package/dist/adapter/converters/renderbuffer-formats.d.ts.map +0 -1
  124. package/dist/adapter/converters/renderbuffer-formats.js +0 -180
  125. package/dist/adapter/converters/renderbuffer-formats.js.map +0 -1
  126. package/dist/types/webgl.d.ts +0 -145
  127. package/dist/types/webgl.d.ts.map +0 -1
  128. package/dist/types/webgl.js +0 -2
  129. package/dist/types/webgl.js.map +0 -1
  130. package/src/.DS_Store +0 -0
  131. package/src/adapter/.DS_Store +0 -0
  132. package/src/adapter/converters/renderbuffer-formats.ts +0 -90
  133. package/src/context/.DS_Store +0 -0
  134. package/src/types/webgl.ts +0 -286
package/dist/index.cjs CHANGED
@@ -83,9 +83,11 @@ __export(src_exports, {
83
83
  WebGLCanvasContext: () => WebGLCanvasContext,
84
84
  WebGLDevice: () => WebGLDevice,
85
85
  WebGLResource: () => WebGLResource,
86
+ _TEXTURE_FORMATS: () => TEXTURE_FORMATS,
86
87
  _checkFloat32ColorAttachment: () => _checkFloat32ColorAttachment,
87
88
  assertWebGL2Context: () => assertWebGL2Context,
88
89
  assertWebGLContext: () => assertWebGLContext,
90
+ convertGLToTextureFormat: () => convertGLToTextureFormat,
89
91
  getParameters: () => getParameters,
90
92
  getProgramBindings: () => getProgramBindings,
91
93
  getShaderLayout: () => getShaderLayout,
@@ -138,7 +140,7 @@ function createHeadlessContext(options) {
138
140
  }
139
141
 
140
142
  // src/adapter/webgl-device.ts
141
- var import_api24 = require("@luma.gl/api");
143
+ var import_api26 = require("@luma.gl/api");
142
144
  var import_env2 = require("@probe.gl/env");
143
145
 
144
146
  // src/context/polyfill/polyfill-context.ts
@@ -781,109 +783,109 @@ function installOverrides(gl, { target, target2 }) {
781
783
  var import_api4 = require("@luma.gl/api");
782
784
 
783
785
  // src/context/parameters/webgl-parameter-tables.ts
784
- var import_constants3 = __toESM(require("@luma.gl/constants"), 1);
786
+ var import_constants3 = require("@luma.gl/constants");
785
787
  var GL_PARAMETER_DEFAULTS = {
786
- [import_constants3.default.BLEND]: false,
787
- [import_constants3.default.BLEND_COLOR]: new Float32Array([0, 0, 0, 0]),
788
- [import_constants3.default.BLEND_EQUATION_RGB]: import_constants3.default.FUNC_ADD,
789
- [import_constants3.default.BLEND_EQUATION_ALPHA]: import_constants3.default.FUNC_ADD,
790
- [import_constants3.default.BLEND_SRC_RGB]: import_constants3.default.ONE,
791
- [import_constants3.default.BLEND_DST_RGB]: import_constants3.default.ZERO,
792
- [import_constants3.default.BLEND_SRC_ALPHA]: import_constants3.default.ONE,
793
- [import_constants3.default.BLEND_DST_ALPHA]: import_constants3.default.ZERO,
794
- [import_constants3.default.COLOR_CLEAR_VALUE]: new Float32Array([0, 0, 0, 0]),
788
+ [import_constants3.GL.BLEND]: false,
789
+ [import_constants3.GL.BLEND_COLOR]: new Float32Array([0, 0, 0, 0]),
790
+ [import_constants3.GL.BLEND_EQUATION_RGB]: import_constants3.GL.FUNC_ADD,
791
+ [import_constants3.GL.BLEND_EQUATION_ALPHA]: import_constants3.GL.FUNC_ADD,
792
+ [import_constants3.GL.BLEND_SRC_RGB]: import_constants3.GL.ONE,
793
+ [import_constants3.GL.BLEND_DST_RGB]: import_constants3.GL.ZERO,
794
+ [import_constants3.GL.BLEND_SRC_ALPHA]: import_constants3.GL.ONE,
795
+ [import_constants3.GL.BLEND_DST_ALPHA]: import_constants3.GL.ZERO,
796
+ [import_constants3.GL.COLOR_CLEAR_VALUE]: new Float32Array([0, 0, 0, 0]),
795
797
  // TBD
796
- [import_constants3.default.COLOR_WRITEMASK]: [true, true, true, true],
797
- [import_constants3.default.CULL_FACE]: false,
798
- [import_constants3.default.CULL_FACE_MODE]: import_constants3.default.BACK,
799
- [import_constants3.default.DEPTH_TEST]: false,
800
- [import_constants3.default.DEPTH_CLEAR_VALUE]: 1,
801
- [import_constants3.default.DEPTH_FUNC]: import_constants3.default.LESS,
802
- [import_constants3.default.DEPTH_RANGE]: new Float32Array([0, 1]),
798
+ [import_constants3.GL.COLOR_WRITEMASK]: [true, true, true, true],
799
+ [import_constants3.GL.CULL_FACE]: false,
800
+ [import_constants3.GL.CULL_FACE_MODE]: import_constants3.GL.BACK,
801
+ [import_constants3.GL.DEPTH_TEST]: false,
802
+ [import_constants3.GL.DEPTH_CLEAR_VALUE]: 1,
803
+ [import_constants3.GL.DEPTH_FUNC]: import_constants3.GL.LESS,
804
+ [import_constants3.GL.DEPTH_RANGE]: new Float32Array([0, 1]),
803
805
  // TBD
804
- [import_constants3.default.DEPTH_WRITEMASK]: true,
805
- [import_constants3.default.DITHER]: true,
806
- [import_constants3.default.CURRENT_PROGRAM]: null,
806
+ [import_constants3.GL.DEPTH_WRITEMASK]: true,
807
+ [import_constants3.GL.DITHER]: true,
808
+ [import_constants3.GL.CURRENT_PROGRAM]: null,
807
809
  // FRAMEBUFFER_BINDING and DRAW_FRAMEBUFFER_BINDING(WebGL2) refer same state.
808
- [import_constants3.default.FRAMEBUFFER_BINDING]: null,
809
- [import_constants3.default.RENDERBUFFER_BINDING]: null,
810
- [import_constants3.default.VERTEX_ARRAY_BINDING]: null,
811
- [import_constants3.default.ARRAY_BUFFER_BINDING]: null,
812
- [import_constants3.default.FRONT_FACE]: import_constants3.default.CCW,
813
- [import_constants3.default.GENERATE_MIPMAP_HINT]: import_constants3.default.DONT_CARE,
814
- [import_constants3.default.LINE_WIDTH]: 1,
815
- [import_constants3.default.POLYGON_OFFSET_FILL]: false,
816
- [import_constants3.default.POLYGON_OFFSET_FACTOR]: 0,
817
- [import_constants3.default.POLYGON_OFFSET_UNITS]: 0,
818
- [import_constants3.default.SAMPLE_ALPHA_TO_COVERAGE]: false,
819
- [import_constants3.default.SAMPLE_COVERAGE]: false,
820
- [import_constants3.default.SAMPLE_COVERAGE_VALUE]: 1,
821
- [import_constants3.default.SAMPLE_COVERAGE_INVERT]: false,
822
- [import_constants3.default.SCISSOR_TEST]: false,
810
+ [import_constants3.GL.FRAMEBUFFER_BINDING]: null,
811
+ [import_constants3.GL.RENDERBUFFER_BINDING]: null,
812
+ [import_constants3.GL.VERTEX_ARRAY_BINDING]: null,
813
+ [import_constants3.GL.ARRAY_BUFFER_BINDING]: null,
814
+ [import_constants3.GL.FRONT_FACE]: import_constants3.GL.CCW,
815
+ [import_constants3.GL.GENERATE_MIPMAP_HINT]: import_constants3.GL.DONT_CARE,
816
+ [import_constants3.GL.LINE_WIDTH]: 1,
817
+ [import_constants3.GL.POLYGON_OFFSET_FILL]: false,
818
+ [import_constants3.GL.POLYGON_OFFSET_FACTOR]: 0,
819
+ [import_constants3.GL.POLYGON_OFFSET_UNITS]: 0,
820
+ [import_constants3.GL.SAMPLE_ALPHA_TO_COVERAGE]: false,
821
+ [import_constants3.GL.SAMPLE_COVERAGE]: false,
822
+ [import_constants3.GL.SAMPLE_COVERAGE_VALUE]: 1,
823
+ [import_constants3.GL.SAMPLE_COVERAGE_INVERT]: false,
824
+ [import_constants3.GL.SCISSOR_TEST]: false,
823
825
  // Note: Dynamic value. If scissor test enabled we expect users to set correct scissor box
824
- [import_constants3.default.SCISSOR_BOX]: new Int32Array([0, 0, 1024, 1024]),
825
- [import_constants3.default.STENCIL_TEST]: false,
826
- [import_constants3.default.STENCIL_CLEAR_VALUE]: 0,
827
- [import_constants3.default.STENCIL_WRITEMASK]: 4294967295,
828
- [import_constants3.default.STENCIL_BACK_WRITEMASK]: 4294967295,
829
- [import_constants3.default.STENCIL_FUNC]: import_constants3.default.ALWAYS,
830
- [import_constants3.default.STENCIL_REF]: 0,
831
- [import_constants3.default.STENCIL_VALUE_MASK]: 4294967295,
832
- [import_constants3.default.STENCIL_BACK_FUNC]: import_constants3.default.ALWAYS,
833
- [import_constants3.default.STENCIL_BACK_REF]: 0,
834
- [import_constants3.default.STENCIL_BACK_VALUE_MASK]: 4294967295,
835
- [import_constants3.default.STENCIL_FAIL]: import_constants3.default.KEEP,
836
- [import_constants3.default.STENCIL_PASS_DEPTH_FAIL]: import_constants3.default.KEEP,
837
- [import_constants3.default.STENCIL_PASS_DEPTH_PASS]: import_constants3.default.KEEP,
838
- [import_constants3.default.STENCIL_BACK_FAIL]: import_constants3.default.KEEP,
839
- [import_constants3.default.STENCIL_BACK_PASS_DEPTH_FAIL]: import_constants3.default.KEEP,
840
- [import_constants3.default.STENCIL_BACK_PASS_DEPTH_PASS]: import_constants3.default.KEEP,
826
+ [import_constants3.GL.SCISSOR_BOX]: new Int32Array([0, 0, 1024, 1024]),
827
+ [import_constants3.GL.STENCIL_TEST]: false,
828
+ [import_constants3.GL.STENCIL_CLEAR_VALUE]: 0,
829
+ [import_constants3.GL.STENCIL_WRITEMASK]: 4294967295,
830
+ [import_constants3.GL.STENCIL_BACK_WRITEMASK]: 4294967295,
831
+ [import_constants3.GL.STENCIL_FUNC]: import_constants3.GL.ALWAYS,
832
+ [import_constants3.GL.STENCIL_REF]: 0,
833
+ [import_constants3.GL.STENCIL_VALUE_MASK]: 4294967295,
834
+ [import_constants3.GL.STENCIL_BACK_FUNC]: import_constants3.GL.ALWAYS,
835
+ [import_constants3.GL.STENCIL_BACK_REF]: 0,
836
+ [import_constants3.GL.STENCIL_BACK_VALUE_MASK]: 4294967295,
837
+ [import_constants3.GL.STENCIL_FAIL]: import_constants3.GL.KEEP,
838
+ [import_constants3.GL.STENCIL_PASS_DEPTH_FAIL]: import_constants3.GL.KEEP,
839
+ [import_constants3.GL.STENCIL_PASS_DEPTH_PASS]: import_constants3.GL.KEEP,
840
+ [import_constants3.GL.STENCIL_BACK_FAIL]: import_constants3.GL.KEEP,
841
+ [import_constants3.GL.STENCIL_BACK_PASS_DEPTH_FAIL]: import_constants3.GL.KEEP,
842
+ [import_constants3.GL.STENCIL_BACK_PASS_DEPTH_PASS]: import_constants3.GL.KEEP,
841
843
  // Dynamic value: We use [0, 0, 1024, 1024] as default, but usually this is updated in each frame.
842
- [import_constants3.default.VIEWPORT]: [0, 0, 1024, 1024],
844
+ [import_constants3.GL.VIEWPORT]: [0, 0, 1024, 1024],
843
845
  // WEBGL1 PIXEL PACK/UNPACK MODES
844
- [import_constants3.default.PACK_ALIGNMENT]: 4,
845
- [import_constants3.default.UNPACK_ALIGNMENT]: 4,
846
- [import_constants3.default.UNPACK_FLIP_Y_WEBGL]: false,
847
- [import_constants3.default.UNPACK_PREMULTIPLY_ALPHA_WEBGL]: false,
848
- [import_constants3.default.UNPACK_COLORSPACE_CONVERSION_WEBGL]: import_constants3.default.BROWSER_DEFAULT_WEBGL,
846
+ [import_constants3.GL.PACK_ALIGNMENT]: 4,
847
+ [import_constants3.GL.UNPACK_ALIGNMENT]: 4,
848
+ [import_constants3.GL.UNPACK_FLIP_Y_WEBGL]: false,
849
+ [import_constants3.GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL]: false,
850
+ [import_constants3.GL.UNPACK_COLORSPACE_CONVERSION_WEBGL]: import_constants3.GL.BROWSER_DEFAULT_WEBGL,
849
851
  // WEBGL2 / EXTENSIONS
850
852
  // gl1: 'OES_standard_derivatives'
851
- [import_constants3.default.TRANSFORM_FEEDBACK_BINDING]: null,
852
- [import_constants3.default.COPY_READ_BUFFER_BINDING]: null,
853
- [import_constants3.default.COPY_WRITE_BUFFER_BINDING]: null,
854
- [import_constants3.default.PIXEL_PACK_BUFFER_BINDING]: null,
855
- [import_constants3.default.PIXEL_UNPACK_BUFFER_BINDING]: null,
856
- [import_constants3.default.FRAGMENT_SHADER_DERIVATIVE_HINT]: import_constants3.default.DONT_CARE,
857
- [import_constants3.default.READ_FRAMEBUFFER_BINDING]: null,
858
- [import_constants3.default.RASTERIZER_DISCARD]: false,
859
- [import_constants3.default.PACK_ROW_LENGTH]: 0,
860
- [import_constants3.default.PACK_SKIP_PIXELS]: 0,
861
- [import_constants3.default.PACK_SKIP_ROWS]: 0,
862
- [import_constants3.default.UNPACK_ROW_LENGTH]: 0,
863
- [import_constants3.default.UNPACK_IMAGE_HEIGHT]: 0,
864
- [import_constants3.default.UNPACK_SKIP_PIXELS]: 0,
865
- [import_constants3.default.UNPACK_SKIP_ROWS]: 0,
866
- [import_constants3.default.UNPACK_SKIP_IMAGES]: 0
853
+ [import_constants3.GL.TRANSFORM_FEEDBACK_BINDING]: null,
854
+ [import_constants3.GL.COPY_READ_BUFFER_BINDING]: null,
855
+ [import_constants3.GL.COPY_WRITE_BUFFER_BINDING]: null,
856
+ [import_constants3.GL.PIXEL_PACK_BUFFER_BINDING]: null,
857
+ [import_constants3.GL.PIXEL_UNPACK_BUFFER_BINDING]: null,
858
+ [import_constants3.GL.FRAGMENT_SHADER_DERIVATIVE_HINT]: import_constants3.GL.DONT_CARE,
859
+ [import_constants3.GL.READ_FRAMEBUFFER_BINDING]: null,
860
+ [import_constants3.GL.RASTERIZER_DISCARD]: false,
861
+ [import_constants3.GL.PACK_ROW_LENGTH]: 0,
862
+ [import_constants3.GL.PACK_SKIP_PIXELS]: 0,
863
+ [import_constants3.GL.PACK_SKIP_ROWS]: 0,
864
+ [import_constants3.GL.UNPACK_ROW_LENGTH]: 0,
865
+ [import_constants3.GL.UNPACK_IMAGE_HEIGHT]: 0,
866
+ [import_constants3.GL.UNPACK_SKIP_PIXELS]: 0,
867
+ [import_constants3.GL.UNPACK_SKIP_ROWS]: 0,
868
+ [import_constants3.GL.UNPACK_SKIP_IMAGES]: 0
867
869
  };
868
870
  var enable = (gl, value, key) => value ? gl.enable(key) : gl.disable(key);
869
871
  var hint = (gl, value, key) => gl.hint(key, value);
870
872
  var pixelStorei = (gl, value, key) => gl.pixelStorei(key, value);
871
873
  var bindFramebuffer = (gl, value, key) => {
872
874
  let target;
873
- if (key === import_constants3.default.FRAMEBUFFER_BINDING) {
874
- target = isWebGL2(gl) ? import_constants3.default.DRAW_FRAMEBUFFER : import_constants3.default.FRAMEBUFFER;
875
+ if (key === import_constants3.GL.FRAMEBUFFER_BINDING) {
876
+ target = isWebGL2(gl) ? import_constants3.GL.DRAW_FRAMEBUFFER : import_constants3.GL.FRAMEBUFFER;
875
877
  } else {
876
- target = import_constants3.default.READ_FRAMEBUFFER;
878
+ target = import_constants3.GL.READ_FRAMEBUFFER;
877
879
  }
878
880
  return gl.bindFramebuffer(target, value);
879
881
  };
880
882
  var bindBuffer = (gl, value, key) => {
881
883
  const bindingMap = {
882
- [import_constants3.default.ARRAY_BUFFER_BINDING]: import_constants3.default.ARRAY_BUFFER,
883
- [import_constants3.default.COPY_READ_BUFFER_BINDING]: import_constants3.default.COPY_READ_BUFFER,
884
- [import_constants3.default.COPY_WRITE_BUFFER_BINDING]: import_constants3.default.COPY_WRITE_BUFFER,
885
- [import_constants3.default.PIXEL_PACK_BUFFER_BINDING]: import_constants3.default.PIXEL_PACK_BUFFER,
886
- [import_constants3.default.PIXEL_UNPACK_BUFFER_BINDING]: import_constants3.default.PIXEL_UNPACK_BUFFER
884
+ [import_constants3.GL.ARRAY_BUFFER_BINDING]: import_constants3.GL.ARRAY_BUFFER,
885
+ [import_constants3.GL.COPY_READ_BUFFER_BINDING]: import_constants3.GL.COPY_READ_BUFFER,
886
+ [import_constants3.GL.COPY_WRITE_BUFFER_BINDING]: import_constants3.GL.COPY_WRITE_BUFFER,
887
+ [import_constants3.GL.PIXEL_PACK_BUFFER_BINDING]: import_constants3.GL.PIXEL_PACK_BUFFER,
888
+ [import_constants3.GL.PIXEL_UNPACK_BUFFER_BINDING]: import_constants3.GL.PIXEL_UNPACK_BUFFER
887
889
  };
888
890
  const target = bindingMap[key];
889
891
  gl.bindBuffer(target, value);
@@ -892,93 +894,93 @@ function isArray(array) {
892
894
  return Array.isArray(array) || ArrayBuffer.isView(array) && !(array instanceof DataView);
893
895
  }
894
896
  var GL_PARAMETER_SETTERS = {
895
- [import_constants3.default.BLEND]: enable,
896
- [import_constants3.default.BLEND_COLOR]: (gl, value) => gl.blendColor(...value),
897
- [import_constants3.default.BLEND_EQUATION_RGB]: "blendEquation",
898
- [import_constants3.default.BLEND_EQUATION_ALPHA]: "blendEquation",
899
- [import_constants3.default.BLEND_SRC_RGB]: "blendFunc",
900
- [import_constants3.default.BLEND_DST_RGB]: "blendFunc",
901
- [import_constants3.default.BLEND_SRC_ALPHA]: "blendFunc",
902
- [import_constants3.default.BLEND_DST_ALPHA]: "blendFunc",
903
- [import_constants3.default.COLOR_CLEAR_VALUE]: (gl, value) => gl.clearColor(...value),
904
- [import_constants3.default.COLOR_WRITEMASK]: (gl, value) => gl.colorMask(...value),
905
- [import_constants3.default.CULL_FACE]: enable,
906
- [import_constants3.default.CULL_FACE_MODE]: (gl, value) => gl.cullFace(value),
907
- [import_constants3.default.DEPTH_TEST]: enable,
908
- [import_constants3.default.DEPTH_CLEAR_VALUE]: (gl, value) => gl.clearDepth(value),
909
- [import_constants3.default.DEPTH_FUNC]: (gl, value) => gl.depthFunc(value),
910
- [import_constants3.default.DEPTH_RANGE]: (gl, value) => gl.depthRange(...value),
911
- [import_constants3.default.DEPTH_WRITEMASK]: (gl, value) => gl.depthMask(value),
912
- [import_constants3.default.DITHER]: enable,
913
- [import_constants3.default.FRAGMENT_SHADER_DERIVATIVE_HINT]: hint,
914
- [import_constants3.default.CURRENT_PROGRAM]: (gl, value) => gl.useProgram(value),
915
- [import_constants3.default.RENDERBUFFER_BINDING]: (gl, value) => gl.bindRenderbuffer(import_constants3.default.RENDERBUFFER, value),
916
- [import_constants3.default.TRANSFORM_FEEDBACK_BINDING]: (gl, value) => {
897
+ [import_constants3.GL.BLEND]: enable,
898
+ [import_constants3.GL.BLEND_COLOR]: (gl, value) => gl.blendColor(...value),
899
+ [import_constants3.GL.BLEND_EQUATION_RGB]: "blendEquation",
900
+ [import_constants3.GL.BLEND_EQUATION_ALPHA]: "blendEquation",
901
+ [import_constants3.GL.BLEND_SRC_RGB]: "blendFunc",
902
+ [import_constants3.GL.BLEND_DST_RGB]: "blendFunc",
903
+ [import_constants3.GL.BLEND_SRC_ALPHA]: "blendFunc",
904
+ [import_constants3.GL.BLEND_DST_ALPHA]: "blendFunc",
905
+ [import_constants3.GL.COLOR_CLEAR_VALUE]: (gl, value) => gl.clearColor(...value),
906
+ [import_constants3.GL.COLOR_WRITEMASK]: (gl, value) => gl.colorMask(...value),
907
+ [import_constants3.GL.CULL_FACE]: enable,
908
+ [import_constants3.GL.CULL_FACE_MODE]: (gl, value) => gl.cullFace(value),
909
+ [import_constants3.GL.DEPTH_TEST]: enable,
910
+ [import_constants3.GL.DEPTH_CLEAR_VALUE]: (gl, value) => gl.clearDepth(value),
911
+ [import_constants3.GL.DEPTH_FUNC]: (gl, value) => gl.depthFunc(value),
912
+ [import_constants3.GL.DEPTH_RANGE]: (gl, value) => gl.depthRange(...value),
913
+ [import_constants3.GL.DEPTH_WRITEMASK]: (gl, value) => gl.depthMask(value),
914
+ [import_constants3.GL.DITHER]: enable,
915
+ [import_constants3.GL.FRAGMENT_SHADER_DERIVATIVE_HINT]: hint,
916
+ [import_constants3.GL.CURRENT_PROGRAM]: (gl, value) => gl.useProgram(value),
917
+ [import_constants3.GL.RENDERBUFFER_BINDING]: (gl, value) => gl.bindRenderbuffer(import_constants3.GL.RENDERBUFFER, value),
918
+ [import_constants3.GL.TRANSFORM_FEEDBACK_BINDING]: (gl, value) => {
917
919
  var _a;
918
- return (_a = gl.bindTransformFeedback) == null ? void 0 : _a.call(gl, import_constants3.default.TRANSFORM_FEEDBACK, value);
920
+ return (_a = gl.bindTransformFeedback) == null ? void 0 : _a.call(gl, import_constants3.GL.TRANSFORM_FEEDBACK, value);
919
921
  },
920
- [import_constants3.default.VERTEX_ARRAY_BINDING]: (gl, value) => gl.bindVertexArray(value),
922
+ [import_constants3.GL.VERTEX_ARRAY_BINDING]: (gl, value) => gl.bindVertexArray(value),
921
923
  // NOTE: FRAMEBUFFER_BINDING and DRAW_FRAMEBUFFER_BINDING(WebGL2) refer same state.
922
- [import_constants3.default.FRAMEBUFFER_BINDING]: bindFramebuffer,
923
- [import_constants3.default.READ_FRAMEBUFFER_BINDING]: bindFramebuffer,
924
+ [import_constants3.GL.FRAMEBUFFER_BINDING]: bindFramebuffer,
925
+ [import_constants3.GL.READ_FRAMEBUFFER_BINDING]: bindFramebuffer,
924
926
  // Buffers
925
- [import_constants3.default.ARRAY_BUFFER_BINDING]: bindBuffer,
926
- [import_constants3.default.COPY_READ_BUFFER_BINDING]: bindBuffer,
927
- [import_constants3.default.COPY_WRITE_BUFFER_BINDING]: bindBuffer,
928
- [import_constants3.default.PIXEL_PACK_BUFFER_BINDING]: bindBuffer,
929
- [import_constants3.default.PIXEL_UNPACK_BUFFER_BINDING]: bindBuffer,
930
- [import_constants3.default.FRONT_FACE]: (gl, value) => gl.frontFace(value),
931
- [import_constants3.default.GENERATE_MIPMAP_HINT]: hint,
932
- [import_constants3.default.LINE_WIDTH]: (gl, value) => gl.lineWidth(value),
933
- [import_constants3.default.POLYGON_OFFSET_FILL]: enable,
934
- [import_constants3.default.POLYGON_OFFSET_FACTOR]: "polygonOffset",
935
- [import_constants3.default.POLYGON_OFFSET_UNITS]: "polygonOffset",
936
- [import_constants3.default.RASTERIZER_DISCARD]: enable,
937
- [import_constants3.default.SAMPLE_ALPHA_TO_COVERAGE]: enable,
938
- [import_constants3.default.SAMPLE_COVERAGE]: enable,
939
- [import_constants3.default.SAMPLE_COVERAGE_VALUE]: "sampleCoverage",
940
- [import_constants3.default.SAMPLE_COVERAGE_INVERT]: "sampleCoverage",
941
- [import_constants3.default.SCISSOR_TEST]: enable,
942
- [import_constants3.default.SCISSOR_BOX]: (gl, value) => gl.scissor(...value),
943
- [import_constants3.default.STENCIL_TEST]: enable,
944
- [import_constants3.default.STENCIL_CLEAR_VALUE]: (gl, value) => gl.clearStencil(value),
945
- [import_constants3.default.STENCIL_WRITEMASK]: (gl, value) => gl.stencilMaskSeparate(import_constants3.default.FRONT, value),
946
- [import_constants3.default.STENCIL_BACK_WRITEMASK]: (gl, value) => gl.stencilMaskSeparate(import_constants3.default.BACK, value),
947
- [import_constants3.default.STENCIL_FUNC]: "stencilFuncFront",
948
- [import_constants3.default.STENCIL_REF]: "stencilFuncFront",
949
- [import_constants3.default.STENCIL_VALUE_MASK]: "stencilFuncFront",
950
- [import_constants3.default.STENCIL_BACK_FUNC]: "stencilFuncBack",
951
- [import_constants3.default.STENCIL_BACK_REF]: "stencilFuncBack",
952
- [import_constants3.default.STENCIL_BACK_VALUE_MASK]: "stencilFuncBack",
953
- [import_constants3.default.STENCIL_FAIL]: "stencilOpFront",
954
- [import_constants3.default.STENCIL_PASS_DEPTH_FAIL]: "stencilOpFront",
955
- [import_constants3.default.STENCIL_PASS_DEPTH_PASS]: "stencilOpFront",
956
- [import_constants3.default.STENCIL_BACK_FAIL]: "stencilOpBack",
957
- [import_constants3.default.STENCIL_BACK_PASS_DEPTH_FAIL]: "stencilOpBack",
958
- [import_constants3.default.STENCIL_BACK_PASS_DEPTH_PASS]: "stencilOpBack",
959
- [import_constants3.default.VIEWPORT]: (gl, value) => gl.viewport(...value),
927
+ [import_constants3.GL.ARRAY_BUFFER_BINDING]: bindBuffer,
928
+ [import_constants3.GL.COPY_READ_BUFFER_BINDING]: bindBuffer,
929
+ [import_constants3.GL.COPY_WRITE_BUFFER_BINDING]: bindBuffer,
930
+ [import_constants3.GL.PIXEL_PACK_BUFFER_BINDING]: bindBuffer,
931
+ [import_constants3.GL.PIXEL_UNPACK_BUFFER_BINDING]: bindBuffer,
932
+ [import_constants3.GL.FRONT_FACE]: (gl, value) => gl.frontFace(value),
933
+ [import_constants3.GL.GENERATE_MIPMAP_HINT]: hint,
934
+ [import_constants3.GL.LINE_WIDTH]: (gl, value) => gl.lineWidth(value),
935
+ [import_constants3.GL.POLYGON_OFFSET_FILL]: enable,
936
+ [import_constants3.GL.POLYGON_OFFSET_FACTOR]: "polygonOffset",
937
+ [import_constants3.GL.POLYGON_OFFSET_UNITS]: "polygonOffset",
938
+ [import_constants3.GL.RASTERIZER_DISCARD]: enable,
939
+ [import_constants3.GL.SAMPLE_ALPHA_TO_COVERAGE]: enable,
940
+ [import_constants3.GL.SAMPLE_COVERAGE]: enable,
941
+ [import_constants3.GL.SAMPLE_COVERAGE_VALUE]: "sampleCoverage",
942
+ [import_constants3.GL.SAMPLE_COVERAGE_INVERT]: "sampleCoverage",
943
+ [import_constants3.GL.SCISSOR_TEST]: enable,
944
+ [import_constants3.GL.SCISSOR_BOX]: (gl, value) => gl.scissor(...value),
945
+ [import_constants3.GL.STENCIL_TEST]: enable,
946
+ [import_constants3.GL.STENCIL_CLEAR_VALUE]: (gl, value) => gl.clearStencil(value),
947
+ [import_constants3.GL.STENCIL_WRITEMASK]: (gl, value) => gl.stencilMaskSeparate(import_constants3.GL.FRONT, value),
948
+ [import_constants3.GL.STENCIL_BACK_WRITEMASK]: (gl, value) => gl.stencilMaskSeparate(import_constants3.GL.BACK, value),
949
+ [import_constants3.GL.STENCIL_FUNC]: "stencilFuncFront",
950
+ [import_constants3.GL.STENCIL_REF]: "stencilFuncFront",
951
+ [import_constants3.GL.STENCIL_VALUE_MASK]: "stencilFuncFront",
952
+ [import_constants3.GL.STENCIL_BACK_FUNC]: "stencilFuncBack",
953
+ [import_constants3.GL.STENCIL_BACK_REF]: "stencilFuncBack",
954
+ [import_constants3.GL.STENCIL_BACK_VALUE_MASK]: "stencilFuncBack",
955
+ [import_constants3.GL.STENCIL_FAIL]: "stencilOpFront",
956
+ [import_constants3.GL.STENCIL_PASS_DEPTH_FAIL]: "stencilOpFront",
957
+ [import_constants3.GL.STENCIL_PASS_DEPTH_PASS]: "stencilOpFront",
958
+ [import_constants3.GL.STENCIL_BACK_FAIL]: "stencilOpBack",
959
+ [import_constants3.GL.STENCIL_BACK_PASS_DEPTH_FAIL]: "stencilOpBack",
960
+ [import_constants3.GL.STENCIL_BACK_PASS_DEPTH_PASS]: "stencilOpBack",
961
+ [import_constants3.GL.VIEWPORT]: (gl, value) => gl.viewport(...value),
960
962
  // WEBGL1 PIXEL PACK/UNPACK MODES
961
- [import_constants3.default.PACK_ALIGNMENT]: pixelStorei,
962
- [import_constants3.default.UNPACK_ALIGNMENT]: pixelStorei,
963
- [import_constants3.default.UNPACK_FLIP_Y_WEBGL]: pixelStorei,
964
- [import_constants3.default.UNPACK_PREMULTIPLY_ALPHA_WEBGL]: pixelStorei,
965
- [import_constants3.default.UNPACK_COLORSPACE_CONVERSION_WEBGL]: pixelStorei,
963
+ [import_constants3.GL.PACK_ALIGNMENT]: pixelStorei,
964
+ [import_constants3.GL.UNPACK_ALIGNMENT]: pixelStorei,
965
+ [import_constants3.GL.UNPACK_FLIP_Y_WEBGL]: pixelStorei,
966
+ [import_constants3.GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL]: pixelStorei,
967
+ [import_constants3.GL.UNPACK_COLORSPACE_CONVERSION_WEBGL]: pixelStorei,
966
968
  // WEBGL2 PIXEL PACK/UNPACK MODES
967
969
  // RASTERIZER_DISCARD ...
968
- [import_constants3.default.PACK_ROW_LENGTH]: pixelStorei,
969
- [import_constants3.default.PACK_SKIP_PIXELS]: pixelStorei,
970
- [import_constants3.default.PACK_SKIP_ROWS]: pixelStorei,
971
- [import_constants3.default.UNPACK_ROW_LENGTH]: pixelStorei,
972
- [import_constants3.default.UNPACK_IMAGE_HEIGHT]: pixelStorei,
973
- [import_constants3.default.UNPACK_SKIP_PIXELS]: pixelStorei,
974
- [import_constants3.default.UNPACK_SKIP_ROWS]: pixelStorei,
975
- [import_constants3.default.UNPACK_SKIP_IMAGES]: pixelStorei,
970
+ [import_constants3.GL.PACK_ROW_LENGTH]: pixelStorei,
971
+ [import_constants3.GL.PACK_SKIP_PIXELS]: pixelStorei,
972
+ [import_constants3.GL.PACK_SKIP_ROWS]: pixelStorei,
973
+ [import_constants3.GL.UNPACK_ROW_LENGTH]: pixelStorei,
974
+ [import_constants3.GL.UNPACK_IMAGE_HEIGHT]: pixelStorei,
975
+ [import_constants3.GL.UNPACK_SKIP_PIXELS]: pixelStorei,
976
+ [import_constants3.GL.UNPACK_SKIP_ROWS]: pixelStorei,
977
+ [import_constants3.GL.UNPACK_SKIP_IMAGES]: pixelStorei,
976
978
  // Function-style setters
977
979
  framebuffer: (gl, framebuffer) => {
978
980
  const handle = framebuffer && "handle" in framebuffer ? framebuffer.handle : framebuffer;
979
- return gl.bindFramebuffer(import_constants3.default.FRAMEBUFFER, handle);
981
+ return gl.bindFramebuffer(import_constants3.GL.FRAMEBUFFER, handle);
980
982
  },
981
- blend: (gl, value) => value ? gl.enable(import_constants3.default.BLEND) : gl.disable(import_constants3.default.BLEND),
983
+ blend: (gl, value) => value ? gl.enable(import_constants3.GL.BLEND) : gl.disable(import_constants3.GL.BLEND),
982
984
  blendColor: (gl, value) => gl.blendColor(...value),
983
985
  blendEquation: (gl, args) => {
984
986
  const separateModes = typeof args === "number" ? [args, args] : args;
@@ -992,42 +994,42 @@ var GL_PARAMETER_SETTERS = {
992
994
  clearDepth: (gl, value) => gl.clearDepth(value),
993
995
  clearStencil: (gl, value) => gl.clearStencil(value),
994
996
  colorMask: (gl, value) => gl.colorMask(...value),
995
- cull: (gl, value) => value ? gl.enable(import_constants3.default.CULL_FACE) : gl.disable(import_constants3.default.CULL_FACE),
997
+ cull: (gl, value) => value ? gl.enable(import_constants3.GL.CULL_FACE) : gl.disable(import_constants3.GL.CULL_FACE),
996
998
  cullFace: (gl, value) => gl.cullFace(value),
997
- depthTest: (gl, value) => value ? gl.enable(import_constants3.default.DEPTH_TEST) : gl.disable(import_constants3.default.DEPTH_TEST),
999
+ depthTest: (gl, value) => value ? gl.enable(import_constants3.GL.DEPTH_TEST) : gl.disable(import_constants3.GL.DEPTH_TEST),
998
1000
  depthFunc: (gl, value) => gl.depthFunc(value),
999
1001
  depthMask: (gl, value) => gl.depthMask(value),
1000
1002
  depthRange: (gl, value) => gl.depthRange(...value),
1001
- dither: (gl, value) => value ? gl.enable(import_constants3.default.DITHER) : gl.disable(import_constants3.default.DITHER),
1003
+ dither: (gl, value) => value ? gl.enable(import_constants3.GL.DITHER) : gl.disable(import_constants3.GL.DITHER),
1002
1004
  derivativeHint: (gl, value) => {
1003
- gl.hint(import_constants3.default.FRAGMENT_SHADER_DERIVATIVE_HINT, value);
1005
+ gl.hint(import_constants3.GL.FRAGMENT_SHADER_DERIVATIVE_HINT, value);
1004
1006
  },
1005
1007
  frontFace: (gl, value) => gl.frontFace(value),
1006
- mipmapHint: (gl, value) => gl.hint(import_constants3.default.GENERATE_MIPMAP_HINT, value),
1008
+ mipmapHint: (gl, value) => gl.hint(import_constants3.GL.GENERATE_MIPMAP_HINT, value),
1007
1009
  lineWidth: (gl, value) => gl.lineWidth(value),
1008
- polygonOffsetFill: (gl, value) => value ? gl.enable(import_constants3.default.POLYGON_OFFSET_FILL) : gl.disable(import_constants3.default.POLYGON_OFFSET_FILL),
1010
+ polygonOffsetFill: (gl, value) => value ? gl.enable(import_constants3.GL.POLYGON_OFFSET_FILL) : gl.disable(import_constants3.GL.POLYGON_OFFSET_FILL),
1009
1011
  polygonOffset: (gl, value) => gl.polygonOffset(...value),
1010
1012
  sampleCoverage: (gl, value) => gl.sampleCoverage(...value),
1011
- scissorTest: (gl, value) => value ? gl.enable(import_constants3.default.SCISSOR_TEST) : gl.disable(import_constants3.default.SCISSOR_TEST),
1013
+ scissorTest: (gl, value) => value ? gl.enable(import_constants3.GL.SCISSOR_TEST) : gl.disable(import_constants3.GL.SCISSOR_TEST),
1012
1014
  scissor: (gl, value) => gl.scissor(...value),
1013
- stencilTest: (gl, value) => value ? gl.enable(import_constants3.default.STENCIL_TEST) : gl.disable(import_constants3.default.STENCIL_TEST),
1015
+ stencilTest: (gl, value) => value ? gl.enable(import_constants3.GL.STENCIL_TEST) : gl.disable(import_constants3.GL.STENCIL_TEST),
1014
1016
  stencilMask: (gl, value) => {
1015
1017
  value = isArray(value) ? value : [value, value];
1016
1018
  const [mask, backMask] = value;
1017
- gl.stencilMaskSeparate(import_constants3.default.FRONT, mask);
1018
- gl.stencilMaskSeparate(import_constants3.default.BACK, backMask);
1019
+ gl.stencilMaskSeparate(import_constants3.GL.FRONT, mask);
1020
+ gl.stencilMaskSeparate(import_constants3.GL.BACK, backMask);
1019
1021
  },
1020
1022
  stencilFunc: (gl, args) => {
1021
1023
  args = isArray(args) && args.length === 3 ? [...args, ...args] : args;
1022
1024
  const [func, ref, mask, backFunc, backRef, backMask] = args;
1023
- gl.stencilFuncSeparate(import_constants3.default.FRONT, func, ref, mask);
1024
- gl.stencilFuncSeparate(import_constants3.default.BACK, backFunc, backRef, backMask);
1025
+ gl.stencilFuncSeparate(import_constants3.GL.FRONT, func, ref, mask);
1026
+ gl.stencilFuncSeparate(import_constants3.GL.BACK, backFunc, backRef, backMask);
1025
1027
  },
1026
1028
  stencilOp: (gl, args) => {
1027
1029
  args = isArray(args) && args.length === 3 ? [...args, ...args] : args;
1028
1030
  const [sfail, dpfail, dppass, backSfail, backDpfail, backDppass] = args;
1029
- gl.stencilOpSeparate(import_constants3.default.FRONT, sfail, dpfail, dppass);
1030
- gl.stencilOpSeparate(import_constants3.default.BACK, backSfail, backDpfail, backDppass);
1031
+ gl.stencilOpSeparate(import_constants3.GL.FRONT, sfail, dpfail, dppass);
1032
+ gl.stencilOpSeparate(import_constants3.GL.BACK, backSfail, backDpfail, backDppass);
1031
1033
  },
1032
1034
  viewport: (gl, value) => gl.viewport(...value)
1033
1035
  };
@@ -1036,46 +1038,46 @@ function getValue(glEnum, values, cache) {
1036
1038
  }
1037
1039
  var GL_COMPOSITE_PARAMETER_SETTERS = {
1038
1040
  blendEquation: (gl, values, cache) => gl.blendEquationSeparate(
1039
- getValue(import_constants3.default.BLEND_EQUATION_RGB, values, cache),
1040
- getValue(import_constants3.default.BLEND_EQUATION_ALPHA, values, cache)
1041
+ getValue(import_constants3.GL.BLEND_EQUATION_RGB, values, cache),
1042
+ getValue(import_constants3.GL.BLEND_EQUATION_ALPHA, values, cache)
1041
1043
  ),
1042
1044
  blendFunc: (gl, values, cache) => gl.blendFuncSeparate(
1043
- getValue(import_constants3.default.BLEND_SRC_RGB, values, cache),
1044
- getValue(import_constants3.default.BLEND_DST_RGB, values, cache),
1045
- getValue(import_constants3.default.BLEND_SRC_ALPHA, values, cache),
1046
- getValue(import_constants3.default.BLEND_DST_ALPHA, values, cache)
1045
+ getValue(import_constants3.GL.BLEND_SRC_RGB, values, cache),
1046
+ getValue(import_constants3.GL.BLEND_DST_RGB, values, cache),
1047
+ getValue(import_constants3.GL.BLEND_SRC_ALPHA, values, cache),
1048
+ getValue(import_constants3.GL.BLEND_DST_ALPHA, values, cache)
1047
1049
  ),
1048
1050
  polygonOffset: (gl, values, cache) => gl.polygonOffset(
1049
- getValue(import_constants3.default.POLYGON_OFFSET_FACTOR, values, cache),
1050
- getValue(import_constants3.default.POLYGON_OFFSET_UNITS, values, cache)
1051
+ getValue(import_constants3.GL.POLYGON_OFFSET_FACTOR, values, cache),
1052
+ getValue(import_constants3.GL.POLYGON_OFFSET_UNITS, values, cache)
1051
1053
  ),
1052
1054
  sampleCoverage: (gl, values, cache) => gl.sampleCoverage(
1053
- getValue(import_constants3.default.SAMPLE_COVERAGE_VALUE, values, cache),
1054
- getValue(import_constants3.default.SAMPLE_COVERAGE_INVERT, values, cache)
1055
+ getValue(import_constants3.GL.SAMPLE_COVERAGE_VALUE, values, cache),
1056
+ getValue(import_constants3.GL.SAMPLE_COVERAGE_INVERT, values, cache)
1055
1057
  ),
1056
1058
  stencilFuncFront: (gl, values, cache) => gl.stencilFuncSeparate(
1057
- import_constants3.default.FRONT,
1058
- getValue(import_constants3.default.STENCIL_FUNC, values, cache),
1059
- getValue(import_constants3.default.STENCIL_REF, values, cache),
1060
- getValue(import_constants3.default.STENCIL_VALUE_MASK, values, cache)
1059
+ import_constants3.GL.FRONT,
1060
+ getValue(import_constants3.GL.STENCIL_FUNC, values, cache),
1061
+ getValue(import_constants3.GL.STENCIL_REF, values, cache),
1062
+ getValue(import_constants3.GL.STENCIL_VALUE_MASK, values, cache)
1061
1063
  ),
1062
1064
  stencilFuncBack: (gl, values, cache) => gl.stencilFuncSeparate(
1063
- import_constants3.default.BACK,
1064
- getValue(import_constants3.default.STENCIL_BACK_FUNC, values, cache),
1065
- getValue(import_constants3.default.STENCIL_BACK_REF, values, cache),
1066
- getValue(import_constants3.default.STENCIL_BACK_VALUE_MASK, values, cache)
1065
+ import_constants3.GL.BACK,
1066
+ getValue(import_constants3.GL.STENCIL_BACK_FUNC, values, cache),
1067
+ getValue(import_constants3.GL.STENCIL_BACK_REF, values, cache),
1068
+ getValue(import_constants3.GL.STENCIL_BACK_VALUE_MASK, values, cache)
1067
1069
  ),
1068
1070
  stencilOpFront: (gl, values, cache) => gl.stencilOpSeparate(
1069
- import_constants3.default.FRONT,
1070
- getValue(import_constants3.default.STENCIL_FAIL, values, cache),
1071
- getValue(import_constants3.default.STENCIL_PASS_DEPTH_FAIL, values, cache),
1072
- getValue(import_constants3.default.STENCIL_PASS_DEPTH_PASS, values, cache)
1071
+ import_constants3.GL.FRONT,
1072
+ getValue(import_constants3.GL.STENCIL_FAIL, values, cache),
1073
+ getValue(import_constants3.GL.STENCIL_PASS_DEPTH_FAIL, values, cache),
1074
+ getValue(import_constants3.GL.STENCIL_PASS_DEPTH_PASS, values, cache)
1073
1075
  ),
1074
1076
  stencilOpBack: (gl, values, cache) => gl.stencilOpSeparate(
1075
- import_constants3.default.BACK,
1076
- getValue(import_constants3.default.STENCIL_BACK_FAIL, values, cache),
1077
- getValue(import_constants3.default.STENCIL_BACK_PASS_DEPTH_FAIL, values, cache),
1078
- getValue(import_constants3.default.STENCIL_BACK_PASS_DEPTH_PASS, values, cache)
1077
+ import_constants3.GL.BACK,
1078
+ getValue(import_constants3.GL.STENCIL_BACK_FAIL, values, cache),
1079
+ getValue(import_constants3.GL.STENCIL_BACK_PASS_DEPTH_FAIL, values, cache),
1080
+ getValue(import_constants3.GL.STENCIL_BACK_PASS_DEPTH_PASS, values, cache)
1079
1081
  )
1080
1082
  };
1081
1083
  var GL_HOOKED_SETTERS = {
@@ -1094,39 +1096,39 @@ var GL_HOOKED_SETTERS = {
1094
1096
  }),
1095
1097
  // SPECIFIC SETTERS
1096
1098
  useProgram: (update, value) => update({
1097
- [import_constants3.default.CURRENT_PROGRAM]: value
1099
+ [import_constants3.GL.CURRENT_PROGRAM]: value
1098
1100
  }),
1099
1101
  bindRenderbuffer: (update, target, value) => update({
1100
- [import_constants3.default.RENDERBUFFER_BINDING]: value
1102
+ [import_constants3.GL.RENDERBUFFER_BINDING]: value
1101
1103
  }),
1102
1104
  bindTransformFeedback: (update, target, value) => update({
1103
- [import_constants3.default.TRANSFORM_FEEDBACK_BINDING]: value
1105
+ [import_constants3.GL.TRANSFORM_FEEDBACK_BINDING]: value
1104
1106
  }),
1105
1107
  bindVertexArray: (update, value) => update({
1106
- [import_constants3.default.VERTEX_ARRAY_BINDING]: value
1108
+ [import_constants3.GL.VERTEX_ARRAY_BINDING]: value
1107
1109
  }),
1108
1110
  bindFramebuffer: (update, target, framebuffer) => {
1109
1111
  switch (target) {
1110
- case import_constants3.default.FRAMEBUFFER:
1112
+ case import_constants3.GL.FRAMEBUFFER:
1111
1113
  return update({
1112
- [import_constants3.default.DRAW_FRAMEBUFFER_BINDING]: framebuffer,
1113
- [import_constants3.default.READ_FRAMEBUFFER_BINDING]: framebuffer
1114
+ [import_constants3.GL.DRAW_FRAMEBUFFER_BINDING]: framebuffer,
1115
+ [import_constants3.GL.READ_FRAMEBUFFER_BINDING]: framebuffer
1114
1116
  });
1115
- case import_constants3.default.DRAW_FRAMEBUFFER:
1116
- return update({ [import_constants3.default.DRAW_FRAMEBUFFER_BINDING]: framebuffer });
1117
- case import_constants3.default.READ_FRAMEBUFFER:
1118
- return update({ [import_constants3.default.READ_FRAMEBUFFER_BINDING]: framebuffer });
1117
+ case import_constants3.GL.DRAW_FRAMEBUFFER:
1118
+ return update({ [import_constants3.GL.DRAW_FRAMEBUFFER_BINDING]: framebuffer });
1119
+ case import_constants3.GL.READ_FRAMEBUFFER:
1120
+ return update({ [import_constants3.GL.READ_FRAMEBUFFER_BINDING]: framebuffer });
1119
1121
  default:
1120
1122
  return null;
1121
1123
  }
1122
1124
  },
1123
1125
  bindBuffer: (update, target, buffer) => {
1124
1126
  const pname = {
1125
- [import_constants3.default.ARRAY_BUFFER]: [import_constants3.default.ARRAY_BUFFER_BINDING],
1126
- [import_constants3.default.COPY_READ_BUFFER]: [import_constants3.default.COPY_READ_BUFFER_BINDING],
1127
- [import_constants3.default.COPY_WRITE_BUFFER]: [import_constants3.default.COPY_WRITE_BUFFER_BINDING],
1128
- [import_constants3.default.PIXEL_PACK_BUFFER]: [import_constants3.default.PIXEL_PACK_BUFFER_BINDING],
1129
- [import_constants3.default.PIXEL_UNPACK_BUFFER]: [import_constants3.default.PIXEL_UNPACK_BUFFER_BINDING]
1127
+ [import_constants3.GL.ARRAY_BUFFER]: [import_constants3.GL.ARRAY_BUFFER_BINDING],
1128
+ [import_constants3.GL.COPY_READ_BUFFER]: [import_constants3.GL.COPY_READ_BUFFER_BINDING],
1129
+ [import_constants3.GL.COPY_WRITE_BUFFER]: [import_constants3.GL.COPY_WRITE_BUFFER_BINDING],
1130
+ [import_constants3.GL.PIXEL_PACK_BUFFER]: [import_constants3.GL.PIXEL_PACK_BUFFER_BINDING],
1131
+ [import_constants3.GL.PIXEL_UNPACK_BUFFER]: [import_constants3.GL.PIXEL_UNPACK_BUFFER_BINDING]
1130
1132
  }[target];
1131
1133
  if (pname) {
1132
1134
  return update({ [pname]: buffer });
@@ -1134,157 +1136,157 @@ var GL_HOOKED_SETTERS = {
1134
1136
  return { valueChanged: true };
1135
1137
  },
1136
1138
  blendColor: (update, r, g, b, a) => update({
1137
- [import_constants3.default.BLEND_COLOR]: new Float32Array([r, g, b, a])
1139
+ [import_constants3.GL.BLEND_COLOR]: new Float32Array([r, g, b, a])
1138
1140
  }),
1139
1141
  blendEquation: (update, mode) => update({
1140
- [import_constants3.default.BLEND_EQUATION_RGB]: mode,
1141
- [import_constants3.default.BLEND_EQUATION_ALPHA]: mode
1142
+ [import_constants3.GL.BLEND_EQUATION_RGB]: mode,
1143
+ [import_constants3.GL.BLEND_EQUATION_ALPHA]: mode
1142
1144
  }),
1143
1145
  blendEquationSeparate: (update, modeRGB, modeAlpha) => update({
1144
- [import_constants3.default.BLEND_EQUATION_RGB]: modeRGB,
1145
- [import_constants3.default.BLEND_EQUATION_ALPHA]: modeAlpha
1146
+ [import_constants3.GL.BLEND_EQUATION_RGB]: modeRGB,
1147
+ [import_constants3.GL.BLEND_EQUATION_ALPHA]: modeAlpha
1146
1148
  }),
1147
1149
  blendFunc: (update, src, dst) => update({
1148
- [import_constants3.default.BLEND_SRC_RGB]: src,
1149
- [import_constants3.default.BLEND_DST_RGB]: dst,
1150
- [import_constants3.default.BLEND_SRC_ALPHA]: src,
1151
- [import_constants3.default.BLEND_DST_ALPHA]: dst
1150
+ [import_constants3.GL.BLEND_SRC_RGB]: src,
1151
+ [import_constants3.GL.BLEND_DST_RGB]: dst,
1152
+ [import_constants3.GL.BLEND_SRC_ALPHA]: src,
1153
+ [import_constants3.GL.BLEND_DST_ALPHA]: dst
1152
1154
  }),
1153
1155
  blendFuncSeparate: (update, srcRGB, dstRGB, srcAlpha, dstAlpha) => update({
1154
- [import_constants3.default.BLEND_SRC_RGB]: srcRGB,
1155
- [import_constants3.default.BLEND_DST_RGB]: dstRGB,
1156
- [import_constants3.default.BLEND_SRC_ALPHA]: srcAlpha,
1157
- [import_constants3.default.BLEND_DST_ALPHA]: dstAlpha
1156
+ [import_constants3.GL.BLEND_SRC_RGB]: srcRGB,
1157
+ [import_constants3.GL.BLEND_DST_RGB]: dstRGB,
1158
+ [import_constants3.GL.BLEND_SRC_ALPHA]: srcAlpha,
1159
+ [import_constants3.GL.BLEND_DST_ALPHA]: dstAlpha
1158
1160
  }),
1159
1161
  clearColor: (update, r, g, b, a) => update({
1160
- [import_constants3.default.COLOR_CLEAR_VALUE]: new Float32Array([r, g, b, a])
1162
+ [import_constants3.GL.COLOR_CLEAR_VALUE]: new Float32Array([r, g, b, a])
1161
1163
  }),
1162
1164
  clearDepth: (update, depth) => update({
1163
- [import_constants3.default.DEPTH_CLEAR_VALUE]: depth
1165
+ [import_constants3.GL.DEPTH_CLEAR_VALUE]: depth
1164
1166
  }),
1165
1167
  clearStencil: (update, s) => update({
1166
- [import_constants3.default.STENCIL_CLEAR_VALUE]: s
1168
+ [import_constants3.GL.STENCIL_CLEAR_VALUE]: s
1167
1169
  }),
1168
1170
  colorMask: (update, r, g, b, a) => update({
1169
- [import_constants3.default.COLOR_WRITEMASK]: [r, g, b, a]
1171
+ [import_constants3.GL.COLOR_WRITEMASK]: [r, g, b, a]
1170
1172
  }),
1171
1173
  cullFace: (update, mode) => update({
1172
- [import_constants3.default.CULL_FACE_MODE]: mode
1174
+ [import_constants3.GL.CULL_FACE_MODE]: mode
1173
1175
  }),
1174
1176
  depthFunc: (update, func) => update({
1175
- [import_constants3.default.DEPTH_FUNC]: func
1177
+ [import_constants3.GL.DEPTH_FUNC]: func
1176
1178
  }),
1177
1179
  depthRange: (update, zNear, zFar) => update({
1178
- [import_constants3.default.DEPTH_RANGE]: new Float32Array([zNear, zFar])
1180
+ [import_constants3.GL.DEPTH_RANGE]: new Float32Array([zNear, zFar])
1179
1181
  }),
1180
1182
  depthMask: (update, mask) => update({
1181
- [import_constants3.default.DEPTH_WRITEMASK]: mask
1183
+ [import_constants3.GL.DEPTH_WRITEMASK]: mask
1182
1184
  }),
1183
1185
  frontFace: (update, face) => update({
1184
- [import_constants3.default.FRONT_FACE]: face
1186
+ [import_constants3.GL.FRONT_FACE]: face
1185
1187
  }),
1186
1188
  lineWidth: (update, width) => update({
1187
- [import_constants3.default.LINE_WIDTH]: width
1189
+ [import_constants3.GL.LINE_WIDTH]: width
1188
1190
  }),
1189
1191
  polygonOffset: (update, factor, units) => update({
1190
- [import_constants3.default.POLYGON_OFFSET_FACTOR]: factor,
1191
- [import_constants3.default.POLYGON_OFFSET_UNITS]: units
1192
+ [import_constants3.GL.POLYGON_OFFSET_FACTOR]: factor,
1193
+ [import_constants3.GL.POLYGON_OFFSET_UNITS]: units
1192
1194
  }),
1193
1195
  sampleCoverage: (update, value, invert) => update({
1194
- [import_constants3.default.SAMPLE_COVERAGE_VALUE]: value,
1195
- [import_constants3.default.SAMPLE_COVERAGE_INVERT]: invert
1196
+ [import_constants3.GL.SAMPLE_COVERAGE_VALUE]: value,
1197
+ [import_constants3.GL.SAMPLE_COVERAGE_INVERT]: invert
1196
1198
  }),
1197
1199
  scissor: (update, x, y, width, height) => update({
1198
- [import_constants3.default.SCISSOR_BOX]: new Int32Array([x, y, width, height])
1200
+ [import_constants3.GL.SCISSOR_BOX]: new Int32Array([x, y, width, height])
1199
1201
  }),
1200
1202
  stencilMask: (update, mask) => update({
1201
- [import_constants3.default.STENCIL_WRITEMASK]: mask,
1202
- [import_constants3.default.STENCIL_BACK_WRITEMASK]: mask
1203
+ [import_constants3.GL.STENCIL_WRITEMASK]: mask,
1204
+ [import_constants3.GL.STENCIL_BACK_WRITEMASK]: mask
1203
1205
  }),
1204
1206
  stencilMaskSeparate: (update, face, mask) => update({
1205
- [face === import_constants3.default.FRONT ? import_constants3.default.STENCIL_WRITEMASK : import_constants3.default.STENCIL_BACK_WRITEMASK]: mask
1207
+ [face === import_constants3.GL.FRONT ? import_constants3.GL.STENCIL_WRITEMASK : import_constants3.GL.STENCIL_BACK_WRITEMASK]: mask
1206
1208
  }),
1207
1209
  stencilFunc: (update, func, ref, mask) => update({
1208
- [import_constants3.default.STENCIL_FUNC]: func,
1209
- [import_constants3.default.STENCIL_REF]: ref,
1210
- [import_constants3.default.STENCIL_VALUE_MASK]: mask,
1211
- [import_constants3.default.STENCIL_BACK_FUNC]: func,
1212
- [import_constants3.default.STENCIL_BACK_REF]: ref,
1213
- [import_constants3.default.STENCIL_BACK_VALUE_MASK]: mask
1210
+ [import_constants3.GL.STENCIL_FUNC]: func,
1211
+ [import_constants3.GL.STENCIL_REF]: ref,
1212
+ [import_constants3.GL.STENCIL_VALUE_MASK]: mask,
1213
+ [import_constants3.GL.STENCIL_BACK_FUNC]: func,
1214
+ [import_constants3.GL.STENCIL_BACK_REF]: ref,
1215
+ [import_constants3.GL.STENCIL_BACK_VALUE_MASK]: mask
1214
1216
  }),
1215
1217
  stencilFuncSeparate: (update, face, func, ref, mask) => update({
1216
- [face === import_constants3.default.FRONT ? import_constants3.default.STENCIL_FUNC : import_constants3.default.STENCIL_BACK_FUNC]: func,
1217
- [face === import_constants3.default.FRONT ? import_constants3.default.STENCIL_REF : import_constants3.default.STENCIL_BACK_REF]: ref,
1218
- [face === import_constants3.default.FRONT ? import_constants3.default.STENCIL_VALUE_MASK : import_constants3.default.STENCIL_BACK_VALUE_MASK]: mask
1218
+ [face === import_constants3.GL.FRONT ? import_constants3.GL.STENCIL_FUNC : import_constants3.GL.STENCIL_BACK_FUNC]: func,
1219
+ [face === import_constants3.GL.FRONT ? import_constants3.GL.STENCIL_REF : import_constants3.GL.STENCIL_BACK_REF]: ref,
1220
+ [face === import_constants3.GL.FRONT ? import_constants3.GL.STENCIL_VALUE_MASK : import_constants3.GL.STENCIL_BACK_VALUE_MASK]: mask
1219
1221
  }),
1220
1222
  stencilOp: (update, fail, zfail, zpass) => update({
1221
- [import_constants3.default.STENCIL_FAIL]: fail,
1222
- [import_constants3.default.STENCIL_PASS_DEPTH_FAIL]: zfail,
1223
- [import_constants3.default.STENCIL_PASS_DEPTH_PASS]: zpass,
1224
- [import_constants3.default.STENCIL_BACK_FAIL]: fail,
1225
- [import_constants3.default.STENCIL_BACK_PASS_DEPTH_FAIL]: zfail,
1226
- [import_constants3.default.STENCIL_BACK_PASS_DEPTH_PASS]: zpass
1223
+ [import_constants3.GL.STENCIL_FAIL]: fail,
1224
+ [import_constants3.GL.STENCIL_PASS_DEPTH_FAIL]: zfail,
1225
+ [import_constants3.GL.STENCIL_PASS_DEPTH_PASS]: zpass,
1226
+ [import_constants3.GL.STENCIL_BACK_FAIL]: fail,
1227
+ [import_constants3.GL.STENCIL_BACK_PASS_DEPTH_FAIL]: zfail,
1228
+ [import_constants3.GL.STENCIL_BACK_PASS_DEPTH_PASS]: zpass
1227
1229
  }),
1228
1230
  stencilOpSeparate: (update, face, fail, zfail, zpass) => update({
1229
- [face === import_constants3.default.FRONT ? import_constants3.default.STENCIL_FAIL : import_constants3.default.STENCIL_BACK_FAIL]: fail,
1230
- [face === import_constants3.default.FRONT ? import_constants3.default.STENCIL_PASS_DEPTH_FAIL : import_constants3.default.STENCIL_BACK_PASS_DEPTH_FAIL]: zfail,
1231
- [face === import_constants3.default.FRONT ? import_constants3.default.STENCIL_PASS_DEPTH_PASS : import_constants3.default.STENCIL_BACK_PASS_DEPTH_PASS]: zpass
1231
+ [face === import_constants3.GL.FRONT ? import_constants3.GL.STENCIL_FAIL : import_constants3.GL.STENCIL_BACK_FAIL]: fail,
1232
+ [face === import_constants3.GL.FRONT ? import_constants3.GL.STENCIL_PASS_DEPTH_FAIL : import_constants3.GL.STENCIL_BACK_PASS_DEPTH_FAIL]: zfail,
1233
+ [face === import_constants3.GL.FRONT ? import_constants3.GL.STENCIL_PASS_DEPTH_PASS : import_constants3.GL.STENCIL_BACK_PASS_DEPTH_PASS]: zpass
1232
1234
  }),
1233
1235
  viewport: (update, x, y, width, height) => update({
1234
- [import_constants3.default.VIEWPORT]: [x, y, width, height]
1236
+ [import_constants3.GL.VIEWPORT]: [x, y, width, height]
1235
1237
  })
1236
1238
  };
1237
1239
  var isEnabled = (gl, key) => gl.isEnabled(key);
1238
1240
  var GL_PARAMETER_GETTERS = {
1239
- [import_constants3.default.BLEND]: isEnabled,
1240
- [import_constants3.default.CULL_FACE]: isEnabled,
1241
- [import_constants3.default.DEPTH_TEST]: isEnabled,
1242
- [import_constants3.default.DITHER]: isEnabled,
1243
- [import_constants3.default.POLYGON_OFFSET_FILL]: isEnabled,
1244
- [import_constants3.default.SAMPLE_ALPHA_TO_COVERAGE]: isEnabled,
1245
- [import_constants3.default.SAMPLE_COVERAGE]: isEnabled,
1246
- [import_constants3.default.SCISSOR_TEST]: isEnabled,
1247
- [import_constants3.default.STENCIL_TEST]: isEnabled,
1241
+ [import_constants3.GL.BLEND]: isEnabled,
1242
+ [import_constants3.GL.CULL_FACE]: isEnabled,
1243
+ [import_constants3.GL.DEPTH_TEST]: isEnabled,
1244
+ [import_constants3.GL.DITHER]: isEnabled,
1245
+ [import_constants3.GL.POLYGON_OFFSET_FILL]: isEnabled,
1246
+ [import_constants3.GL.SAMPLE_ALPHA_TO_COVERAGE]: isEnabled,
1247
+ [import_constants3.GL.SAMPLE_COVERAGE]: isEnabled,
1248
+ [import_constants3.GL.SCISSOR_TEST]: isEnabled,
1249
+ [import_constants3.GL.STENCIL_TEST]: isEnabled,
1248
1250
  // WebGL 2
1249
- [import_constants3.default.RASTERIZER_DISCARD]: isEnabled
1251
+ [import_constants3.GL.RASTERIZER_DISCARD]: isEnabled
1250
1252
  };
1251
1253
  var NON_CACHE_PARAMETERS = /* @__PURE__ */ new Set([
1252
1254
  // setter not intercepted
1253
- import_constants3.default.ACTIVE_TEXTURE,
1254
- import_constants3.default.TRANSFORM_FEEDBACK_ACTIVE,
1255
- import_constants3.default.TRANSFORM_FEEDBACK_PAUSED,
1255
+ import_constants3.GL.ACTIVE_TEXTURE,
1256
+ import_constants3.GL.TRANSFORM_FEEDBACK_ACTIVE,
1257
+ import_constants3.GL.TRANSFORM_FEEDBACK_PAUSED,
1256
1258
  // setters bindBufferRange/bindBufferBase cannot be pruned based on cache
1257
- import_constants3.default.TRANSFORM_FEEDBACK_BUFFER_BINDING,
1258
- import_constants3.default.UNIFORM_BUFFER_BINDING,
1259
+ import_constants3.GL.TRANSFORM_FEEDBACK_BUFFER_BINDING,
1260
+ import_constants3.GL.UNIFORM_BUFFER_BINDING,
1259
1261
  // states depending on VERTEX_ARRAY_BINDING
1260
- import_constants3.default.ELEMENT_ARRAY_BUFFER_BINDING,
1262
+ import_constants3.GL.ELEMENT_ARRAY_BUFFER_BINDING,
1261
1263
  // states depending on READ_FRAMEBUFFER_BINDING
1262
- import_constants3.default.IMPLEMENTATION_COLOR_READ_FORMAT,
1263
- import_constants3.default.IMPLEMENTATION_COLOR_READ_TYPE,
1264
+ import_constants3.GL.IMPLEMENTATION_COLOR_READ_FORMAT,
1265
+ import_constants3.GL.IMPLEMENTATION_COLOR_READ_TYPE,
1264
1266
  // states depending on FRAMEBUFFER_BINDING
1265
- import_constants3.default.READ_BUFFER,
1266
- import_constants3.default.DRAW_BUFFER0,
1267
- import_constants3.default.DRAW_BUFFER1,
1268
- import_constants3.default.DRAW_BUFFER2,
1269
- import_constants3.default.DRAW_BUFFER3,
1270
- import_constants3.default.DRAW_BUFFER4,
1271
- import_constants3.default.DRAW_BUFFER5,
1272
- import_constants3.default.DRAW_BUFFER6,
1273
- import_constants3.default.DRAW_BUFFER7,
1274
- import_constants3.default.DRAW_BUFFER8,
1275
- import_constants3.default.DRAW_BUFFER9,
1276
- import_constants3.default.DRAW_BUFFER10,
1277
- import_constants3.default.DRAW_BUFFER11,
1278
- import_constants3.default.DRAW_BUFFER12,
1279
- import_constants3.default.DRAW_BUFFER13,
1280
- import_constants3.default.DRAW_BUFFER14,
1281
- import_constants3.default.DRAW_BUFFER15,
1267
+ import_constants3.GL.READ_BUFFER,
1268
+ import_constants3.GL.DRAW_BUFFER0,
1269
+ import_constants3.GL.DRAW_BUFFER1,
1270
+ import_constants3.GL.DRAW_BUFFER2,
1271
+ import_constants3.GL.DRAW_BUFFER3,
1272
+ import_constants3.GL.DRAW_BUFFER4,
1273
+ import_constants3.GL.DRAW_BUFFER5,
1274
+ import_constants3.GL.DRAW_BUFFER6,
1275
+ import_constants3.GL.DRAW_BUFFER7,
1276
+ import_constants3.GL.DRAW_BUFFER8,
1277
+ import_constants3.GL.DRAW_BUFFER9,
1278
+ import_constants3.GL.DRAW_BUFFER10,
1279
+ import_constants3.GL.DRAW_BUFFER11,
1280
+ import_constants3.GL.DRAW_BUFFER12,
1281
+ import_constants3.GL.DRAW_BUFFER13,
1282
+ import_constants3.GL.DRAW_BUFFER14,
1283
+ import_constants3.GL.DRAW_BUFFER15,
1282
1284
  // states depending on ACTIVE_TEXTURE
1283
- import_constants3.default.SAMPLER_BINDING,
1284
- import_constants3.default.TEXTURE_BINDING_2D,
1285
- import_constants3.default.TEXTURE_BINDING_2D_ARRAY,
1286
- import_constants3.default.TEXTURE_BINDING_3D,
1287
- import_constants3.default.TEXTURE_BINDING_CUBE_MAP
1285
+ import_constants3.GL.SAMPLER_BINDING,
1286
+ import_constants3.GL.TEXTURE_BINDING_2D,
1287
+ import_constants3.GL.TEXTURE_BINDING_2D_ARRAY,
1288
+ import_constants3.GL.TEXTURE_BINDING_3D,
1289
+ import_constants3.GL.TEXTURE_BINDING_CUBE_MAP
1288
1290
  ]);
1289
1291
 
1290
1292
  // src/context/parameters/unified-parameter-api.ts
@@ -1363,7 +1365,7 @@ var GLState = class {
1363
1365
  constructor(gl, {
1364
1366
  copyState = false,
1365
1367
  // Copy cache from params (slow) or initialize from WebGL defaults (fast)
1366
- log: log10 = () => {
1368
+ log: log9 = () => {
1367
1369
  }
1368
1370
  // Logging function, called when gl parameter change calls are actually issued
1369
1371
  } = {}) {
@@ -1372,7 +1374,7 @@ var GLState = class {
1372
1374
  this.enable = true;
1373
1375
  this.gl = gl;
1374
1376
  this.cache = copyState ? getParameters(gl) : Object.assign({}, GL_PARAMETER_DEFAULTS);
1375
- this.log = log10;
1377
+ this.log = log9;
1376
1378
  this._updateCache = this._updateCache.bind(this);
1377
1379
  Object.seal(this);
1378
1380
  }
@@ -1676,27 +1678,27 @@ var TEXTURE_FORMATS = {
1676
1678
  // 'rgb8unorm-srgb-unsized': {gl: GL.SRGB_EXT, b: 4, c: 2, bpp: 4, gl1Ext: SRGB},
1677
1679
  // 'rgba8unorm-srgb-unsized': {gl: GL.SRGB_ALPHA_EXT, b: 4, c: 2, bpp: 4, gl1Ext: SRGB},
1678
1680
  // 8-bit formats
1679
- "r8unorm": { gl: import_constants5.default.R8, b: 1, c: 1 },
1681
+ "r8unorm": { gl: import_constants5.default.R8, b: 1, c: 1, renderbuffer: true },
1680
1682
  "r8snorm": { gl: import_constants5.default.R8_SNORM, b: 1, c: 1 },
1681
- "r8uint": { gl: import_constants5.default.R8UI, b: 1, c: 1 },
1682
- "r8sint": { gl: import_constants5.default.R8I, b: 1, c: 1 },
1683
+ "r8uint": { gl: import_constants5.default.R8UI, b: 1, c: 1, renderbuffer: true },
1684
+ "r8sint": { gl: import_constants5.default.R8I, b: 1, c: 1, renderbuffer: true },
1683
1685
  // 16-bit formats
1684
- "rg8unorm": { gl: import_constants5.default.RG8, b: 2, c: 2 },
1686
+ "rg8unorm": { gl: import_constants5.default.RG8, b: 2, c: 2, renderbuffer: true },
1685
1687
  "rg8snorm": { gl: import_constants5.default.RG8_SNORM, b: 2, c: 2 },
1686
- "rg8uint": { gl: import_constants5.default.RG8UI, b: 2, c: 2 },
1687
- "rg8sint": { gl: import_constants5.default.RG8I, b: 2, c: 2 },
1688
- "r16uint": { gl: import_constants5.default.R16UI, b: 2, c: 1 },
1689
- "r16sint": { gl: import_constants5.default.R16I, b: 2, c: 1 },
1690
- "r16float": { gl: import_constants5.default.R16F, b: 2, c: 1, render: "texture-renderable-float16-webgl", filter: "texture-filter-linear-float16-webgl" },
1691
- "r16unorm-webgl": { gl: import_constants5.default.R16_EXT, b: 2, c: 1, f: "texture-formats-norm16-webgl" },
1692
- "r16snorm-webgl": { gl: import_constants5.default.R16_SNORM_EXT, b: 2, c: 1, f: "texture-formats-norm16-webgl" },
1688
+ "rg8uint": { gl: import_constants5.default.RG8UI, b: 2, c: 2, renderbuffer: true },
1689
+ "rg8sint": { gl: import_constants5.default.RG8I, b: 2, c: 2, renderbuffer: true },
1690
+ "r16uint": { gl: import_constants5.default.R16UI, b: 2, c: 1, renderbuffer: true },
1691
+ "r16sint": { gl: import_constants5.default.R16I, b: 2, c: 1, renderbuffer: true },
1692
+ "r16float": { gl: import_constants5.default.R16F, b: 2, c: 1, render: "texture-renderable-float16-webgl", filter: "texture-filter-linear-float16-webgl", renderbuffer: true },
1693
+ "r16unorm-webgl": { gl: import_constants5.default.R16_EXT, b: 2, c: 1, f: "texture-formats-norm16-webgl", renderbuffer: true, x: EXT_TEXTURE_NORM16 },
1694
+ "r16snorm-webgl": { gl: import_constants5.default.R16_SNORM_EXT, b: 2, c: 1, f: "texture-formats-norm16-webgl", x: EXT_TEXTURE_NORM16 },
1693
1695
  // Packed 16-bit formats
1694
- "rgba4unorm-webgl": { gl: import_constants5.default.RGBA4, b: 2, c: 4, wgpu: false },
1695
- "rgb565unorm-webgl": { gl: import_constants5.default.RGB565, b: 2, c: 4, wgpu: false },
1696
- "rgb5a1unorm-webgl": { gl: import_constants5.default.RGB5_A1, b: 2, c: 4, wgpu: false },
1696
+ "rgba4unorm-webgl": { gl: import_constants5.default.RGBA4, b: 2, c: 4, wgpu: false, renderbuffer: true },
1697
+ "rgb565unorm-webgl": { gl: import_constants5.default.RGB565, b: 2, c: 4, wgpu: false, renderbuffer: true },
1698
+ "rgb5a1unorm-webgl": { gl: import_constants5.default.RGB5_A1, b: 2, c: 4, wgpu: false, renderbuffer: true },
1697
1699
  // 24-bit formats
1698
- "rbg8unorm-webgl": { gl: import_constants5.default.RGB8, b: 3, c: 3, wgpu: false },
1699
- "rbg8snorm-webgl": { gl: import_constants5.default.RGB8_SNORM, b: 3, c: 3, wgpu: false },
1700
+ "rgb8unorm-webgl": { gl: import_constants5.default.RGB8, b: 3, c: 3, wgpu: false },
1701
+ "rgb8snorm-webgl": { gl: import_constants5.default.RGB8_SNORM, b: 3, c: 3, wgpu: false },
1700
1702
  // 32-bit formats
1701
1703
  "rgba8unorm": { gl: import_constants5.default.RGBA8, gl1: import_constants5.default.RGBA, b: 4, c: 2, bpp: 4 },
1702
1704
  "rgba8unorm-srgb": { gl: import_constants5.default.SRGB8_ALPHA8, gl1: import_constants5.default.SRGB_ALPHA_EXT, b: 4, c: 4, gl1ext: EXT_SRGB, bpp: 4 },
@@ -1709,30 +1711,30 @@ var TEXTURE_FORMATS = {
1709
1711
  "rg16uint": { gl: import_constants5.default.RG16UI, b: 4, c: 1, bpp: 4 },
1710
1712
  "rg16sint": { gl: import_constants5.default.RG16I, b: 4, c: 2, bpp: 4 },
1711
1713
  // When using a WebGL 2 context and the EXT_color_buffer_float WebGL2 extension
1712
- "rg16float": { gl: import_constants5.default.RG16F, bpp: 4, b: 4, c: 2, render: "texture-renderable-float16-webgl", filter: "texture-filter-linear-float16-webgl" },
1713
- "rg16unorm-webgl": { gl: import_constants5.default.RG16_EXT, b: 2, c: 2, f: "texture-formats-norm16-webgl" },
1714
- "rg16snorm-webgl": { gl: import_constants5.default.RG16_SNORM_EXT, b: 2, c: 2, f: "texture-formats-norm16-webgl" },
1715
- "r32uint": { gl: import_constants5.default.R32UI, b: 4, c: 1, bpp: 4 },
1716
- "r32sint": { gl: import_constants5.default.R32I, b: 4, c: 1, bpp: 4 },
1714
+ "rg16float": { gl: import_constants5.default.RG16F, bpp: 4, b: 4, c: 2, render: "texture-renderable-float16-webgl", filter: "texture-filter-linear-float16-webgl", renderbuffer: true },
1715
+ "rg16unorm-webgl": { gl: import_constants5.default.RG16_EXT, b: 2, c: 2, f: "texture-formats-norm16-webgl", x: EXT_TEXTURE_NORM16 },
1716
+ "rg16snorm-webgl": { gl: import_constants5.default.RG16_SNORM_EXT, b: 2, c: 2, f: "texture-formats-norm16-webgl", x: EXT_TEXTURE_NORM16 },
1717
+ "r32uint": { gl: import_constants5.default.R32UI, b: 4, c: 1, bpp: 4, renderbuffer: true },
1718
+ "r32sint": { gl: import_constants5.default.R32I, b: 4, c: 1, bpp: 4, renderbuffer: true },
1717
1719
  "r32float": { gl: import_constants5.default.R32F, bpp: 4, b: 4, c: 1, render: "texture-renderable-float32-webgl", filter: "texture-filter-linear-float32-webgl" },
1718
1720
  // Packed 32-bit formats
1719
1721
  "rgb9e5ufloat": { gl: import_constants5.default.RGB9_E5, b: 4, c: 3, p: 1, render: "texture-renderable-float16-webgl", filter: "texture-filter-linear-float16-webgl" },
1720
- "rg11b10ufloat": { gl: import_constants5.default.R11F_G11F_B10F, b: 4, c: 3, p: 1, render: "texture-renderable-float32-webgl" },
1721
- "rgb10a2unorm": { gl: import_constants5.default.RGB10_A2, b: 4, c: 4, p: 1 },
1722
+ "rg11b10ufloat": { gl: import_constants5.default.R11F_G11F_B10F, b: 4, c: 3, p: 1, render: "texture-renderable-float32-webgl", renderbuffer: true },
1723
+ "rgb10a2unorm": { gl: import_constants5.default.RGB10_A2, b: 4, c: 4, p: 1, renderbuffer: true },
1722
1724
  // webgl2 only
1723
- "rgb10a2unorm-webgl": { b: 4, c: 4, gl: import_constants5.default.RGB10_A2UI, p: 1, wgpu: false, bpp: 4 },
1725
+ "rgb10a2unorm-webgl": { b: 4, c: 4, gl: import_constants5.default.RGB10_A2UI, p: 1, wgpu: false, bpp: 4, renderbuffer: true },
1724
1726
  // 48-bit formats
1725
- "rgb16unorm-webgl": { gl: import_constants5.default.RGB16_EXT, b: 2, c: 3, f: "texture-formats-norm16-webgl" },
1726
- "rgb16snorm-webgl": { gl: import_constants5.default.RGB16_SNORM_EXT, b: 2, c: 3, f: "texture-formats-norm16-webgl" },
1727
+ "rgb16unorm-webgl": { gl: import_constants5.default.RGB16_EXT, b: 2, c: 3, f: "texture-formats-norm16-webgl", x: EXT_TEXTURE_NORM16 },
1728
+ "rgb16snorm-webgl": { gl: import_constants5.default.RGB16_SNORM_EXT, b: 2, c: 3, f: "texture-formats-norm16-webgl", x: EXT_TEXTURE_NORM16 },
1727
1729
  // 64-bit formats
1728
- "rg32uint": { gl: import_constants5.default.RG32UI, b: 8, c: 2 },
1729
- "rg32sint": { gl: import_constants5.default.RG32I, b: 8, c: 2 },
1730
- "rg32float": { gl: import_constants5.default.RG32F, b: 8, c: 2, render: "texture-renderable-float32-webgl", filter: "texture-filter-linear-float32-webgl" },
1731
- "rgba16uint": { gl: import_constants5.default.RGBA16UI, b: 8, c: 4 },
1732
- "rgba16sint": { gl: import_constants5.default.RGBA16I, b: 8, c: 4 },
1730
+ "rg32uint": { gl: import_constants5.default.RG32UI, b: 8, c: 2, renderbuffer: true },
1731
+ "rg32sint": { gl: import_constants5.default.RG32I, b: 8, c: 2, renderbuffer: true },
1732
+ "rg32float": { gl: import_constants5.default.RG32F, b: 8, c: 2, render: "texture-renderable-float32-webgl", filter: "texture-filter-linear-float32-webgl", renderbuffer: true },
1733
+ "rgba16uint": { gl: import_constants5.default.RGBA16UI, b: 8, c: 4, renderbuffer: true },
1734
+ "rgba16sint": { gl: import_constants5.default.RGBA16I, b: 8, c: 4, renderbuffer: true },
1733
1735
  "rgba16float": { gl: import_constants5.default.RGBA16F, gl1: import_constants5.default.RGBA, b: 8, c: 4, render: "texture-renderable-float16-webgl", filter: "texture-filter-linear-float16-webgl" },
1734
- "rgba16unorm-webgl": { gl: import_constants5.default.RGBA16_EXT, b: 2, c: 4, f: "texture-formats-norm16-webgl" },
1735
- "rgba16snorm-webgl": { gl: import_constants5.default.RGBA16_SNORM_EXT, b: 2, c: 4, f: "texture-formats-norm16-webgl" },
1736
+ "rgba16unorm-webgl": { gl: import_constants5.default.RGBA16_EXT, b: 2, c: 4, f: "texture-formats-norm16-webgl", renderbuffer: true, x: EXT_TEXTURE_NORM16 },
1737
+ "rgba16snorm-webgl": { gl: import_constants5.default.RGBA16_SNORM_EXT, b: 2, c: 4, f: "texture-formats-norm16-webgl", x: EXT_TEXTURE_NORM16 },
1736
1738
  // 96-bit formats (deprecated!)
1737
1739
  "rgb32float-webgl": {
1738
1740
  gl: import_constants5.default.RGB32F,
@@ -1746,21 +1748,22 @@ var TEXTURE_FORMATS = {
1746
1748
  types: [import_constants5.default.FLOAT]
1747
1749
  },
1748
1750
  // 128-bit formats
1749
- "rgba32uint": { gl: import_constants5.default.RGBA32UI, b: 16, c: 4 },
1750
- "rgba32sint": { gl: import_constants5.default.RGBA32I, b: 16, c: 4 },
1751
- "rgba32float": { gl: import_constants5.default.RGBA32F, gl1: import_constants5.default.RGBA, b: 16, c: 4, render: "texture-renderable-float32-webgl", filter: "texture-filter-linear-float32-webgl" },
1751
+ "rgba32uint": { gl: import_constants5.default.RGBA32UI, b: 16, c: 4, renderbuffer: true },
1752
+ "rgba32sint": { gl: import_constants5.default.RGBA32I, b: 16, c: 4, renderbuffer: true },
1753
+ "rgba32float": { gl: import_constants5.default.RGBA32F, b: 16, c: 4, render: "texture-renderable-float32-webgl", filter: "texture-filter-linear-float32-webgl", renderbuffer: true },
1752
1754
  // Depth and stencil formats
1753
- "stencil8": { gl: import_constants5.default.STENCIL_INDEX8, b: 1, c: 1, attachment: import_constants5.default.STENCIL_ATTACHMENT },
1755
+ "stencil8": { gl: import_constants5.default.STENCIL_INDEX8, gl1: import_constants5.default.STENCIL_INDEX8, b: 1, c: 1, attachment: import_constants5.default.STENCIL_ATTACHMENT, renderbuffer: true },
1754
1756
  // 8 stencil bits
1755
- "depth16unorm": { gl: import_constants5.default.DEPTH_COMPONENT16, gl1: import_constants5.default.DEPTH_COMPONENT16, b: 2, c: 1, attachment: import_constants5.default.DEPTH_ATTACHMENT },
1757
+ "depth16unorm": { gl: import_constants5.default.DEPTH_COMPONENT16, gl1: import_constants5.default.DEPTH_COMPONENT16, b: 2, c: 1, attachment: import_constants5.default.DEPTH_ATTACHMENT, renderbuffer: true },
1756
1758
  // 16 depth bits
1757
1759
  "depth24plus": { gl: import_constants5.default.DEPTH_COMPONENT24, b: 3, c: 1, attachment: import_constants5.default.DEPTH_ATTACHMENT },
1758
- "depth32float": { gl: import_constants5.default.DEPTH_COMPONENT32F, b: 4, c: 1, attachment: import_constants5.default.DEPTH_ATTACHMENT },
1759
- "depth24plus-stencil8": { b: 4, gl: import_constants5.default.UNSIGNED_INT_24_8, gl1: import_constants5.default.DEPTH_STENCIL, c: 2, p: 1, attachment: import_constants5.default.DEPTH_STENCIL_ATTACHMENT },
1760
+ "depth32float": { gl: import_constants5.default.DEPTH_COMPONENT32F, b: 4, c: 1, attachment: import_constants5.default.DEPTH_ATTACHMENT, renderbuffer: true },
1761
+ // The depth component of the "depth24plus" and "depth24plus-stencil8" formats may be implemented as either a 24-bit depth value or a "depth32float" value.
1762
+ "depth24plus-stencil8": { gl: import_constants5.default.DEPTH_STENCIL, gl1: import_constants5.default.DEPTH_STENCIL, b: 4, c: 2, p: 1, attachment: import_constants5.default.DEPTH_STENCIL_ATTACHMENT, renderbuffer: true, depthTexture: true },
1760
1763
  // "depth24unorm-stencil8" feature
1761
- "depth24unorm-stencil8": { gl: import_constants5.default.DEPTH24_STENCIL8, b: 4, c: 2, p: 1, attachment: import_constants5.default.DEPTH_STENCIL_ATTACHMENT },
1764
+ "depth24unorm-stencil8": { gl: import_constants5.default.DEPTH24_STENCIL8, b: 4, c: 2, p: 1, attachment: import_constants5.default.DEPTH_STENCIL_ATTACHMENT, renderbuffer: true },
1762
1765
  // "depth32float-stencil8" feature
1763
- "depth32float-stencil8": { gl: import_constants5.default.DEPTH32F_STENCIL8, b: 5, c: 2, p: 1, attachment: import_constants5.default.DEPTH_STENCIL_ATTACHMENT },
1766
+ "depth32float-stencil8": { gl: import_constants5.default.DEPTH32F_STENCIL8, b: 5, c: 2, p: 1, attachment: import_constants5.default.DEPTH_STENCIL_ATTACHMENT, renderbuffer: true },
1764
1767
  // BC compressed formats: check device.features.has("texture-compression-bc");
1765
1768
  "bc1-rgb-unorm-webgl": { gl: import_constants5.default.COMPRESSED_RGB_S3TC_DXT1_EXT, x: X_S3TC, f: texture_compression_bc },
1766
1769
  "bc1-rgb-unorm-srgb-webgl": { gl: import_constants5.default.COMPRESSED_SRGB_S3TC_DXT1_EXT, x: X_S3TC_SRGB, f: texture_compression_bc },
@@ -1831,18 +1834,33 @@ var TEXTURE_FORMATS = {
1831
1834
  "atc-rgba-unorm-webgl": { gl: import_constants5.default.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL, f: texture_compression_atc_webgl },
1832
1835
  "atc-rgbai-unorm-webgl": { gl: import_constants5.default.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL, f: texture_compression_atc_webgl }
1833
1836
  };
1834
- function getTextureFormat(format) {
1835
- if (typeof format === "string") {
1836
- return format;
1837
- }
1838
- const entry = Object.entries(TEXTURE_FORMATS).find(([, entry2]) => entry2.gl === format || entry2.gl1 === format);
1839
- if (!entry) {
1840
- throw new Error(`Unknown texture format ${format}`);
1841
- }
1842
- return entry[0];
1843
- }
1837
+ var DATA_FORMAT_CHANNELS = {
1838
+ [import_constants5.default.RED]: 1,
1839
+ [import_constants5.default.RED_INTEGER]: 1,
1840
+ [import_constants5.default.RG]: 2,
1841
+ [import_constants5.default.RG_INTEGER]: 2,
1842
+ [import_constants5.default.RGB]: 3,
1843
+ [import_constants5.default.RGB_INTEGER]: 3,
1844
+ [import_constants5.default.RGBA]: 4,
1845
+ [import_constants5.default.RGBA_INTEGER]: 4,
1846
+ [import_constants5.default.DEPTH_COMPONENT]: 1,
1847
+ [import_constants5.default.DEPTH_STENCIL]: 1,
1848
+ [import_constants5.default.ALPHA]: 1,
1849
+ [import_constants5.default.LUMINANCE]: 1,
1850
+ [import_constants5.default.LUMINANCE_ALPHA]: 2
1851
+ };
1852
+ var TYPE_SIZES = {
1853
+ [import_constants5.default.FLOAT]: 4,
1854
+ [import_constants5.default.UNSIGNED_INT]: 4,
1855
+ [import_constants5.default.INT]: 4,
1856
+ [import_constants5.default.UNSIGNED_SHORT]: 2,
1857
+ [import_constants5.default.SHORT]: 2,
1858
+ [import_constants5.default.HALF_FLOAT]: 2,
1859
+ [import_constants5.default.BYTE]: 1,
1860
+ [import_constants5.default.UNSIGNED_BYTE]: 1
1861
+ };
1844
1862
  function isTextureFormatSupported(gl, formatOrGL) {
1845
- const format = getTextureFormat(formatOrGL);
1863
+ const format = convertGLToTextureFormat(formatOrGL);
1846
1864
  const info = TEXTURE_FORMATS[format];
1847
1865
  if (!info) {
1848
1866
  return false;
@@ -1856,8 +1874,32 @@ function isTextureFormatSupported(gl, formatOrGL) {
1856
1874
  }
1857
1875
  return true;
1858
1876
  }
1877
+ function isRenderbufferFormatSupported(gl, format) {
1878
+ var _a;
1879
+ return isTextureFormatSupported(gl, format) && ((_a = TEXTURE_FORMATS[format]) == null ? void 0 : _a.renderbuffer);
1880
+ }
1881
+ function convertGLToTextureFormat(format) {
1882
+ if (typeof format === "string") {
1883
+ return format;
1884
+ }
1885
+ const entry = Object.entries(TEXTURE_FORMATS).find(
1886
+ ([, entry2]) => entry2.gl === format || entry2.gl1 === format
1887
+ );
1888
+ if (!entry) {
1889
+ throw new Error(`Unknown texture format ${format}`);
1890
+ }
1891
+ return entry[0];
1892
+ }
1893
+ function convertTextureFormatToGL(format, isWebGL23) {
1894
+ const formatInfo = TEXTURE_FORMATS[format];
1895
+ const webglFormat = isWebGL23 ? formatInfo == null ? void 0 : formatInfo.gl : formatInfo == null ? void 0 : formatInfo.gl1;
1896
+ if (webglFormat === void 0) {
1897
+ throw new Error(`Unsupported texture format ${format}`);
1898
+ }
1899
+ return webglFormat;
1900
+ }
1859
1901
  function isTextureFormatFilterable(gl, formatOrGL) {
1860
- const format = getTextureFormat(formatOrGL);
1902
+ const format = convertGLToTextureFormat(formatOrGL);
1861
1903
  if (!isTextureFormatSupported(gl, format)) {
1862
1904
  return false;
1863
1905
  }
@@ -1878,7 +1920,7 @@ function isTextureFormatFilterable(gl, formatOrGL) {
1878
1920
  return true;
1879
1921
  }
1880
1922
  function isTextureFormatRenderable(gl, formatOrGL) {
1881
- const format = getTextureFormat(formatOrGL);
1923
+ const format = convertGLToTextureFormat(formatOrGL);
1882
1924
  if (!isTextureFormatSupported(gl, format)) {
1883
1925
  return false;
1884
1926
  }
@@ -1887,21 +1929,9 @@ function isTextureFormatRenderable(gl, formatOrGL) {
1887
1929
  }
1888
1930
  return true;
1889
1931
  }
1890
- function getWebGLTextureFormat(gl, formatOrGL) {
1891
- const format = getTextureFormat(formatOrGL);
1892
- const formatInfo = TEXTURE_FORMATS[format];
1893
- const webglFormat = isWebGL2(gl) ? formatInfo == null ? void 0 : formatInfo.gl : formatInfo == null ? void 0 : formatInfo.gl1;
1894
- if (typeof format === "number") {
1895
- return webglFormat || format;
1896
- }
1897
- if (webglFormat === void 0) {
1898
- throw new Error(`Unsupported texture format ${format}`);
1899
- }
1900
- return webglFormat;
1901
- }
1902
- function getWebGLTextureParameters(gl, formatOrGL) {
1903
- const format = getTextureFormat(formatOrGL);
1904
- const webglFormat = getWebGLTextureFormat(gl, format);
1932
+ function getWebGLTextureParameters(formatOrGL, isWebGL23) {
1933
+ const format = convertGLToTextureFormat(formatOrGL);
1934
+ const webglFormat = convertTextureFormatToGL(format, isWebGL23);
1905
1935
  const decoded = (0, import_api5.decodeTextureFormat)(format);
1906
1936
  return {
1907
1937
  format: webglFormat,
@@ -1916,17 +1946,12 @@ function getWebGLTextureParameters(gl, formatOrGL) {
1916
1946
  compressed: decoded.compressed
1917
1947
  };
1918
1948
  }
1919
- function getWebGLDepthStencilAttachment(formatOrGL) {
1920
- const format = getTextureFormat(formatOrGL);
1921
- if (typeof format === "number") {
1922
- throw new Error("unsupported depth stencil format");
1923
- }
1949
+ function getDepthStencilAttachmentWebGL(format) {
1924
1950
  const info = TEXTURE_FORMATS[format];
1925
- const attachment = info.attachment;
1926
- if (!attachment) {
1927
- throw new Error("not a depth stencil format");
1951
+ if (!(info == null ? void 0 : info.attachment)) {
1952
+ throw new Error(`${format} is not a depth stencil format`);
1928
1953
  }
1929
- return attachment;
1954
+ return info.attachment;
1930
1955
  }
1931
1956
  function _checkFloat32ColorAttachment(gl, internalFormat = gl.RGBA, srcFormat = import_constants5.default.RGBA, srcType = import_constants5.default.UNSIGNED_BYTE) {
1932
1957
  let texture = null;
@@ -1961,34 +1986,9 @@ function _checkFloat32ColorAttachment(gl, internalFormat = gl.RGBA, srcFormat =
1961
1986
  gl.deleteFramebuffer(framebuffer);
1962
1987
  }
1963
1988
  }
1964
- var DATA_FORMAT_CHANNELS = {
1965
- [import_constants5.default.RED]: 1,
1966
- [import_constants5.default.RED_INTEGER]: 1,
1967
- [import_constants5.default.RG]: 2,
1968
- [import_constants5.default.RG_INTEGER]: 2,
1969
- [import_constants5.default.RGB]: 3,
1970
- [import_constants5.default.RGB_INTEGER]: 3,
1971
- [import_constants5.default.RGBA]: 4,
1972
- [import_constants5.default.RGBA_INTEGER]: 4,
1973
- [import_constants5.default.DEPTH_COMPONENT]: 1,
1974
- [import_constants5.default.DEPTH_STENCIL]: 1,
1975
- [import_constants5.default.ALPHA]: 1,
1976
- [import_constants5.default.LUMINANCE]: 1,
1977
- [import_constants5.default.LUMINANCE_ALPHA]: 2
1978
- };
1979
- var TYPE_SIZES = {
1980
- [import_constants5.default.FLOAT]: 4,
1981
- [import_constants5.default.UNSIGNED_INT]: 4,
1982
- [import_constants5.default.INT]: 4,
1983
- [import_constants5.default.UNSIGNED_SHORT]: 2,
1984
- [import_constants5.default.SHORT]: 2,
1985
- [import_constants5.default.HALF_FLOAT]: 2,
1986
- [import_constants5.default.BYTE]: 1,
1987
- [import_constants5.default.UNSIGNED_BYTE]: 1
1988
- };
1989
- function getTextureFormatBytesPerPixel(gl, formatOrGL) {
1990
- const format = getTextureFormat(formatOrGL);
1991
- const params = getWebGLTextureParameters(gl, format);
1989
+ function getTextureFormatBytesPerPixel(formatOrGL, isWebGL23) {
1990
+ const format = convertGLToTextureFormat(formatOrGL);
1991
+ const params = getWebGLTextureParameters(format, isWebGL23);
1992
1992
  const channels = DATA_FORMAT_CHANNELS[params.dataFormat] || 4;
1993
1993
  const channelSize = TYPE_SIZES[params.type] || 1;
1994
1994
  return channels * channelSize;
@@ -2279,12 +2279,12 @@ var import_api15 = require("@luma.gl/api");
2279
2279
 
2280
2280
  // src/adapter/resources/webgl-framebuffer.ts
2281
2281
  var import_api14 = require("@luma.gl/api");
2282
- var import_constants14 = __toESM(require("@luma.gl/constants"), 1);
2282
+ var import_constants13 = __toESM(require("@luma.gl/constants"), 1);
2283
2283
 
2284
2284
  // src/adapter/resources/webgl-texture.ts
2285
2285
  var import_api9 = require("@luma.gl/api");
2286
2286
  var import_api10 = require("@luma.gl/api");
2287
- var import_constants11 = __toESM(require("@luma.gl/constants"), 1);
2287
+ var import_constants11 = require("@luma.gl/constants");
2288
2288
 
2289
2289
  // src/context/state-tracker/with-parameters.ts
2290
2290
  function withParameters(device, parameters, func) {
@@ -2317,7 +2317,7 @@ function isObjectEmpty2(object) {
2317
2317
  }
2318
2318
 
2319
2319
  // src/adapter/converters/sampler-parameters.ts
2320
- var import_constants8 = __toESM(require("@luma.gl/constants"), 1);
2320
+ var import_constants8 = require("@luma.gl/constants");
2321
2321
 
2322
2322
  // src/adapter/converters/device-parameters.ts
2323
2323
  var import_api6 = require("@luma.gl/api");
@@ -2365,10 +2365,12 @@ function setDeviceParameters(device, parameters) {
2365
2365
  }
2366
2366
  }
2367
2367
  if (parameters.frontFace) {
2368
- gl.frontFace(map("frontFace", parameters.frontFace, {
2369
- ccw: import_constants7.default.CCW,
2370
- cw: import_constants7.default.CW
2371
- }));
2368
+ gl.frontFace(
2369
+ map("frontFace", parameters.frontFace, {
2370
+ ccw: import_constants7.default.CCW,
2371
+ cw: import_constants7.default.CW
2372
+ })
2373
+ );
2372
2374
  }
2373
2375
  if (parameters.depthBias !== void 0) {
2374
2376
  gl.polygonOffset(parameters.depthBias, parameters.depthBiasSlopeScale || 0);
@@ -2398,29 +2400,32 @@ function setDeviceParameters(device, parameters) {
2398
2400
  if (parameters.stencilPassOperation && parameters.stencilFailOperation && parameters.stencilDepthFailOperation) {
2399
2401
  const dppass = convertStencilOperation("stencilPassOperation", parameters.stencilPassOperation);
2400
2402
  const sfail = convertStencilOperation("stencilFailOperation", parameters.stencilFailOperation);
2401
- const dpfail = convertStencilOperation("stencilDepthFailOperation", parameters.stencilDepthFailOperation);
2403
+ const dpfail = convertStencilOperation(
2404
+ "stencilDepthFailOperation",
2405
+ parameters.stencilDepthFailOperation
2406
+ );
2402
2407
  gl.stencilOpSeparate(import_constants7.default.FRONT, sfail, dpfail, dppass);
2403
2408
  gl.stencilOpSeparate(import_constants7.default.BACK, sfail, dpfail, dppass);
2404
2409
  }
2405
2410
  }
2406
2411
  function convertCompareFunction(parameter, value) {
2407
2412
  return map(parameter, value, {
2408
- "never": import_constants7.default.NEVER,
2409
- "less": import_constants7.default.LESS,
2410
- "equal": import_constants7.default.EQUAL,
2413
+ never: import_constants7.default.NEVER,
2414
+ less: import_constants7.default.LESS,
2415
+ equal: import_constants7.default.EQUAL,
2411
2416
  "less-equal": import_constants7.default.LEQUAL,
2412
- "greater": import_constants7.default.GREATER,
2417
+ greater: import_constants7.default.GREATER,
2413
2418
  "not-equal": import_constants7.default.NOTEQUAL,
2414
2419
  "greater-equal": import_constants7.default.GEQUAL,
2415
- "always": import_constants7.default.ALWAYS
2420
+ always: import_constants7.default.ALWAYS
2416
2421
  });
2417
2422
  }
2418
2423
  function convertStencilOperation(parameter, value) {
2419
2424
  return map(parameter, value, {
2420
- "keep": import_constants7.default.KEEP,
2421
- "zero": import_constants7.default.ZERO,
2422
- "replace": import_constants7.default.REPLACE,
2423
- "invert": import_constants7.default.INVERT,
2425
+ keep: import_constants7.default.KEEP,
2426
+ zero: import_constants7.default.ZERO,
2427
+ replace: import_constants7.default.REPLACE,
2428
+ invert: import_constants7.default.INVERT,
2424
2429
  "increment-clamp": import_constants7.default.INCR,
2425
2430
  "decrement-clamp": import_constants7.default.DECR,
2426
2431
  "increment-wrap": import_constants7.default.INCR_WRAP,
@@ -2444,53 +2449,53 @@ function mapBoolean(parameter, value) {
2444
2449
  function convertSamplerParametersToWebGL(props) {
2445
2450
  const params = {};
2446
2451
  if (props.addressModeU) {
2447
- params[import_constants8.default.TEXTURE_WRAP_S] = convertAddressMode(props.addressModeU);
2452
+ params[import_constants8.GL.TEXTURE_WRAP_S] = convertAddressMode(props.addressModeU);
2448
2453
  }
2449
2454
  if (props.addressModeV) {
2450
- params[import_constants8.default.TEXTURE_WRAP_T] = convertAddressMode(props.addressModeV);
2455
+ params[import_constants8.GL.TEXTURE_WRAP_T] = convertAddressMode(props.addressModeV);
2451
2456
  }
2452
2457
  if (props.addressModeW) {
2453
- params[import_constants8.default.TEXTURE_WRAP_R] = convertAddressMode(props.addressModeW);
2458
+ params[import_constants8.GL.TEXTURE_WRAP_R] = convertAddressMode(props.addressModeW);
2454
2459
  }
2455
2460
  if (props.magFilter) {
2456
- params[import_constants8.default.TEXTURE_MAG_FILTER] = convertMaxFilterMode(props.magFilter);
2461
+ params[import_constants8.GL.TEXTURE_MAG_FILTER] = convertMaxFilterMode(props.magFilter);
2457
2462
  }
2458
2463
  if (props.minFilter || props.mipmapFilter) {
2459
- params[import_constants8.default.TEXTURE_MIN_FILTER] = convertMinFilterMode(props.minFilter || "linear", props.mipmapFilter);
2464
+ params[import_constants8.GL.TEXTURE_MIN_FILTER] = convertMinFilterMode(props.minFilter || "linear", props.mipmapFilter);
2460
2465
  }
2461
2466
  if (props.lodMinClamp !== void 0) {
2462
- params[import_constants8.default.TEXTURE_MIN_LOD] = props.lodMinClamp;
2467
+ params[import_constants8.GL.TEXTURE_MIN_LOD] = props.lodMinClamp;
2463
2468
  }
2464
2469
  if (props.lodMaxClamp !== void 0) {
2465
- params[import_constants8.default.TEXTURE_MAX_LOD] = props.lodMaxClamp;
2470
+ params[import_constants8.GL.TEXTURE_MAX_LOD] = props.lodMaxClamp;
2466
2471
  }
2467
2472
  if (props.type === "comparison-sampler") {
2468
- params[import_constants8.default.TEXTURE_COMPARE_MODE] = import_constants8.default.COMPARE_REF_TO_TEXTURE;
2473
+ params[import_constants8.GL.TEXTURE_COMPARE_MODE] = import_constants8.GL.COMPARE_REF_TO_TEXTURE;
2469
2474
  }
2470
2475
  if (props.compare) {
2471
- params[import_constants8.default.TEXTURE_COMPARE_FUNC] = convertCompareFunction("compare", props.compare);
2476
+ params[import_constants8.GL.TEXTURE_COMPARE_FUNC] = convertCompareFunction("compare", props.compare);
2472
2477
  }
2473
2478
  if (props.maxAnisotropy) {
2474
- params[import_constants8.default.TEXTURE_MAX_ANISOTROPY_EXT] = props.maxAnisotropy;
2479
+ params[import_constants8.GL.TEXTURE_MAX_ANISOTROPY_EXT] = props.maxAnisotropy;
2475
2480
  }
2476
2481
  return params;
2477
2482
  }
2478
2483
  function convertAddressMode(addressMode) {
2479
2484
  switch (addressMode) {
2480
2485
  case "clamp-to-edge":
2481
- return import_constants8.default.CLAMP_TO_EDGE;
2486
+ return import_constants8.GL.CLAMP_TO_EDGE;
2482
2487
  case "repeat":
2483
- return import_constants8.default.REPEAT;
2488
+ return import_constants8.GL.REPEAT;
2484
2489
  case "mirror-repeat":
2485
- return import_constants8.default.MIRRORED_REPEAT;
2490
+ return import_constants8.GL.MIRRORED_REPEAT;
2486
2491
  }
2487
2492
  }
2488
2493
  function convertMaxFilterMode(maxFilter) {
2489
2494
  switch (maxFilter) {
2490
2495
  case "nearest":
2491
- return import_constants8.default.NEAREST;
2496
+ return import_constants8.GL.NEAREST;
2492
2497
  case "linear":
2493
- return import_constants8.default.LINEAR;
2498
+ return import_constants8.GL.LINEAR;
2494
2499
  }
2495
2500
  }
2496
2501
  function convertMinFilterMode(minFilter, mipmapFilter) {
@@ -2499,18 +2504,18 @@ function convertMinFilterMode(minFilter, mipmapFilter) {
2499
2504
  }
2500
2505
  switch (minFilter) {
2501
2506
  case "nearest":
2502
- return mipmapFilter === "nearest" ? import_constants8.default.NEAREST_MIPMAP_NEAREST : import_constants8.default.NEAREST_MIPMAP_LINEAR;
2507
+ return mipmapFilter === "nearest" ? import_constants8.GL.NEAREST_MIPMAP_NEAREST : import_constants8.GL.NEAREST_MIPMAP_LINEAR;
2503
2508
  case "linear":
2504
- return mipmapFilter === "nearest" ? import_constants8.default.LINEAR_MIPMAP_NEAREST : import_constants8.default.LINEAR_MIPMAP_LINEAR;
2509
+ return mipmapFilter === "nearest" ? import_constants8.GL.LINEAR_MIPMAP_NEAREST : import_constants8.GL.LINEAR_MIPMAP_LINEAR;
2505
2510
  }
2506
2511
  }
2507
2512
  function updateSamplerParametersForNPOT(parameters) {
2508
2513
  const newParameters = __spreadValues({}, parameters);
2509
- if (parameters[import_constants8.default.TEXTURE_MIN_FILTER] !== import_constants8.default.NEAREST) {
2510
- newParameters[import_constants8.default.TEXTURE_MIN_FILTER] = import_constants8.default.LINEAR;
2514
+ if (parameters[import_constants8.GL.TEXTURE_MIN_FILTER] !== import_constants8.GL.NEAREST) {
2515
+ newParameters[import_constants8.GL.TEXTURE_MIN_FILTER] = import_constants8.GL.LINEAR;
2511
2516
  }
2512
- newParameters[import_constants8.default.TEXTURE_WRAP_S] = import_constants8.default.CLAMP_TO_EDGE;
2513
- newParameters[import_constants8.default.TEXTURE_WRAP_T] = import_constants8.default.CLAMP_TO_EDGE;
2517
+ newParameters[import_constants8.GL.TEXTURE_WRAP_S] = import_constants8.GL.CLAMP_TO_EDGE;
2518
+ newParameters[import_constants8.GL.TEXTURE_WRAP_T] = import_constants8.GL.CLAMP_TO_EDGE;
2514
2519
  return newParameters;
2515
2520
  }
2516
2521
 
@@ -2575,16 +2580,17 @@ var WEBGLBuffer = class extends import_api7.Buffer {
2575
2580
  this.trackDeallocatedMemory();
2576
2581
  this.gl.deleteBuffer(this.handle);
2577
2582
  this.destroyed = true;
2583
+ this.handle = null;
2578
2584
  }
2579
2585
  }
2580
2586
  write(data, byteOffset = 0) {
2581
2587
  const srcOffset = 0;
2582
- const byteLength = data.byteLength;
2588
+ const byteLength = void 0;
2583
2589
  const target = this.device.isWebGL2 ? import_constants9.default.COPY_WRITE_BUFFER : this.target;
2584
2590
  this.gl.bindBuffer(target, this.handle);
2585
2591
  if (srcOffset !== 0 || byteLength !== void 0) {
2586
2592
  this.device.assertWebGL2();
2587
- this.gl.bufferSubData(this.target, byteOffset, data, srcOffset, byteLength);
2593
+ this.gl2.bufferSubData(target, byteOffset, data, srcOffset, byteLength);
2588
2594
  } else {
2589
2595
  this.gl.bufferSubData(target, byteOffset, data);
2590
2596
  }
@@ -2640,7 +2646,7 @@ function getWebGLUsage(usage) {
2640
2646
 
2641
2647
  // src/adapter/resources/webgl-sampler.ts
2642
2648
  var import_api8 = require("@luma.gl/api");
2643
- var import_constants10 = __toESM(require("@luma.gl/constants"), 1);
2649
+ var import_constants10 = require("@luma.gl/constants");
2644
2650
  var WEBGLSampler = class extends import_api8.Sampler {
2645
2651
  constructor(device, props) {
2646
2652
  super(device, props);
@@ -2665,8 +2671,8 @@ var WEBGLSampler = class extends import_api8.Sampler {
2665
2671
  for (const [pname, value] of Object.entries(parameters)) {
2666
2672
  const param = Number(pname);
2667
2673
  switch (param) {
2668
- case import_constants10.default.TEXTURE_MIN_LOD:
2669
- case import_constants10.default.TEXTURE_MAX_LOD:
2674
+ case import_constants10.GL.TEXTURE_MIN_LOD:
2675
+ case import_constants10.GL.TEXTURE_MAX_LOD:
2670
2676
  this.device.gl2.samplerParameterf(this.handle, param, value);
2671
2677
  break;
2672
2678
  default:
@@ -2678,20 +2684,28 @@ var WEBGLSampler = class extends import_api8.Sampler {
2678
2684
  };
2679
2685
 
2680
2686
  // src/adapter/resources/webgl-texture.ts
2687
+ var DEFAULT_WEBGL_TEXTURE_PROPS = {
2688
+ // deprecated
2689
+ parameters: {},
2690
+ pixelStore: {},
2691
+ pixels: null,
2692
+ border: 0,
2693
+ dataFormat: void 0,
2694
+ textureUnit: void 0,
2695
+ target: void 0
2696
+ };
2681
2697
  var _WEBGLTexture = class extends import_api10.Texture {
2682
2698
  constructor(device, props) {
2683
2699
  var _a;
2684
- super(device, __spreadValues({ format: import_constants11.default.RGBA }, props));
2685
- this.width = void 0;
2686
- this.height = void 0;
2687
- this.depth = void 0;
2688
- this.format = void 0;
2700
+ super(device, __spreadValues(__spreadProps(__spreadValues({}, DEFAULT_WEBGL_TEXTURE_PROPS), { format: "rgba8unorm" }), props));
2701
+ /** Sampler object (currently unused) */
2702
+ this.sampler = void 0;
2703
+ // data;
2704
+ this.glFormat = void 0;
2689
2705
  this.type = void 0;
2690
2706
  this.dataFormat = void 0;
2691
2707
  this.mipmaps = void 0;
2692
2708
  this.textureUnit = void 0;
2693
- /** Sampler object (currently unused) */
2694
- this.sampler = void 0;
2695
2709
  /**
2696
2710
  * Program.draw() checks the loaded flag of all textures to avoid
2697
2711
  * Textures that are still loading from promises
@@ -2703,6 +2717,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
2703
2717
  this.gl2 = this.device.gl2;
2704
2718
  this.handle = this.props.handle || this.gl.createTexture();
2705
2719
  this.device.setSpectorMetadata(this.handle, __spreadProps(__spreadValues({}, this.props), { data: typeof this.props.data }));
2720
+ this.glFormat = import_constants11.GL.RGBA;
2706
2721
  this.target = getWebGLTextureTarget(this.props);
2707
2722
  this.loaded = false;
2708
2723
  if (typeof ((_a = this.props) == null ? void 0 : _a.data) === "string") {
@@ -2748,7 +2763,6 @@ var _WEBGLTexture = class extends import_api10.Texture {
2748
2763
  const { parameters = {} } = props;
2749
2764
  const {
2750
2765
  pixels = null,
2751
- recreate = false,
2752
2766
  pixelStore = {},
2753
2767
  textureUnit = void 0
2754
2768
  } = props;
@@ -2757,6 +2771,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
2757
2771
  }
2758
2772
  let { width, height, dataFormat, type, compressed = false, mipmaps = true } = props;
2759
2773
  const { depth = 0 } = props;
2774
+ const glFormat = convertTextureFormatToGL(props.format, this.device.isWebGL2);
2760
2775
  ({ width, height, compressed, dataFormat, type } = this._deduceParameters({
2761
2776
  format: props.format,
2762
2777
  type,
@@ -2766,16 +2781,14 @@ var _WEBGLTexture = class extends import_api10.Texture {
2766
2781
  width,
2767
2782
  height
2768
2783
  }));
2769
- const format = getWebGLTextureFormat(this.gl, props.format);
2770
2784
  this.width = width;
2771
2785
  this.height = height;
2772
- this.depth = depth;
2773
- this.format = format;
2786
+ this.glFormat = glFormat;
2774
2787
  this.type = type;
2775
2788
  this.dataFormat = dataFormat;
2776
2789
  this.textureUnit = textureUnit;
2777
2790
  if (Number.isFinite(this.textureUnit)) {
2778
- this.gl.activeTexture(import_constants11.default.TEXTURE0 + this.textureUnit);
2791
+ this.gl.activeTexture(import_constants11.GL.TEXTURE0 + this.textureUnit);
2779
2792
  this.gl.bindTexture(this.target, this.handle);
2780
2793
  }
2781
2794
  if (mipmaps && this.device.isWebGL1 && isNPOT(this.width, this.height)) {
@@ -2788,7 +2801,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
2788
2801
  width,
2789
2802
  height,
2790
2803
  depth,
2791
- format,
2804
+ format: glFormat,
2792
2805
  type,
2793
2806
  dataFormat,
2794
2807
  // @ts-expect-error
@@ -2800,9 +2813,6 @@ var _WEBGLTexture = class extends import_api10.Texture {
2800
2813
  if (mipmaps) {
2801
2814
  this.generateMipmap();
2802
2815
  }
2803
- if (recreate) {
2804
- this.data = data;
2805
- }
2806
2816
  if (isVideo) {
2807
2817
  this._video = {
2808
2818
  video: data,
@@ -2909,7 +2919,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
2909
2919
  */
2910
2920
  // eslint-disable-next-line max-statements, complexity
2911
2921
  setImageData(options) {
2912
- if (this.props.dimension === "3d") {
2922
+ if (this.props.dimension === "3d" || this.props.dimension === "2d-array") {
2913
2923
  return this.setImageData3D(options);
2914
2924
  }
2915
2925
  this.trackDeallocatedMemory("Texture");
@@ -2917,7 +2927,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
2917
2927
  target = this.target,
2918
2928
  pixels = null,
2919
2929
  level = 0,
2920
- format = this.format,
2930
+ glFormat = this.glFormat,
2921
2931
  offset = 0,
2922
2932
  parameters = {}
2923
2933
  } = options;
@@ -2949,13 +2959,13 @@ var _WEBGLTexture = class extends import_api10.Texture {
2949
2959
  withParameters(this.gl, parameters, () => {
2950
2960
  switch (dataType) {
2951
2961
  case "null":
2952
- gl.texImage2D(target, level, format, width, height, 0, dataFormat, type, data);
2962
+ gl.texImage2D(target, level, glFormat, width, height, 0, dataFormat, type, data);
2953
2963
  break;
2954
2964
  case "typed-array":
2955
2965
  gl.texImage2D(
2956
2966
  target,
2957
2967
  level,
2958
- format,
2968
+ glFormat,
2959
2969
  width,
2960
2970
  height,
2961
2971
  0,
@@ -2969,11 +2979,11 @@ var _WEBGLTexture = class extends import_api10.Texture {
2969
2979
  break;
2970
2980
  case "buffer":
2971
2981
  gl2 = this.device.assertWebGL2();
2972
- gl2.bindBuffer(import_constants11.default.PIXEL_UNPACK_BUFFER, data.handle || data);
2982
+ gl2.bindBuffer(import_constants11.GL.PIXEL_UNPACK_BUFFER, data.handle || data);
2973
2983
  gl2.texImage2D(
2974
2984
  target,
2975
2985
  level,
2976
- format,
2986
+ glFormat,
2977
2987
  width,
2978
2988
  height,
2979
2989
  0,
@@ -2981,14 +2991,14 @@ var _WEBGLTexture = class extends import_api10.Texture {
2981
2991
  type,
2982
2992
  offset
2983
2993
  );
2984
- gl2.bindBuffer(import_constants11.default.PIXEL_UNPACK_BUFFER, null);
2994
+ gl2.bindBuffer(import_constants11.GL.PIXEL_UNPACK_BUFFER, null);
2985
2995
  break;
2986
2996
  case "browser-object":
2987
2997
  if (this.device.isWebGL2) {
2988
2998
  gl.texImage2D(
2989
2999
  target,
2990
3000
  level,
2991
- format,
3001
+ glFormat,
2992
3002
  width,
2993
3003
  height,
2994
3004
  0,
@@ -2997,7 +3007,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
2997
3007
  data
2998
3008
  );
2999
3009
  } else {
3000
- gl.texImage2D(target, level, format, dataFormat, type, data);
3010
+ gl.texImage2D(target, level, glFormat, dataFormat, type, data);
3001
3011
  }
3002
3012
  break;
3003
3013
  case "compressed":
@@ -3020,7 +3030,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
3020
3030
  if (data && data.byteLength) {
3021
3031
  this.trackAllocatedMemory(data.byteLength, "Texture");
3022
3032
  } else {
3023
- const bytesPerPixel = getTextureFormatBytesPerPixel(this.gl, this.props.format);
3033
+ const bytesPerPixel = getTextureFormatBytesPerPixel(this.props.format, this.device.isWebGL2);
3024
3034
  this.trackAllocatedMemory(this.width * this.height * bytesPerPixel, "Texture");
3025
3035
  }
3026
3036
  this.loaded = true;
@@ -3040,7 +3050,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
3040
3050
  width = this.width,
3041
3051
  height = this.height,
3042
3052
  level = 0,
3043
- format = this.format,
3053
+ glFormat = this.glFormat,
3044
3054
  type = this.type,
3045
3055
  dataFormat = this.dataFormat,
3046
3056
  compressed = false,
@@ -3072,16 +3082,16 @@ var _WEBGLTexture = class extends import_api10.Texture {
3072
3082
  this.gl.bindTexture(this.target, this.handle);
3073
3083
  withParameters(this.gl, parameters, () => {
3074
3084
  if (compressed) {
3075
- this.gl.compressedTexSubImage2D(target, level, x, y, width, height, format, data);
3085
+ this.gl.compressedTexSubImage2D(target, level, x, y, width, height, glFormat, data);
3076
3086
  } else if (data === null) {
3077
3087
  this.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, null);
3078
3088
  } else if (ArrayBuffer.isView(data)) {
3079
3089
  this.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, data, offset);
3080
3090
  } else if (typeof WebGLBuffer !== "undefined" && data instanceof WebGLBuffer) {
3081
3091
  const gl2 = this.device.assertWebGL2();
3082
- gl2.bindBuffer(import_constants11.default.PIXEL_UNPACK_BUFFER, data);
3092
+ gl2.bindBuffer(import_constants11.GL.PIXEL_UNPACK_BUFFER, data);
3083
3093
  gl2.texSubImage2D(target, level, x, y, width, height, dataFormat, type, offset);
3084
- gl2.bindBuffer(import_constants11.default.PIXEL_UNPACK_BUFFER, null);
3094
+ gl2.bindBuffer(import_constants11.GL.PIXEL_UNPACK_BUFFER, null);
3085
3095
  } else if (this.device.isWebGL2) {
3086
3096
  const gl2 = this.device.assertWebGL2();
3087
3097
  gl2.texSubImage2D(target, level, x, y, width, height, dataFormat, type, data);
@@ -3106,7 +3116,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
3106
3116
  return null;
3107
3117
  }
3108
3118
  getActiveUnit() {
3109
- return this.gl.getParameter(import_constants11.default.ACTIVE_TEXTURE) - import_constants11.default.TEXTURE0;
3119
+ return this.gl.getParameter(import_constants11.GL.ACTIVE_TEXTURE) - import_constants11.GL.TEXTURE0;
3110
3120
  }
3111
3121
  bind(textureUnit = this.textureUnit) {
3112
3122
  const { gl } = this;
@@ -3149,7 +3159,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
3149
3159
  _deduceParameters(opts) {
3150
3160
  const { format, data } = opts;
3151
3161
  let { width, height, dataFormat, type, compressed } = opts;
3152
- const parameters = getWebGLTextureParameters(this.gl, format);
3162
+ const parameters = getWebGLTextureParameters(format, this.device.isWebGL2);
3153
3163
  dataFormat = dataFormat || parameters.dataFormat;
3154
3164
  type = type || parameters.type;
3155
3165
  compressed = compressed || parameters.compressed;
@@ -3190,7 +3200,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
3190
3200
  setCubeMapImageData(options) {
3191
3201
  return __async(this, null, function* () {
3192
3202
  const { gl } = this;
3193
- const { width, height, pixels, data, format = import_constants11.default.RGBA, type = import_constants11.default.UNSIGNED_BYTE } = options;
3203
+ const { width, height, pixels, data, format = import_constants11.GL.RGBA, type = import_constants11.GL.UNSIGNED_BYTE } = options;
3194
3204
  const imageDataMap = pixels || data;
3195
3205
  const resolvedFaces = yield Promise.all(
3196
3206
  _WEBGLTexture.FACES.map((face) => {
@@ -3222,8 +3232,8 @@ var _WEBGLTexture = class extends import_api10.Texture {
3222
3232
  height,
3223
3233
  pixels,
3224
3234
  data,
3225
- format = import_constants11.default.RGBA,
3226
- type = import_constants11.default.UNSIGNED_BYTE
3235
+ format = import_constants11.GL.RGBA,
3236
+ type = import_constants11.GL.UNSIGNED_BYTE
3227
3237
  // generateMipmap = false // TODO
3228
3238
  } = options;
3229
3239
  const { gl } = this;
@@ -3263,7 +3273,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
3263
3273
  } = options;
3264
3274
  this.trackDeallocatedMemory("Texture");
3265
3275
  this.gl.bindTexture(this.target, this.handle);
3266
- const webglTextureFormat = getWebGLTextureParameters(this.gl, format);
3276
+ const webglTextureFormat = getWebGLTextureParameters(format, this.device.isWebGL2);
3267
3277
  withParameters(this.gl, parameters, () => {
3268
3278
  if (ArrayBuffer.isView(data)) {
3269
3279
  this.gl.texImage3D(
@@ -3281,7 +3291,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
3281
3291
  );
3282
3292
  }
3283
3293
  if (data instanceof WEBGLBuffer) {
3284
- this.gl.bindBuffer(import_constants11.default.PIXEL_UNPACK_BUFFER, data.handle);
3294
+ this.gl.bindBuffer(import_constants11.GL.PIXEL_UNPACK_BUFFER, data.handle);
3285
3295
  this.gl.texImage3D(
3286
3296
  this.target,
3287
3297
  level,
@@ -3299,7 +3309,7 @@ var _WEBGLTexture = class extends import_api10.Texture {
3299
3309
  if (data && data.byteLength) {
3300
3310
  this.trackAllocatedMemory(data.byteLength, "Texture");
3301
3311
  } else {
3302
- const bytesPerPixel = getTextureFormatBytesPerPixel(this.gl, this.props.format);
3312
+ const bytesPerPixel = getTextureFormatBytesPerPixel(this.props.format, this.device.isWebGL2);
3303
3313
  this.trackAllocatedMemory(this.width * this.height * this.depth * bytesPerPixel, "Texture");
3304
3314
  }
3305
3315
  this.loaded = true;
@@ -3323,8 +3333,8 @@ var _WEBGLTexture = class extends import_api10.Texture {
3323
3333
  const param = Number(pname);
3324
3334
  const value = pvalue;
3325
3335
  switch (param) {
3326
- case import_constants11.default.TEXTURE_MIN_LOD:
3327
- case import_constants11.default.TEXTURE_MAX_LOD:
3336
+ case import_constants11.GL.TEXTURE_MIN_LOD:
3337
+ case import_constants11.GL.TEXTURE_MAX_LOD:
3328
3338
  this.gl.texParameterf(this.target, param, value);
3329
3339
  break;
3330
3340
  default:
@@ -3340,14 +3350,14 @@ var _WEBGLTexture = class extends import_api10.Texture {
3340
3350
  const npot = this.device.isWebGL1 && isNPOT(this.width, this.height);
3341
3351
  if (npot) {
3342
3352
  switch (pname) {
3343
- case import_constants11.default.TEXTURE_MIN_FILTER:
3344
- if (value !== import_constants11.default.LINEAR && value !== import_constants11.default.NEAREST) {
3345
- return import_constants11.default.LINEAR;
3353
+ case import_constants11.GL.TEXTURE_MIN_FILTER:
3354
+ if (value !== import_constants11.GL.LINEAR && value !== import_constants11.GL.NEAREST) {
3355
+ return import_constants11.GL.LINEAR;
3346
3356
  }
3347
3357
  break;
3348
- case import_constants11.default.TEXTURE_WRAP_S:
3349
- case import_constants11.default.TEXTURE_WRAP_T:
3350
- return import_constants11.default.CLAMP_TO_EDGE;
3358
+ case import_constants11.GL.TEXTURE_WRAP_S:
3359
+ case import_constants11.GL.TEXTURE_WRAP_T:
3360
+ return import_constants11.GL.CLAMP_TO_EDGE;
3351
3361
  default:
3352
3362
  break;
3353
3363
  }
@@ -3358,23 +3368,23 @@ var _WEBGLTexture = class extends import_api10.Texture {
3358
3368
  var WEBGLTexture = _WEBGLTexture;
3359
3369
  // TODO - remove?
3360
3370
  WEBGLTexture.FACES = [
3361
- import_constants11.default.TEXTURE_CUBE_MAP_POSITIVE_X,
3362
- import_constants11.default.TEXTURE_CUBE_MAP_NEGATIVE_X,
3363
- import_constants11.default.TEXTURE_CUBE_MAP_POSITIVE_Y,
3364
- import_constants11.default.TEXTURE_CUBE_MAP_NEGATIVE_Y,
3365
- import_constants11.default.TEXTURE_CUBE_MAP_POSITIVE_Z,
3366
- import_constants11.default.TEXTURE_CUBE_MAP_NEGATIVE_Z
3371
+ import_constants11.GL.TEXTURE_CUBE_MAP_POSITIVE_X,
3372
+ import_constants11.GL.TEXTURE_CUBE_MAP_NEGATIVE_X,
3373
+ import_constants11.GL.TEXTURE_CUBE_MAP_POSITIVE_Y,
3374
+ import_constants11.GL.TEXTURE_CUBE_MAP_NEGATIVE_Y,
3375
+ import_constants11.GL.TEXTURE_CUBE_MAP_POSITIVE_Z,
3376
+ import_constants11.GL.TEXTURE_CUBE_MAP_NEGATIVE_Z
3367
3377
  ];
3368
3378
  function getWebGLTextureTarget(props) {
3369
3379
  switch (props.dimension) {
3370
3380
  case "2d":
3371
- return import_constants11.default.TEXTURE_2D;
3381
+ return import_constants11.GL.TEXTURE_2D;
3372
3382
  case "cube":
3373
- return import_constants11.default.TEXTURE_CUBE_MAP;
3383
+ return import_constants11.GL.TEXTURE_CUBE_MAP;
3374
3384
  case "2d-array":
3375
- return import_constants11.default.TEXTURE_2D_ARRAY;
3385
+ return import_constants11.GL.TEXTURE_2D_ARRAY;
3376
3386
  case "3d":
3377
- return import_constants11.default.TEXTURE_3D;
3387
+ return import_constants11.GL.TEXTURE_3D;
3378
3388
  case "1d":
3379
3389
  case "cube-array":
3380
3390
  default:
@@ -3393,7 +3403,7 @@ function logParameters(parameters) {
3393
3403
 
3394
3404
  // src/adapter/objects/webgl-renderbuffer.ts
3395
3405
  var import_api13 = require("@luma.gl/api");
3396
- var import_constants13 = __toESM(require("@luma.gl/constants"), 1);
3406
+ var import_constants12 = __toESM(require("@luma.gl/constants"), 1);
3397
3407
 
3398
3408
  // src/adapter/objects/webgl-resource.ts
3399
3409
  var import_api12 = require("@luma.gl/api");
@@ -3413,16 +3423,6 @@ function getKeyValue(gl, name) {
3413
3423
  (0, import_api11.assert)(value !== void 0, `Accessing undefined constant GL.${name}`);
3414
3424
  return value;
3415
3425
  }
3416
- function getKey(gl, value) {
3417
- gl = gl.gl || gl;
3418
- value = Number(value);
3419
- for (const key in gl) {
3420
- if (gl[key] === value) {
3421
- return `GL.${key}`;
3422
- }
3423
- }
3424
- return String(value);
3425
- }
3426
3426
 
3427
3427
  // src/adapter/objects/webgl-resource.ts
3428
3428
  var ERR_RESOURCE_METHOD_UNDEFINED = "Resource subclass must define virtual methods";
@@ -3451,9 +3451,6 @@ var WebGLResource = class extends import_api12.Resource {
3451
3451
  get handle() {
3452
3452
  return this._handle;
3453
3453
  }
3454
- destroy() {
3455
- this.delete();
3456
- }
3457
3454
  delete({ deleteChildren = false } = {}) {
3458
3455
  const children = this._handle && this._deleteHandle(this._handle);
3459
3456
  if (this._handle) {
@@ -3461,7 +3458,7 @@ var WebGLResource = class extends import_api12.Resource {
3461
3458
  }
3462
3459
  this._handle = null;
3463
3460
  if (children && deleteChildren) {
3464
- children.filter(Boolean).forEach((child) => child.delete());
3461
+ children.filter(Boolean).forEach((child) => child.destroy());
3465
3462
  }
3466
3463
  return this;
3467
3464
  }
@@ -3521,10 +3518,10 @@ var WebGLResource = class extends import_api12.Resource {
3521
3518
  const parameter = PARAMETERS[pname];
3522
3519
  const parameterAvailable = parameter && (!("webgl2" in parameter) || isWebgl2) && (!("extension" in parameter) || this.gl.getExtension(parameter.extension));
3523
3520
  if (parameterAvailable) {
3524
- const key = keys ? getKey(this.gl, pname) : pname;
3521
+ const key = keys ? this.device.getGLKey(pname) : pname;
3525
3522
  values[key] = this.getParameter(pname, options);
3526
3523
  if (keys && parameter.type === "GLenum") {
3527
- values[key] = getKey(this.gl, values[key]);
3524
+ values[key] = this.device.getGLKey(values[key]);
3528
3525
  }
3529
3526
  }
3530
3527
  }
@@ -3629,88 +3626,16 @@ var WebGLResource = class extends import_api12.Resource {
3629
3626
  */
3630
3627
  };
3631
3628
 
3632
- // src/adapter/converters/renderbuffer-formats.ts
3633
- var import_constants12 = __toESM(require("@luma.gl/constants"), 1);
3634
- function isRenderbufferFormatSupported(gl, format) {
3635
- const info = RENDERBUFFER_FORMATS[format];
3636
- if (!info) {
3637
- return false;
3638
- }
3639
- if (info.ext) {
3640
- return Boolean(gl.getExtension(info.ext));
3641
- }
3642
- if (info.gl2) {
3643
- return isWebGL2(gl);
3644
- }
3645
- return true;
3646
- }
3647
- function getRenderbufferFormatBytesPerPixel(format) {
3648
- return RENDERBUFFER_FORMATS[format].bpp;
3649
- }
3650
- var EXT_FLOAT_WEBGL2 = "EXT_color_buffer_float";
3651
- var RENDERBUFFER_FORMATS = {
3652
- [import_constants12.default.DEPTH_COMPONENT16]: { bpp: 2 },
3653
- // 16 depth bits.
3654
- [import_constants12.default.DEPTH_COMPONENT24]: { gl2: true, bpp: 3 },
3655
- [import_constants12.default.DEPTH_COMPONENT32F]: { gl2: true, bpp: 4 },
3656
- [import_constants12.default.STENCIL_INDEX8]: { bpp: 1 },
3657
- // 8 stencil bits.
3658
- [import_constants12.default.DEPTH_STENCIL]: { bpp: 4 },
3659
- [import_constants12.default.DEPTH24_STENCIL8]: { gl2: true, bpp: 4 },
3660
- [import_constants12.default.DEPTH32F_STENCIL8]: { gl2: true, bpp: 5 },
3661
- // When using a WebGL 1 context, color renderbuffer formats are limited
3662
- [import_constants12.default.RGBA4]: { bpp: 2 },
3663
- [import_constants12.default.RGB565]: { bpp: 2 },
3664
- [import_constants12.default.RGB5_A1]: { bpp: 2 },
3665
- // When using a WebGL 2 context, the following values are available additionally:
3666
- [import_constants12.default.R8]: { gl2: true, bpp: 1 },
3667
- [import_constants12.default.R8UI]: { gl2: true, bpp: 1 },
3668
- [import_constants12.default.R8I]: { gl2: true, bpp: 1 },
3669
- [import_constants12.default.R16UI]: { gl2: true, bpp: 2 },
3670
- [import_constants12.default.R16I]: { gl2: true, bpp: 2 },
3671
- [import_constants12.default.R32UI]: { gl2: true, bpp: 4 },
3672
- [import_constants12.default.R32I]: { gl2: true, bpp: 4 },
3673
- [import_constants12.default.RG8]: { gl2: true, bpp: 2 },
3674
- [import_constants12.default.RG8UI]: { gl2: true, bpp: 2 },
3675
- [import_constants12.default.RG8I]: { gl2: true, bpp: 2 },
3676
- [import_constants12.default.RG16UI]: { gl2: true, bpp: 4 },
3677
- [import_constants12.default.RG16I]: { gl2: true, bpp: 4 },
3678
- [import_constants12.default.RG32UI]: { gl2: true, bpp: 8 },
3679
- [import_constants12.default.RG32I]: { gl2: true, bpp: 8 },
3680
- [import_constants12.default.RGB8]: { gl2: true, bpp: 3 },
3681
- [import_constants12.default.RGBA8]: { gl2: true, bpp: 4 },
3682
- // [GL.SRGB8_ALPHA8]: {gl2: true, gl1: SRGB}, // When using the EXT_sRGB WebGL1 extension
3683
- [import_constants12.default.RGB10_A2]: { gl2: true, bpp: 4 },
3684
- [import_constants12.default.RGBA8UI]: { gl2: true, bpp: 4 },
3685
- [import_constants12.default.RGBA8I]: { gl2: true, bpp: 4 },
3686
- [import_constants12.default.RGB10_A2UI]: { gl2: true, bpp: 4 },
3687
- [import_constants12.default.RGBA16UI]: { gl2: true, bpp: 8 },
3688
- [import_constants12.default.RGBA16I]: { gl2: true, bpp: 8 },
3689
- [import_constants12.default.RGBA32I]: { gl2: true, bpp: 16 },
3690
- [import_constants12.default.RGBA32UI]: { gl2: true, bpp: 16 },
3691
- // When using a WebGL 2 context and the EXT_color_buffer_float WebGL2 extension
3692
- [import_constants12.default.R16F]: { ext: EXT_FLOAT_WEBGL2, bpp: 2 },
3693
- [import_constants12.default.RG16F]: { ext: EXT_FLOAT_WEBGL2, bpp: 4 },
3694
- [import_constants12.default.RGBA16F]: { ext: EXT_FLOAT_WEBGL2, bpp: 8 },
3695
- [import_constants12.default.R32F]: { ext: EXT_FLOAT_WEBGL2, bpp: 4 },
3696
- [import_constants12.default.RG32F]: { ext: EXT_FLOAT_WEBGL2, bpp: 8 },
3697
- // TODO - can't get WEBGL_color_buffer_float to work on renderbuffers
3698
- [import_constants12.default.RGBA32F]: { ext: EXT_FLOAT_WEBGL2, bpp: 16 },
3699
- // [GL.RGBA32F]: {ext: EXT_FLOAT_WEBGL2, gl1: EXT_FLOAT_WEBGL1},
3700
- [import_constants12.default.R11F_G11F_B10F]: { ext: EXT_FLOAT_WEBGL2, bpp: 4 }
3701
- };
3702
-
3703
3629
  // src/adapter/objects/webgl-renderbuffer.ts
3704
- var DEFAULT_RENDERBUFFER_PROPS = {
3705
- id: void 0,
3706
- handle: void 0,
3707
- userData: void 0,
3708
- format: 0,
3709
- width: 1,
3710
- height: 1,
3711
- samples: 0
3712
- };
3713
- var WEBGLRenderbuffer = class extends WebGLResource {
3630
+ var _WEBGLRenderbuffer = class extends WebGLResource {
3631
+ constructor(device, props) {
3632
+ if (typeof props.format === "number") {
3633
+ throw new Error("Renderbuffer");
3634
+ }
3635
+ super(device, props, _WEBGLRenderbuffer.defaultProps);
3636
+ this.glFormat = convertTextureFormatToGL(this.props.format, device.isWebGL2);
3637
+ this._initialize(this.props);
3638
+ }
3714
3639
  get [Symbol.toStringTag]() {
3715
3640
  return "Renderbuffer";
3716
3641
  }
@@ -3726,19 +3651,17 @@ var WEBGLRenderbuffer = class extends WebGLResource {
3726
3651
  get samples() {
3727
3652
  return this.props.samples;
3728
3653
  }
3729
- static isSupported(gl, options) {
3730
- return !(options == null ? void 0 : options.format) || isRenderbufferFormatSupported(gl, options.format);
3654
+ get attachment() {
3655
+ return;
3731
3656
  }
3732
- constructor(device, props) {
3733
- super(device, props, DEFAULT_RENDERBUFFER_PROPS);
3734
- this._initialize(this.props);
3657
+ static isTextureFormatSupported(device, format) {
3658
+ return isRenderbufferFormatSupported(device.gl, format);
3735
3659
  }
3736
3660
  resize(size) {
3737
3661
  if (size.width !== this.width || size.height !== this.height) {
3738
3662
  Object.assign(this.props, __spreadProps(__spreadValues({}, size), { format: this.format, samples: this.samples }));
3739
3663
  this._initialize(this.props);
3740
3664
  }
3741
- return this;
3742
3665
  }
3743
3666
  // PRIVATE METHODS
3744
3667
  /** Creates and initializes a renderbuffer object's data store */
@@ -3746,17 +3669,16 @@ var WEBGLRenderbuffer = class extends WebGLResource {
3746
3669
  const { format, width, height, samples } = props;
3747
3670
  (0, import_api13.assert)(format, "Needs format");
3748
3671
  this.trackDeallocatedMemory();
3749
- this.gl.bindRenderbuffer(import_constants13.default.RENDERBUFFER, this.handle);
3672
+ this.gl.bindRenderbuffer(import_constants12.default.RENDERBUFFER, this.handle);
3750
3673
  if (samples !== 0 && this.device.isWebGL2) {
3751
- this.gl.renderbufferStorageMultisample(import_constants13.default.RENDERBUFFER, samples, format, width, height);
3674
+ this.gl2.renderbufferStorageMultisample(import_constants12.default.RENDERBUFFER, samples, this.glFormat, width, height);
3752
3675
  } else {
3753
- this.gl.renderbufferStorage(import_constants13.default.RENDERBUFFER, format, width, height);
3676
+ this.gl.renderbufferStorage(import_constants12.default.RENDERBUFFER, this.glFormat, width, height);
3754
3677
  }
3755
- this.gl.bindRenderbuffer(import_constants13.default.RENDERBUFFER, null);
3678
+ this.gl.bindRenderbuffer(import_constants12.default.RENDERBUFFER, null);
3756
3679
  this.trackAllocatedMemory(
3757
- width * height * (samples || 1) * getRenderbufferFormatBytesPerPixel(format)
3680
+ width * height * (samples || 1) * getTextureFormatBytesPerPixel(this.glFormat, this.device.isWebGL2)
3758
3681
  );
3759
- return this;
3760
3682
  }
3761
3683
  // RESOURCE IMPLEMENTATION
3762
3684
  _createHandle() {
@@ -3767,37 +3689,48 @@ var WEBGLRenderbuffer = class extends WebGLResource {
3767
3689
  this.trackDeallocatedMemory();
3768
3690
  }
3769
3691
  _bindHandle(handle) {
3770
- this.gl.bindRenderbuffer(import_constants13.default.RENDERBUFFER, handle);
3692
+ this.gl.bindRenderbuffer(import_constants12.default.RENDERBUFFER, handle);
3771
3693
  }
3772
3694
  };
3695
+ var WEBGLRenderbuffer = _WEBGLRenderbuffer;
3696
+ WEBGLRenderbuffer.defaultProps = {
3697
+ id: void 0,
3698
+ handle: void 0,
3699
+ userData: void 0,
3700
+ format: void 0,
3701
+ // 'depth16unorm'
3702
+ width: 1,
3703
+ height: 1,
3704
+ samples: 0
3705
+ };
3773
3706
 
3774
3707
  // src/adapter/resources/webgl-framebuffer.ts
3775
3708
  var WEBGLFramebuffer = class extends import_api14.Framebuffer {
3776
3709
  constructor(device, props) {
3777
3710
  super(device, props);
3778
- this.colorAttachments = [];
3779
- this.depthStencilAttachment = null;
3780
- this._ownResources = [];
3711
+ const isDefaultFramebuffer = props.handle === null;
3781
3712
  this.device = device;
3782
3713
  this.gl = device.gl;
3783
- this.handle = this.props.handle !== void 0 ? this.props.handle : this.gl.createFramebuffer();
3784
- if (this.handle) {
3714
+ this.handle = this.props.handle || isDefaultFramebuffer ? this.props.handle : this.gl.createFramebuffer();
3715
+ if (!isDefaultFramebuffer) {
3785
3716
  device.setSpectorMetadata(this.handle, { id: this.props.id, props: this.props });
3786
- }
3787
- this.colorAttachments = this._createColorAttachments();
3788
- this.depthStencilAttachment = this._createDepthStencilAttachment();
3789
- const prevHandle = this.gl.bindFramebuffer(import_constants14.default.FRAMEBUFFER, this.handle);
3790
- for (let i = 0; i < this.colorAttachments.length; ++i) {
3791
- const attachment = this.colorAttachments[i];
3792
- const attachmentPoint = import_constants14.default.COLOR_ATTACHMENT0 + i;
3793
- if (attachment) {
3794
- this._attachOne(attachmentPoint, attachment);
3717
+ this.autoCreateAttachmentTextures();
3718
+ this.gl.bindFramebuffer(import_constants13.default.FRAMEBUFFER, this.handle);
3719
+ for (let i = 0; i < this.colorAttachments.length; ++i) {
3720
+ const attachment = this.colorAttachments[i];
3721
+ const attachmentPoint = import_constants13.default.COLOR_ATTACHMENT0 + i;
3722
+ if (attachment) {
3723
+ this._attachOne(attachmentPoint, attachment);
3724
+ }
3795
3725
  }
3726
+ if (this.depthStencilAttachment) {
3727
+ this._attachOne(
3728
+ getDepthStencilAttachmentWebGL(this.depthStencilAttachment.format),
3729
+ this.depthStencilAttachment
3730
+ );
3731
+ }
3732
+ this.gl.bindFramebuffer(import_constants13.default.FRAMEBUFFER, null);
3796
3733
  }
3797
- if (this.props.depthStencilAttachment) {
3798
- this._attachOne(getWebGLDepthStencilAttachment(this.depthStencilAttachment.format), this.depthStencilAttachment);
3799
- }
3800
- this.gl.bindFramebuffer(import_constants14.default.FRAMEBUFFER, prevHandle || null);
3801
3734
  if (props.check !== false) {
3802
3735
  this._checkStatus();
3803
3736
  }
@@ -3805,98 +3738,40 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
3805
3738
  get texture() {
3806
3739
  return this.colorAttachments[0];
3807
3740
  }
3741
+ /** destroys any auto created resources etc. */
3808
3742
  destroy() {
3809
- if (this.handle !== null) {
3810
- for (const resource of this._ownResources) {
3811
- resource.destroy();
3812
- }
3743
+ super.destroy();
3744
+ if (!this.destroyed && this.handle !== null) {
3813
3745
  this.gl.deleteFramebuffer(this.handle);
3814
- this.destroyed = true;
3815
3746
  }
3816
3747
  }
3817
3748
  // PRIVATE
3818
3749
  /** Check the status */
3819
3750
  _checkStatus() {
3820
3751
  const { gl } = this;
3821
- const prevHandle = gl.bindFramebuffer(import_constants14.default.FRAMEBUFFER, this.handle);
3822
- const status = gl.checkFramebufferStatus(import_constants14.default.FRAMEBUFFER);
3823
- gl.bindFramebuffer(import_constants14.default.FRAMEBUFFER, prevHandle || null);
3752
+ const prevHandle2 = gl.bindFramebuffer(import_constants13.default.FRAMEBUFFER, this.handle);
3753
+ const status = gl.checkFramebufferStatus(import_constants13.default.FRAMEBUFFER);
3754
+ gl.bindFramebuffer(import_constants13.default.FRAMEBUFFER, prevHandle2 || null);
3824
3755
  if (status !== gl.FRAMEBUFFER_COMPLETE) {
3825
3756
  throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
3826
3757
  }
3827
3758
  }
3828
- _createColorAttachments() {
3829
- return this.props.colorAttachments.map((colorAttachment) => {
3830
- if (!colorAttachment) {
3831
- return void 0;
3832
- }
3833
- if (colorAttachment instanceof WEBGLTexture) {
3834
- return colorAttachment;
3835
- }
3836
- return this._createColorAttachment(colorAttachment, this.width, this.height);
3837
- });
3838
- }
3839
- /** Create a color attachment */
3840
- _createColorAttachment(format, width, height) {
3841
- const texture = this.device._createTexture({
3842
- id: `${this.id}-color`,
3843
- data: null,
3844
- // reserves texture memory, but texels are undefined
3845
- format,
3846
- // type: GL.UNSIGNED_BYTE,
3847
- width,
3848
- height,
3849
- // Note: Mipmapping can be disabled by texture resource when we resize the texture
3850
- // to a non-power-of-two dimenstion (NPOT texture) under WebGL1. To have consistant
3851
- // behavior we always disable mipmaps.
3852
- mipmaps: false,
3853
- // Set MIN and MAG filtering parameters so mipmaps are not used in sampling.
3854
- // Use LINEAR so subpixel algos like fxaa work.
3855
- // Set WRAP modes that support NPOT textures too.
3856
- sampler: {
3857
- minFilter: "linear",
3858
- magFilter: "linear",
3859
- addressModeU: "clamp-to-edge",
3860
- addressModeV: "clamp-to-edge"
3861
- }
3862
- // parameters: {
3863
- // [GL.TEXTURE_MIN_FILTER]: GL.LINEAR,
3864
- // [GL.TEXTURE_MAG_FILTER]: GL.LINEAR,
3865
- // [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,
3866
- // [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE
3867
- // }
3868
- });
3869
- this._ownResources.push(texture);
3870
- return texture;
3871
- }
3872
- /** Create a depth stencil attachment GL.DEPTH24_STENCIL8 */
3873
- _createDepthStencilAttachment() {
3874
- if (!this.props.depthStencilAttachment) {
3875
- return void 0;
3876
- }
3877
- if (this.props.depthStencilAttachment instanceof WEBGLRenderbuffer) {
3878
- return this.props.depthStencilAttachment;
3879
- }
3880
- if (this.props.depthStencilAttachment instanceof import_api14.Texture) {
3881
- return this.props.depthStencilAttachment;
3882
- }
3883
- const format = this.props.depthStencilAttachment;
3884
- const webglFormat = getWebGLTextureFormat(this.gl, format);
3885
- const texture = new WEBGLRenderbuffer(this.device, {
3759
+ /** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
3760
+ createDepthStencilTexture(format) {
3761
+ return new WEBGLRenderbuffer(this.device, {
3886
3762
  id: `${this.id}-depth-stencil`,
3887
3763
  // TODO misleading if not depth and stencil?
3888
- format: webglFormat,
3764
+ format,
3889
3765
  // dataFormat: GL.DEPTH_STENCIL,
3890
3766
  // type: GL.UNSIGNED_INT_24_8,
3891
3767
  width: this.width,
3892
3768
  height: this.height
3893
3769
  });
3894
- this._ownResources.push(texture);
3895
- return texture;
3896
3770
  }
3897
- /** Attachment resize is expected to be a noop if size is same */
3898
- _resizeAttachments(width, height) {
3899
- var _a;
3771
+ /**
3772
+ * Attachment resize is expected to be a noop if size is same
3773
+ */
3774
+ resizeAttachments(width, height) {
3900
3775
  if (this.handle === null) {
3901
3776
  this.width = this.gl.drawingBufferWidth;
3902
3777
  this.height = this.gl.drawingBufferHeight;
@@ -3908,13 +3783,12 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
3908
3783
  if (height === void 0) {
3909
3784
  height = this.gl.drawingBufferHeight;
3910
3785
  }
3911
- if (width !== this.width && height !== this.height) {
3912
- import_api14.log.log(2, `Resizing framebuffer ${this.id} to ${width}x${height}`)();
3913
- }
3914
3786
  for (const colorAttachment of this.colorAttachments) {
3915
3787
  colorAttachment.resize({ width, height });
3916
3788
  }
3917
- (_a = this.depthStencilAttachment) == null ? void 0 : _a.resize({ width, height });
3789
+ if (this.depthStencilAttachment) {
3790
+ this.depthStencilAttachment.resize({ width, height });
3791
+ }
3918
3792
  return this;
3919
3793
  }
3920
3794
  /** Attach one attachment */
@@ -3934,9 +3808,9 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
3934
3808
  }
3935
3809
  _attachWEBGLRenderbuffer(attachment, renderbuffer) {
3936
3810
  this.gl.framebufferRenderbuffer(
3937
- import_constants14.default.FRAMEBUFFER,
3811
+ import_constants13.default.FRAMEBUFFER,
3938
3812
  attachment,
3939
- import_constants14.default.RENDERBUFFER,
3813
+ import_constants13.default.RENDERBUFFER,
3940
3814
  renderbuffer.handle
3941
3815
  );
3942
3816
  }
@@ -3950,17 +3824,17 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
3950
3824
  const { gl, gl2 } = this.device;
3951
3825
  gl.bindTexture(texture.target, texture.handle);
3952
3826
  switch (texture.target) {
3953
- case import_constants14.default.TEXTURE_2D_ARRAY:
3954
- case import_constants14.default.TEXTURE_3D:
3827
+ case import_constants13.default.TEXTURE_2D_ARRAY:
3828
+ case import_constants13.default.TEXTURE_3D:
3955
3829
  this.device.assertWebGL2();
3956
- gl2 == null ? void 0 : gl2.framebufferTextureLayer(import_constants14.default.FRAMEBUFFER, attachment, texture.target, level, layer);
3830
+ gl2 == null ? void 0 : gl2.framebufferTextureLayer(import_constants13.default.FRAMEBUFFER, attachment, texture.target, level, layer);
3957
3831
  break;
3958
- case import_constants14.default.TEXTURE_CUBE_MAP:
3832
+ case import_constants13.default.TEXTURE_CUBE_MAP:
3959
3833
  const face = mapIndexToCubeMapFace(layer);
3960
- gl.framebufferTexture2D(import_constants14.default.FRAMEBUFFER, attachment, face, texture.handle, level);
3834
+ gl.framebufferTexture2D(import_constants13.default.FRAMEBUFFER, attachment, face, texture.handle, level);
3961
3835
  break;
3962
- case import_constants14.default.TEXTURE_2D:
3963
- gl.framebufferTexture2D(import_constants14.default.FRAMEBUFFER, attachment, import_constants14.default.TEXTURE_2D, texture.handle, level);
3836
+ case import_constants13.default.TEXTURE_2D:
3837
+ gl.framebufferTexture2D(import_constants13.default.FRAMEBUFFER, attachment, import_constants13.default.TEXTURE_2D, texture.handle, level);
3964
3838
  break;
3965
3839
  default:
3966
3840
  (0, import_api14.assert)(false, "Illegal texture type");
@@ -3969,21 +3843,21 @@ var WEBGLFramebuffer = class extends import_api14.Framebuffer {
3969
3843
  }
3970
3844
  };
3971
3845
  function mapIndexToCubeMapFace(layer) {
3972
- return layer < import_constants14.default.TEXTURE_CUBE_MAP_POSITIVE_X ? layer + import_constants14.default.TEXTURE_CUBE_MAP_POSITIVE_X : layer;
3846
+ return layer < import_constants13.default.TEXTURE_CUBE_MAP_POSITIVE_X ? layer + import_constants13.default.TEXTURE_CUBE_MAP_POSITIVE_X : layer;
3973
3847
  }
3974
3848
  function _getFrameBufferStatus(status) {
3975
3849
  switch (status) {
3976
- case import_constants14.default.FRAMEBUFFER_COMPLETE:
3850
+ case import_constants13.default.FRAMEBUFFER_COMPLETE:
3977
3851
  return "success";
3978
- case import_constants14.default.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
3852
+ case import_constants13.default.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
3979
3853
  return "Mismatched attachments";
3980
- case import_constants14.default.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
3854
+ case import_constants13.default.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
3981
3855
  return "No attachments";
3982
- case import_constants14.default.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
3856
+ case import_constants13.default.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
3983
3857
  return "Height/width mismatch";
3984
- case import_constants14.default.FRAMEBUFFER_UNSUPPORTED:
3858
+ case import_constants13.default.FRAMEBUFFER_UNSUPPORTED:
3985
3859
  return "Unsupported or split attachments";
3986
- case import_constants14.default.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
3860
+ case import_constants13.default.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
3987
3861
  return "Samples mismatch";
3988
3862
  default:
3989
3863
  return `${status}`;
@@ -4100,7 +3974,7 @@ function initializeSpectorJS(props) {
4100
3974
 
4101
3975
  // src/context/debug/webgl-developer-tools.ts
4102
3976
  var import_api17 = require("@luma.gl/api");
4103
- var import_constants15 = __toESM(require("@luma.gl/constants"), 1);
3977
+ var import_constants14 = __toESM(require("@luma.gl/constants"), 1);
4104
3978
  var WEBGL_DEBUG_CDN_URL = "https://unpkg.com/webgl-debug@2.0.1/index.js";
4105
3979
  function getContextData2(gl) {
4106
3980
  gl.luma = gl.luma || {};
@@ -4134,15 +4008,15 @@ function getDebugContext(gl, props) {
4134
4008
  if (data.debugContext) {
4135
4009
  return data.debugContext;
4136
4010
  }
4137
- globalThis.WebGLDebugUtils.init(__spreadValues(__spreadValues({}, import_constants15.default), gl));
4011
+ globalThis.WebGLDebugUtils.init(__spreadValues(__spreadValues({}, import_constants14.default), gl));
4138
4012
  const glDebug = globalThis.WebGLDebugUtils.makeDebugContext(
4139
4013
  gl,
4140
4014
  onGLError.bind(null, props),
4141
4015
  onValidateGLFunc.bind(null, props)
4142
4016
  );
4143
- for (const key in import_constants15.default) {
4144
- if (!(key in glDebug) && typeof import_constants15.default[key] === "number") {
4145
- glDebug[key] = import_constants15.default[key];
4017
+ for (const key in import_constants14.default) {
4018
+ if (!(key in glDebug) && typeof import_constants14.default[key] === "number") {
4019
+ glDebug[key] = import_constants14.default[key];
4146
4020
  }
4147
4021
  }
4148
4022
  class WebGLDebugContext {
@@ -4201,34 +4075,34 @@ function onValidateGLFunc(props, functionName, functionArgs) {
4201
4075
 
4202
4076
  // src/classic/buffer.ts
4203
4077
  var import_api19 = require("@luma.gl/api");
4204
- var import_constants18 = __toESM(require("@luma.gl/constants"), 1);
4078
+ var import_constants17 = __toESM(require("@luma.gl/constants"), 1);
4205
4079
 
4206
4080
  // src/classic/accessor.ts
4207
4081
  var import_api18 = require("@luma.gl/api");
4208
- var import_constants17 = __toESM(require("@luma.gl/constants"), 1);
4082
+ var import_constants16 = __toESM(require("@luma.gl/constants"), 1);
4209
4083
 
4210
4084
  // src/classic/typed-array-utils.ts
4211
- var import_constants16 = __toESM(require("@luma.gl/constants"), 1);
4085
+ var import_constants15 = require("@luma.gl/constants");
4212
4086
  var ERR_TYPE_DEDUCTION = "Failed to deduce GL constant from typed array";
4213
4087
  function getGLTypeFromTypedArray(arrayOrType) {
4214
4088
  const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
4215
4089
  switch (type) {
4216
4090
  case Float32Array:
4217
- return import_constants16.default.FLOAT;
4091
+ return import_constants15.GL.FLOAT;
4218
4092
  case Uint16Array:
4219
- return import_constants16.default.UNSIGNED_SHORT;
4093
+ return import_constants15.GL.UNSIGNED_SHORT;
4220
4094
  case Uint32Array:
4221
- return import_constants16.default.UNSIGNED_INT;
4095
+ return import_constants15.GL.UNSIGNED_INT;
4222
4096
  case Uint8Array:
4223
- return import_constants16.default.UNSIGNED_BYTE;
4097
+ return import_constants15.GL.UNSIGNED_BYTE;
4224
4098
  case Uint8ClampedArray:
4225
- return import_constants16.default.UNSIGNED_BYTE;
4099
+ return import_constants15.GL.UNSIGNED_BYTE;
4226
4100
  case Int8Array:
4227
- return import_constants16.default.BYTE;
4101
+ return import_constants15.GL.BYTE;
4228
4102
  case Int16Array:
4229
- return import_constants16.default.SHORT;
4103
+ return import_constants15.GL.SHORT;
4230
4104
  case Int32Array:
4231
- return import_constants16.default.INT;
4105
+ return import_constants15.GL.INT;
4232
4106
  default:
4233
4107
  throw new Error(ERR_TYPE_DEDUCTION);
4234
4108
  }
@@ -4236,22 +4110,22 @@ function getGLTypeFromTypedArray(arrayOrType) {
4236
4110
  function getTypedArrayFromGLType(glType, options) {
4237
4111
  const { clamped = true } = options || {};
4238
4112
  switch (glType) {
4239
- case import_constants16.default.FLOAT:
4113
+ case import_constants15.GL.FLOAT:
4240
4114
  return Float32Array;
4241
- case import_constants16.default.UNSIGNED_SHORT:
4242
- case import_constants16.default.UNSIGNED_SHORT_5_6_5:
4243
- case import_constants16.default.UNSIGNED_SHORT_4_4_4_4:
4244
- case import_constants16.default.UNSIGNED_SHORT_5_5_5_1:
4115
+ case import_constants15.GL.UNSIGNED_SHORT:
4116
+ case import_constants15.GL.UNSIGNED_SHORT_5_6_5:
4117
+ case import_constants15.GL.UNSIGNED_SHORT_4_4_4_4:
4118
+ case import_constants15.GL.UNSIGNED_SHORT_5_5_5_1:
4245
4119
  return Uint16Array;
4246
- case import_constants16.default.UNSIGNED_INT:
4120
+ case import_constants15.GL.UNSIGNED_INT:
4247
4121
  return Uint32Array;
4248
- case import_constants16.default.UNSIGNED_BYTE:
4122
+ case import_constants15.GL.UNSIGNED_BYTE:
4249
4123
  return clamped ? Uint8ClampedArray : Uint8Array;
4250
- case import_constants16.default.BYTE:
4124
+ case import_constants15.GL.BYTE:
4251
4125
  return Int8Array;
4252
- case import_constants16.default.SHORT:
4126
+ case import_constants15.GL.SHORT:
4253
4127
  return Int16Array;
4254
- case import_constants16.default.INT:
4128
+ case import_constants15.GL.INT:
4255
4129
  return Int32Array;
4256
4130
  default:
4257
4131
  throw new Error("Failed to deduce typed array type from GL constant");
@@ -4262,7 +4136,7 @@ function getTypedArrayFromGLType(glType, options) {
4262
4136
  var DEFAULT_ACCESSOR_VALUES = {
4263
4137
  offset: 0,
4264
4138
  stride: 0,
4265
- type: import_constants17.default.FLOAT,
4139
+ type: import_constants16.default.FLOAT,
4266
4140
  size: 1,
4267
4141
  divisor: 0,
4268
4142
  normalized: false,
@@ -4276,12 +4150,12 @@ var PROP_CHECKS = {
4276
4150
  };
4277
4151
  var Accessor = class {
4278
4152
  static getBytesPerElement(accessor) {
4279
- const ArrayType = getTypedArrayFromGLType(accessor.type || import_constants17.default.FLOAT);
4153
+ const ArrayType = getTypedArrayFromGLType(accessor.type || import_constants16.default.FLOAT);
4280
4154
  return ArrayType.BYTES_PER_ELEMENT;
4281
4155
  }
4282
4156
  static getBytesPerVertex(accessor) {
4283
4157
  (0, import_api18.assert)(accessor.size);
4284
- const ArrayType = getTypedArrayFromGLType(accessor.type || import_constants17.default.FLOAT);
4158
+ const ArrayType = getTypedArrayFromGLType(accessor.type || import_constants16.default.FLOAT);
4285
4159
  return ArrayType.BYTES_PER_ELEMENT * accessor.size;
4286
4160
  }
4287
4161
  // Combines (merges) a list of accessors. On top of default values
@@ -4312,7 +4186,7 @@ var Accessor = class {
4312
4186
  props = (0, import_api18.checkProps)("Accessor", props, PROP_CHECKS);
4313
4187
  if (props.type !== void 0) {
4314
4188
  this.type = props.type;
4315
- if (props.type === import_constants17.default.INT || props.type === import_constants17.default.UNSIGNED_INT) {
4189
+ if (props.type === import_constants16.default.INT || props.type === import_constants16.default.UNSIGNED_INT) {
4316
4190
  this.integer = true;
4317
4191
  }
4318
4192
  }
@@ -4424,9 +4298,9 @@ var ClassicBuffer = class extends WEBGLBuffer {
4424
4298
  }
4425
4299
  Object.seal(this);
4426
4300
  }
4427
- write(data, byteOffset) {
4428
- this.subData({ data, offset: byteOffset });
4429
- }
4301
+ // override write(data: TypedArray, byteOffset: number = 0): void {
4302
+ // this.subData({data, offset: byteOffset});
4303
+ // }
4430
4304
  // returns number of elements in the buffer (assuming that the full buffer is used)
4431
4305
  getElementCount(accessor = this.accessor) {
4432
4306
  return Math.round(this.byteLength / Accessor.getBytesPerElement(accessor));
@@ -4447,7 +4321,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
4447
4321
  props = { byteLength: props };
4448
4322
  }
4449
4323
  props = (0, import_api19.checkProps)("Buffer", props, PROP_CHECKS_INITIALIZE);
4450
- this.webglUsage = props.webglUsage || import_constants18.default.STATIC_DRAW;
4324
+ this.webglUsage = props.webglUsage || import_constants17.default.STATIC_DRAW;
4451
4325
  this.debugData = null;
4452
4326
  this.setAccessor(Object.assign({}, props, props.accessor));
4453
4327
  if (props.data) {
@@ -4501,7 +4375,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
4501
4375
  const { data, offset = 0, srcOffset = 0 } = options;
4502
4376
  const byteLength = options.byteLength || options.length;
4503
4377
  (0, import_api19.assert)(data);
4504
- const target = this.gl.webgl2 ? import_constants18.default.COPY_WRITE_BUFFER : this.target;
4378
+ const target = this.gl.webgl2 ? import_constants17.default.COPY_WRITE_BUFFER : this.target;
4505
4379
  this.gl.bindBuffer(target, this.handle);
4506
4380
  if (srcOffset !== 0 || byteLength !== void 0) {
4507
4381
  assertWebGL2Context(this.gl);
@@ -4522,11 +4396,11 @@ var ClassicBuffer = class extends WEBGLBuffer {
4522
4396
  const { sourceBuffer, readOffset = 0, writeOffset = 0, size } = options;
4523
4397
  const { gl, gl2 } = this;
4524
4398
  assertWebGL2Context(gl);
4525
- gl.bindBuffer(import_constants18.default.COPY_READ_BUFFER, sourceBuffer.handle);
4526
- gl.bindBuffer(import_constants18.default.COPY_WRITE_BUFFER, this.handle);
4527
- gl2 == null ? void 0 : gl2.copyBufferSubData(import_constants18.default.COPY_READ_BUFFER, import_constants18.default.COPY_WRITE_BUFFER, readOffset, writeOffset, size);
4528
- gl.bindBuffer(import_constants18.default.COPY_READ_BUFFER, null);
4529
- gl.bindBuffer(import_constants18.default.COPY_WRITE_BUFFER, null);
4399
+ gl.bindBuffer(import_constants17.default.COPY_READ_BUFFER, sourceBuffer.handle);
4400
+ gl.bindBuffer(import_constants17.default.COPY_WRITE_BUFFER, this.handle);
4401
+ gl2 == null ? void 0 : gl2.copyBufferSubData(import_constants17.default.COPY_READ_BUFFER, import_constants17.default.COPY_WRITE_BUFFER, readOffset, writeOffset, size);
4402
+ gl.bindBuffer(import_constants17.default.COPY_READ_BUFFER, null);
4403
+ gl.bindBuffer(import_constants17.default.COPY_WRITE_BUFFER, null);
4530
4404
  this.debugData = null;
4531
4405
  return this;
4532
4406
  }
@@ -4539,7 +4413,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
4539
4413
  let { dstData = null, length = 0 } = options || {};
4540
4414
  const { srcByteOffset = 0, dstOffset = 0 } = options || {};
4541
4415
  assertWebGL2Context(this.gl);
4542
- const ArrayType = getTypedArrayFromGLType(this.accessor.type || import_constants18.default.FLOAT, { clamped: false });
4416
+ const ArrayType = getTypedArrayFromGLType(this.accessor.type || import_constants17.default.FLOAT, { clamped: false });
4543
4417
  const sourceAvailableElementCount = this._getAvailableElementCount(srcByteOffset);
4544
4418
  const dstElementOffset = dstOffset;
4545
4419
  let dstAvailableElementCount;
@@ -4558,9 +4432,9 @@ var ClassicBuffer = class extends WEBGLBuffer {
4558
4432
  length = length || copyElementCount;
4559
4433
  (0, import_api19.assert)(length <= copyElementCount);
4560
4434
  dstData = dstData || new ArrayType(dstElementCount);
4561
- this.gl.bindBuffer(import_constants18.default.COPY_READ_BUFFER, this.handle);
4562
- (_a = this.gl2) == null ? void 0 : _a.getBufferSubData(import_constants18.default.COPY_READ_BUFFER, srcByteOffset, dstData, dstOffset, length);
4563
- this.gl.bindBuffer(import_constants18.default.COPY_READ_BUFFER, null);
4435
+ this.gl.bindBuffer(import_constants17.default.COPY_READ_BUFFER, this.handle);
4436
+ (_a = this.gl2) == null ? void 0 : _a.getBufferSubData(import_constants17.default.COPY_READ_BUFFER, srcByteOffset, dstData, dstOffset, length);
4437
+ this.gl.bindBuffer(import_constants17.default.COPY_READ_BUFFER, null);
4564
4438
  return dstData;
4565
4439
  }
4566
4440
  /**
@@ -4580,7 +4454,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
4580
4454
  offset = 0,
4581
4455
  size
4582
4456
  } = options || {};
4583
- if (target === import_constants18.default.UNIFORM_BUFFER || target === import_constants18.default.TRANSFORM_FEEDBACK_BUFFER) {
4457
+ if (target === import_constants17.default.UNIFORM_BUFFER || target === import_constants17.default.TRANSFORM_FEEDBACK_BUFFER) {
4584
4458
  if (size !== void 0) {
4585
4459
  (_a = this.gl2) == null ? void 0 : _a.bindBufferRange(target, index, this.handle, offset, size);
4586
4460
  } else {
@@ -4595,7 +4469,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
4595
4469
  unbind(options) {
4596
4470
  var _a;
4597
4471
  const { target = this.target, index = this.accessor && this.accessor.index } = options || {};
4598
- const isIndexedBuffer = target === import_constants18.default.UNIFORM_BUFFER || target === import_constants18.default.TRANSFORM_FEEDBACK_BUFFER;
4472
+ const isIndexedBuffer = target === import_constants17.default.UNIFORM_BUFFER || target === import_constants17.default.TRANSFORM_FEEDBACK_BUFFER;
4599
4473
  if (isIndexedBuffer) {
4600
4474
  (_a = this.gl2) == null ? void 0 : _a.bindBufferBase(target, index, null);
4601
4475
  } else {
@@ -4656,10 +4530,10 @@ var ClassicBuffer = class extends WEBGLBuffer {
4656
4530
  // Binding a buffer for the first time locks the type
4657
4531
  // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type
4658
4532
  _getTarget() {
4659
- return this.gl.webgl2 ? import_constants18.default.COPY_WRITE_BUFFER : this.target;
4533
+ return this.gl.webgl2 ? import_constants17.default.COPY_WRITE_BUFFER : this.target;
4660
4534
  }
4661
4535
  _getAvailableElementCount(srcByteOffset) {
4662
- const ArrayType = getTypedArrayFromGLType(this.accessor.type || import_constants18.default.FLOAT, { clamped: false });
4536
+ const ArrayType = getTypedArrayFromGLType(this.accessor.type || import_constants17.default.FLOAT, { clamped: false });
4663
4537
  const sourceElementOffset = srcByteOffset / ArrayType.BYTES_PER_ELEMENT;
4664
4538
  return this.getElementCount() - sourceElementOffset;
4665
4539
  }
@@ -4686,7 +4560,7 @@ var ClassicBuffer = class extends WEBGLBuffer {
4686
4560
 
4687
4561
  // src/adapter/resources/webgl-shader.ts
4688
4562
  var import_api20 = require("@luma.gl/api");
4689
- var import_constants19 = __toESM(require("@luma.gl/constants"), 1);
4563
+ var import_constants18 = __toESM(require("@luma.gl/constants"), 1);
4690
4564
 
4691
4565
  // src/adapter/helpers/get-shader-info.ts
4692
4566
  function getShaderInfo(source, defaultName) {
@@ -4752,10 +4626,10 @@ var WEBGLShader = class extends import_api20.Shader {
4752
4626
  this.device = device;
4753
4627
  switch (this.props.stage) {
4754
4628
  case "vertex":
4755
- this.handle = this.props.handle || this.device.gl.createShader(import_constants19.default.VERTEX_SHADER);
4629
+ this.handle = this.props.handle || this.device.gl.createShader(import_constants18.default.VERTEX_SHADER);
4756
4630
  break;
4757
4631
  case "fragment":
4758
- this.handle = this.props.handle || this.device.gl.createShader(import_constants19.default.FRAGMENT_SHADER);
4632
+ this.handle = this.props.handle || this.device.gl.createShader(import_constants18.default.FRAGMENT_SHADER);
4759
4633
  break;
4760
4634
  default:
4761
4635
  throw new Error(this.props.stage);
@@ -4771,8 +4645,8 @@ var WEBGLShader = class extends import_api20.Shader {
4771
4645
  }
4772
4646
  compilationInfo() {
4773
4647
  return __async(this, null, function* () {
4774
- const log10 = this.device.gl.getShaderInfoLog(this.handle);
4775
- return log10 ? parseShaderCompilerLog(log10) : [];
4648
+ const log9 = this.device.gl.getShaderInfoLog(this.handle);
4649
+ return log9 ? parseShaderCompilerLog(log9) : [];
4776
4650
  });
4777
4651
  }
4778
4652
  // PRIVATE METHODS
@@ -4783,7 +4657,7 @@ ${source2}`;
4783
4657
  const { gl } = this.device;
4784
4658
  gl.shaderSource(this.handle, source);
4785
4659
  gl.compileShader(this.handle);
4786
- const compileStatus = gl.getShaderParameter(this.handle, import_constants19.default.COMPILE_STATUS);
4660
+ const compileStatus = gl.getShaderParameter(this.handle, import_constants18.default.COMPILE_STATUS);
4787
4661
  if (!compileStatus) {
4788
4662
  const shaderLog = gl.getShaderInfoLog(this.handle);
4789
4663
  const parsedLog = shaderLog ? parseShaderCompilerLog(shaderLog) : [];
@@ -4803,10 +4677,17 @@ function getShaderIdFromProps(props) {
4803
4677
 
4804
4678
  // src/adapter/resources/webgl-render-pass.ts
4805
4679
  var import_api21 = require("@luma.gl/api");
4680
+ var import_constants19 = require("@luma.gl/constants");
4681
+ var GL_DEPTH_BUFFER_BIT = 256;
4682
+ var GL_STENCIL_BUFFER_BIT = 1024;
4683
+ var GL_COLOR_BUFFER_BIT = 16384;
4684
+ var GL_COLOR = 6144;
4806
4685
  var WEBGLRenderPass = class extends import_api21.RenderPass {
4807
4686
  constructor(device, props) {
4808
4687
  super(device, props);
4809
4688
  this.device = device;
4689
+ this.setParameters(this.props.parameters);
4690
+ this.clear();
4810
4691
  }
4811
4692
  end() {
4812
4693
  }
@@ -4820,6 +4701,98 @@ var WEBGLRenderPass = class extends import_api21.RenderPass {
4820
4701
  // beginOcclusionQuery(queryIndex: number): void;
4821
4702
  // endOcclusionQuery(): void;
4822
4703
  // executeBundles(bundles: Iterable<GPURenderBundle>): void;
4704
+ /**
4705
+ * Maps RenderPass parameters to GL parameters
4706
+ */
4707
+ setParameters(parameters = {}) {
4708
+ const glParameters = {};
4709
+ if (this.props.framebuffer) {
4710
+ glParameters.framebuffer = this.props.framebuffer;
4711
+ }
4712
+ if (this.props.depthReadOnly) {
4713
+ glParameters.depthMask = !this.props.depthReadOnly;
4714
+ }
4715
+ glParameters.stencilMask = this.props.stencilReadOnly ? 0 : 1;
4716
+ glParameters[import_constants19.GL.RASTERIZER_DISCARD] = this.props.discard;
4717
+ if (parameters.viewport) {
4718
+ glParameters.viewport = parameters.viewport;
4719
+ glParameters.depthRange = [parameters.viewport[4], parameters.viewport[5]];
4720
+ }
4721
+ glParameters.scissorTest = Boolean(parameters.scissorRect);
4722
+ if (parameters.scissorRect) {
4723
+ glParameters.scissor = parameters.scissorRect;
4724
+ }
4725
+ if (parameters.blendConstant) {
4726
+ glParameters.blendColor = parameters.blendConstant;
4727
+ }
4728
+ if (parameters.stencilReference) {
4729
+ console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL");
4730
+ parameters[import_constants19.GL.STENCIL_REF] = parameters.stencilReference;
4731
+ }
4732
+ this.glParameters = glParameters;
4733
+ }
4734
+ // Internal
4735
+ /**
4736
+ * Optionally clears depth, color and stencil buffers based on parameters
4737
+ */
4738
+ clear() {
4739
+ const glParameters = __spreadValues({}, this.glParameters);
4740
+ let clearMask = 0;
4741
+ if (this.props.clearColor !== false) {
4742
+ clearMask |= GL_COLOR_BUFFER_BIT;
4743
+ glParameters.clearColor = this.props.clearColor;
4744
+ }
4745
+ if (this.props.clearDepth !== false) {
4746
+ clearMask |= GL_DEPTH_BUFFER_BIT;
4747
+ glParameters.clearDepth = this.props.clearDepth;
4748
+ }
4749
+ if (this.props.clearStencil !== false) {
4750
+ clearMask |= GL_STENCIL_BUFFER_BIT;
4751
+ glParameters.clearStencil = this.props.clearStencil;
4752
+ }
4753
+ if (clearMask !== 0) {
4754
+ withParameters(this.device, glParameters, () => {
4755
+ this.device.gl.clear(clearMask);
4756
+ });
4757
+ }
4758
+ }
4759
+ /**
4760
+ * WebGL2 - clear a specific color buffer
4761
+ */
4762
+ clearColorBuffer(drawBuffer = 0, value = [0, 0, 0, 0]) {
4763
+ withParameters(this.device.gl2, { framebuffer: this.props.framebuffer }, () => {
4764
+ switch (value.constructor) {
4765
+ case Int32Array:
4766
+ this.device.gl2.clearBufferiv(GL_COLOR, drawBuffer, value);
4767
+ break;
4768
+ case Uint32Array:
4769
+ this.device.gl2.clearBufferuiv(GL_COLOR, drawBuffer, value);
4770
+ break;
4771
+ case Float32Array:
4772
+ default:
4773
+ this.device.gl2.clearBufferfv(GL_COLOR, drawBuffer, value);
4774
+ break;
4775
+ }
4776
+ });
4777
+ }
4778
+ // clearDepthStencil() {
4779
+ // const GL_DEPTH = 0x1801;
4780
+ // const GL_STENCIL = 0x1802;
4781
+ // const GL_DEPTH_STENCIL = 0x84f9;
4782
+ // case GL_DEPTH:
4783
+ // this.device.gl2.clearBufferfv(GL_DEPTH, 0, [value]);
4784
+ // break;
4785
+ // case GL_STENCIL:
4786
+ // this.device.gl2.clearBufferiv(GL_STENCIL, 0, [value]);
4787
+ // break;
4788
+ // case GL_DEPTH_STENCIL:
4789
+ // const [depth, stencil] = value;
4790
+ // this.device.gl2.clearBufferfi(GL_DEPTH_STENCIL, 0, depth, stencil);
4791
+ // break;
4792
+ // default:
4793
+ // assert(false, ERR_ARGUMENTS);
4794
+ // }
4795
+ // });
4823
4796
  };
4824
4797
 
4825
4798
  // src/adapter/resources/webgl-render-pipeline.ts
@@ -4830,61 +4803,61 @@ var import_constants25 = __toESM(require("@luma.gl/constants"), 1);
4830
4803
  var import_constants22 = __toESM(require("@luma.gl/constants"), 1);
4831
4804
 
4832
4805
  // src/adapter/helpers/uniforms.ts
4833
- var import_constants20 = __toESM(require("@luma.gl/constants"), 1);
4806
+ var import_constants20 = require("@luma.gl/constants");
4834
4807
  function isSamplerUniform(type) {
4835
4808
  return SAMPLER_TYPES.includes(type);
4836
4809
  }
4837
4810
  var SAMPLER_TYPES = [
4838
- import_constants20.default.SAMPLER_2D,
4839
- import_constants20.default.SAMPLER_CUBE,
4840
- import_constants20.default.SAMPLER_3D,
4841
- import_constants20.default.SAMPLER_2D_SHADOW,
4842
- import_constants20.default.SAMPLER_2D_ARRAY,
4843
- import_constants20.default.SAMPLER_2D_ARRAY_SHADOW,
4844
- import_constants20.default.SAMPLER_CUBE_SHADOW,
4845
- import_constants20.default.INT_SAMPLER_2D,
4846
- import_constants20.default.INT_SAMPLER_3D,
4847
- import_constants20.default.INT_SAMPLER_CUBE,
4848
- import_constants20.default.INT_SAMPLER_2D_ARRAY,
4849
- import_constants20.default.UNSIGNED_INT_SAMPLER_2D,
4850
- import_constants20.default.UNSIGNED_INT_SAMPLER_3D,
4851
- import_constants20.default.UNSIGNED_INT_SAMPLER_CUBE,
4852
- import_constants20.default.UNSIGNED_INT_SAMPLER_2D_ARRAY
4811
+ import_constants20.GL.SAMPLER_2D,
4812
+ import_constants20.GL.SAMPLER_CUBE,
4813
+ import_constants20.GL.SAMPLER_3D,
4814
+ import_constants20.GL.SAMPLER_2D_SHADOW,
4815
+ import_constants20.GL.SAMPLER_2D_ARRAY,
4816
+ import_constants20.GL.SAMPLER_2D_ARRAY_SHADOW,
4817
+ import_constants20.GL.SAMPLER_CUBE_SHADOW,
4818
+ import_constants20.GL.INT_SAMPLER_2D,
4819
+ import_constants20.GL.INT_SAMPLER_3D,
4820
+ import_constants20.GL.INT_SAMPLER_CUBE,
4821
+ import_constants20.GL.INT_SAMPLER_2D_ARRAY,
4822
+ import_constants20.GL.UNSIGNED_INT_SAMPLER_2D,
4823
+ import_constants20.GL.UNSIGNED_INT_SAMPLER_3D,
4824
+ import_constants20.GL.UNSIGNED_INT_SAMPLER_CUBE,
4825
+ import_constants20.GL.UNSIGNED_INT_SAMPLER_2D_ARRAY
4853
4826
  ];
4854
4827
  var COMPOSITE_GL_TYPES = {
4855
- [import_constants20.default.FLOAT]: [import_constants20.default.FLOAT, 1, "float", "f32", "float32"],
4856
- [import_constants20.default.FLOAT_VEC2]: [import_constants20.default.FLOAT, 2, "vec2", "vec2<f32>", "float32x2"],
4857
- [import_constants20.default.FLOAT_VEC3]: [import_constants20.default.FLOAT, 3, "vec3", "vec3<f32>", "float32x3"],
4858
- [import_constants20.default.FLOAT_VEC4]: [import_constants20.default.FLOAT, 4, "vec4", "vec4<f32>", "float32x4"],
4859
- [import_constants20.default.INT]: [import_constants20.default.INT, 1, "int", "i32", "sint32"],
4860
- [import_constants20.default.INT_VEC2]: [import_constants20.default.INT, 2, "ivec2", "vec2<i32>", "sint32x2"],
4861
- [import_constants20.default.INT_VEC3]: [import_constants20.default.INT, 3, "ivec3", "vec3<i32>", "sint32x3"],
4862
- [import_constants20.default.INT_VEC4]: [import_constants20.default.INT, 4, "ivec4", "vec4<i32>", "sint32x4"],
4863
- [import_constants20.default.UNSIGNED_INT]: [import_constants20.default.UNSIGNED_INT, 1, "uint", "u32", "uint32"],
4864
- [import_constants20.default.UNSIGNED_INT_VEC2]: [import_constants20.default.UNSIGNED_INT, 2, "uvec2", "vec2<u32>", "uint32x2"],
4865
- [import_constants20.default.UNSIGNED_INT_VEC3]: [import_constants20.default.UNSIGNED_INT, 3, "uvec3", "vec3<u32>", "uint32x3"],
4866
- [import_constants20.default.UNSIGNED_INT_VEC4]: [import_constants20.default.UNSIGNED_INT, 4, "uvec4", "vec4<u32>", "uint32x4"],
4867
- [import_constants20.default.BOOL]: [import_constants20.default.FLOAT, 1, "bool", "f32", "float32x2"],
4868
- [import_constants20.default.BOOL_VEC2]: [import_constants20.default.FLOAT, 2, "bvec2", "vec2<f32>"],
4869
- [import_constants20.default.BOOL_VEC3]: [import_constants20.default.FLOAT, 3, "bvec3", "vec3<f32>"],
4870
- [import_constants20.default.BOOL_VEC4]: [import_constants20.default.FLOAT, 4, "bvec4", "vec4<f32>"],
4871
- [import_constants20.default.FLOAT_MAT2]: [import_constants20.default.FLOAT, 8, "mat2", "mat2x2<f32>"],
4828
+ [import_constants20.GL.FLOAT]: [import_constants20.GL.FLOAT, 1, "float", "f32", "float32"],
4829
+ [import_constants20.GL.FLOAT_VEC2]: [import_constants20.GL.FLOAT, 2, "vec2", "vec2<f32>", "float32x2"],
4830
+ [import_constants20.GL.FLOAT_VEC3]: [import_constants20.GL.FLOAT, 3, "vec3", "vec3<f32>", "float32x3"],
4831
+ [import_constants20.GL.FLOAT_VEC4]: [import_constants20.GL.FLOAT, 4, "vec4", "vec4<f32>", "float32x4"],
4832
+ [import_constants20.GL.INT]: [import_constants20.GL.INT, 1, "int", "i32", "sint32"],
4833
+ [import_constants20.GL.INT_VEC2]: [import_constants20.GL.INT, 2, "ivec2", "vec2<i32>", "sint32x2"],
4834
+ [import_constants20.GL.INT_VEC3]: [import_constants20.GL.INT, 3, "ivec3", "vec3<i32>", "sint32x3"],
4835
+ [import_constants20.GL.INT_VEC4]: [import_constants20.GL.INT, 4, "ivec4", "vec4<i32>", "sint32x4"],
4836
+ [import_constants20.GL.UNSIGNED_INT]: [import_constants20.GL.UNSIGNED_INT, 1, "uint", "u32", "uint32"],
4837
+ [import_constants20.GL.UNSIGNED_INT_VEC2]: [import_constants20.GL.UNSIGNED_INT, 2, "uvec2", "vec2<u32>", "uint32x2"],
4838
+ [import_constants20.GL.UNSIGNED_INT_VEC3]: [import_constants20.GL.UNSIGNED_INT, 3, "uvec3", "vec3<u32>", "uint32x3"],
4839
+ [import_constants20.GL.UNSIGNED_INT_VEC4]: [import_constants20.GL.UNSIGNED_INT, 4, "uvec4", "vec4<u32>", "uint32x4"],
4840
+ [import_constants20.GL.BOOL]: [import_constants20.GL.FLOAT, 1, "bool", "f32", "float32x2"],
4841
+ [import_constants20.GL.BOOL_VEC2]: [import_constants20.GL.FLOAT, 2, "bvec2", "vec2<f32>"],
4842
+ [import_constants20.GL.BOOL_VEC3]: [import_constants20.GL.FLOAT, 3, "bvec3", "vec3<f32>"],
4843
+ [import_constants20.GL.BOOL_VEC4]: [import_constants20.GL.FLOAT, 4, "bvec4", "vec4<f32>"],
4844
+ [import_constants20.GL.FLOAT_MAT2]: [import_constants20.GL.FLOAT, 8, "mat2", "mat2x2<f32>"],
4872
4845
  // 4
4873
- [import_constants20.default.FLOAT_MAT2x3]: [import_constants20.default.FLOAT, 8, "mat2x3", "mat2x3<f32>"],
4846
+ [import_constants20.GL.FLOAT_MAT2x3]: [import_constants20.GL.FLOAT, 8, "mat2x3", "mat2x3<f32>"],
4874
4847
  // 6
4875
- [import_constants20.default.FLOAT_MAT2x4]: [import_constants20.default.FLOAT, 8, "mat2x4", "mat2x4<f32>"],
4848
+ [import_constants20.GL.FLOAT_MAT2x4]: [import_constants20.GL.FLOAT, 8, "mat2x4", "mat2x4<f32>"],
4876
4849
  // 8
4877
- [import_constants20.default.FLOAT_MAT3x2]: [import_constants20.default.FLOAT, 12, "mat3x2", "mat3x2<f32>"],
4850
+ [import_constants20.GL.FLOAT_MAT3x2]: [import_constants20.GL.FLOAT, 12, "mat3x2", "mat3x2<f32>"],
4878
4851
  // 6
4879
- [import_constants20.default.FLOAT_MAT3]: [import_constants20.default.FLOAT, 12, "mat3", "mat3x3<f32>"],
4852
+ [import_constants20.GL.FLOAT_MAT3]: [import_constants20.GL.FLOAT, 12, "mat3", "mat3x3<f32>"],
4880
4853
  // 9
4881
- [import_constants20.default.FLOAT_MAT3x4]: [import_constants20.default.FLOAT, 12, "mat3x4", "mat3x4<f32>"],
4854
+ [import_constants20.GL.FLOAT_MAT3x4]: [import_constants20.GL.FLOAT, 12, "mat3x4", "mat3x4<f32>"],
4882
4855
  // 12
4883
- [import_constants20.default.FLOAT_MAT4x2]: [import_constants20.default.FLOAT, 16, "mat4x2", "mat4x2<f32>"],
4856
+ [import_constants20.GL.FLOAT_MAT4x2]: [import_constants20.GL.FLOAT, 16, "mat4x2", "mat4x2<f32>"],
4884
4857
  // 8
4885
- [import_constants20.default.FLOAT_MAT4x3]: [import_constants20.default.FLOAT, 16, "mat4x3", "mat4x3<f32>"],
4858
+ [import_constants20.GL.FLOAT_MAT4x3]: [import_constants20.GL.FLOAT, 16, "mat4x3", "mat4x3<f32>"],
4886
4859
  // 12
4887
- [import_constants20.default.FLOAT_MAT4]: [import_constants20.default.FLOAT, 16, "mat4", "mat4x4<f32>"]
4860
+ [import_constants20.GL.FLOAT_MAT4]: [import_constants20.GL.FLOAT, 16, "mat4", "mat4x4<f32>"]
4888
4861
  // 16
4889
4862
  };
4890
4863
  function decodeUniformType(uniformType) {
@@ -5437,7 +5410,7 @@ var WEBGLRenderPipeline = class extends import_api23.RenderPipeline {
5437
5410
  draw(options) {
5438
5411
  var _a;
5439
5412
  const {
5440
- renderPass = this.device.getDefaultRenderPass(),
5413
+ renderPass,
5441
5414
  vertexCount,
5442
5415
  // indexCount,
5443
5416
  instanceCount,
@@ -5462,8 +5435,9 @@ var WEBGLRenderPipeline = class extends import_api23.RenderPipeline {
5462
5435
  }
5463
5436
  this._applyBindings();
5464
5437
  this._applyUniforms();
5438
+ const webglRenderPass = renderPass;
5465
5439
  withDeviceParameters(this.device, this.props.parameters, () => {
5466
- withGLParameters(this.device, { framebuffer: renderPass.props.framebuffer }, () => {
5440
+ withGLParameters(this.device, webglRenderPass.glParameters, () => {
5467
5441
  var _a2, _b;
5468
5442
  if (isIndexed && isInstanced) {
5469
5443
  (_a2 = this.device.gl2) == null ? void 0 : _a2.drawElementsInstanced(
@@ -5635,15 +5609,258 @@ function getAttributeLayout(layout, name) {
5635
5609
  return layout.attributes.find((binding) => binding.name === name) || null;
5636
5610
  }
5637
5611
 
5612
+ // src/adapter/resources/webgl-command-encoder.ts
5613
+ var import_api25 = require("@luma.gl/api");
5614
+
5615
+ // src/adapter/resources/webgl-command-buffer.ts
5616
+ var import_api24 = require("@luma.gl/api");
5617
+ var import_constants26 = __toESM(require("@luma.gl/constants"), 1);
5618
+ function cast3(value) {
5619
+ return value;
5620
+ }
5621
+ var WEBGLCommandBuffer = class extends import_api24.CommandBuffer {
5622
+ constructor(device) {
5623
+ super({});
5624
+ this.commands = [];
5625
+ this.device = device;
5626
+ }
5627
+ submitCommands(commands = this.commands) {
5628
+ for (const command of commands) {
5629
+ switch (command.name) {
5630
+ case "copy-buffer-to-buffer":
5631
+ _copyBufferToBuffer(this.device, command.options);
5632
+ break;
5633
+ case "copy-buffer-to-texture":
5634
+ _copyBufferToTexture(this.device, command.options);
5635
+ break;
5636
+ case "copy-texture-to-buffer":
5637
+ _copyTextureToBuffer(this.device, command.options);
5638
+ break;
5639
+ case "copy-texture-to-texture":
5640
+ _copyTextureToTexture(this.device, command.options);
5641
+ break;
5642
+ }
5643
+ }
5644
+ }
5645
+ };
5646
+ function _copyBufferToBuffer(device, options) {
5647
+ var _a, _b;
5648
+ const source = cast3(options.source);
5649
+ const destination = cast3(options.destination);
5650
+ const gl2 = device.assertWebGL2();
5651
+ if (gl2) {
5652
+ gl2.bindBuffer(import_constants26.default.COPY_READ_BUFFER, source.handle);
5653
+ gl2.bindBuffer(import_constants26.default.COPY_WRITE_BUFFER, destination.handle);
5654
+ gl2.copyBufferSubData(
5655
+ import_constants26.default.COPY_READ_BUFFER,
5656
+ import_constants26.default.COPY_WRITE_BUFFER,
5657
+ (_a = options.sourceOffset) != null ? _a : 0,
5658
+ (_b = options.destinationOffset) != null ? _b : 0,
5659
+ options.size
5660
+ );
5661
+ gl2.bindBuffer(import_constants26.default.COPY_READ_BUFFER, null);
5662
+ gl2.bindBuffer(import_constants26.default.COPY_WRITE_BUFFER, null);
5663
+ } else {
5664
+ throw new Error("copyBufferToBuffer not implemented in WebGL1");
5665
+ }
5666
+ }
5667
+ function _copyBufferToTexture(device, options) {
5668
+ throw new Error("Not implemented");
5669
+ }
5670
+ function _copyTextureToBuffer(device, options) {
5671
+ const {
5672
+ /** Texture to copy to/from. */
5673
+ source,
5674
+ /** Mip-map level of the texture to copy to/from. (Default 0) */
5675
+ mipLevel = 0,
5676
+ /** Defines which aspects of the texture to copy to/from. */
5677
+ aspect = "all",
5678
+ /** Width to copy */
5679
+ width = options.source.width,
5680
+ /** Height to copy */
5681
+ height = options.source.height,
5682
+ depthOrArrayLayers = 0,
5683
+ /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */
5684
+ origin = [0, 0],
5685
+ /** Destination buffer */
5686
+ destination,
5687
+ /** Offset, in bytes, from the beginning of the buffer to the start of the image data (default 0) */
5688
+ byteOffset = 0,
5689
+ /**
5690
+ * The stride, in bytes, between the beginning of each block row and the subsequent block row.
5691
+ * Required if there are multiple block rows (i.e. the copy height or depth is more than one block).
5692
+ */
5693
+ bytesPerRow,
5694
+ /**
5695
+ * Number of block rows per single image of the texture.
5696
+ * rowsPerImage &times; bytesPerRow is the stride, in bytes, between the beginning of each image of data and the subsequent image.
5697
+ * Required if there are multiple images (i.e. the copy depth is more than one).
5698
+ */
5699
+ rowsPerImage
5700
+ } = options;
5701
+ if (aspect !== "all") {
5702
+ throw new Error("not supported");
5703
+ }
5704
+ if (mipLevel !== 0 || depthOrArrayLayers !== void 0 || bytesPerRow || rowsPerImage) {
5705
+ throw new Error("not implemented");
5706
+ }
5707
+ const gl2 = device.assertWebGL2();
5708
+ const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
5709
+ try {
5710
+ const webglBuffer = destination;
5711
+ const sourceWidth = width || framebuffer.width;
5712
+ const sourceHeight = height || framebuffer.height;
5713
+ const sourceFormat = import_constants26.default.RGBA;
5714
+ const sourceType = import_constants26.default.UNSIGNED_BYTE;
5715
+ gl2.bindBuffer(import_constants26.default.PIXEL_PACK_BUFFER, webglBuffer.handle);
5716
+ gl2.bindFramebuffer(import_constants26.default.FRAMEBUFFER, framebuffer.handle);
5717
+ gl2.readPixels(
5718
+ origin[0],
5719
+ origin[1],
5720
+ sourceWidth,
5721
+ sourceHeight,
5722
+ sourceFormat,
5723
+ sourceType,
5724
+ byteOffset
5725
+ );
5726
+ } finally {
5727
+ gl2.bindBuffer(import_constants26.default.PIXEL_PACK_BUFFER, null);
5728
+ gl2.bindFramebuffer(import_constants26.default.FRAMEBUFFER, null);
5729
+ if (destroyFramebuffer) {
5730
+ framebuffer.destroy();
5731
+ }
5732
+ }
5733
+ }
5734
+ function _copyTextureToTexture(device, options) {
5735
+ const {
5736
+ /** Texture to copy to/from. */
5737
+ source,
5738
+ /** Mip-map level of the texture to copy to/from. (Default 0) */
5739
+ // mipLevel = 0,
5740
+ /** Defines which aspects of the texture to copy to/from. */
5741
+ // aspect = 'all',
5742
+ /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */
5743
+ origin = [0, 0],
5744
+ /** Texture to copy to/from. */
5745
+ destination
5746
+ /** Mip-map level of the texture to copy to/from. (Default 0) */
5747
+ // destinationMipLevel = options.mipLevel,
5748
+ /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */
5749
+ // destinationOrigin = [0, 0],
5750
+ /** Defines which aspects of the texture to copy to/from. */
5751
+ // destinationAspect = options.aspect,
5752
+ } = options;
5753
+ let {
5754
+ width = options.destination.width,
5755
+ height = options.destination.width
5756
+ // depthOrArrayLayers = 0
5757
+ } = options;
5758
+ const destinationMipmaplevel = 0;
5759
+ const destinationInternalFormat = import_constants26.default.RGBA;
5760
+ const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
5761
+ const [sourceX, sourceY] = origin;
5762
+ const isSubCopy = false;
5763
+ device.gl.bindFramebuffer(import_constants26.default.FRAMEBUFFER, framebuffer.handle);
5764
+ let texture = null;
5765
+ let textureTarget;
5766
+ if (destination instanceof WEBGLTexture) {
5767
+ texture = destination;
5768
+ width = Number.isFinite(width) ? width : texture.width;
5769
+ height = Number.isFinite(height) ? height : texture.height;
5770
+ texture.bind(0);
5771
+ textureTarget = texture.destination;
5772
+ } else {
5773
+ throw new Error("whoops");
5774
+ }
5775
+ if (!isSubCopy) {
5776
+ device.gl.copyTexImage2D(
5777
+ textureTarget,
5778
+ destinationMipmaplevel,
5779
+ destinationInternalFormat,
5780
+ sourceX,
5781
+ sourceY,
5782
+ width,
5783
+ height,
5784
+ 0
5785
+ /* border must be 0 */
5786
+ );
5787
+ } else {
5788
+ }
5789
+ if (texture) {
5790
+ texture.unbind();
5791
+ }
5792
+ device.gl.bindFramebuffer(import_constants26.default.FRAMEBUFFER, prevHandle || null);
5793
+ if (destroyFramebuffer) {
5794
+ framebuffer.destroy();
5795
+ }
5796
+ return texture;
5797
+ }
5798
+ function getFramebuffer(source) {
5799
+ if (source instanceof import_api24.Texture) {
5800
+ const { width, height, id } = source;
5801
+ const framebuffer = source.device.createFramebuffer({
5802
+ id: `framebuffer-for-${id}`,
5803
+ width,
5804
+ height,
5805
+ colorAttachments: [source]
5806
+ });
5807
+ return { framebuffer, destroyFramebuffer: true };
5808
+ }
5809
+ return { framebuffer: source, destroyFramebuffer: false };
5810
+ }
5811
+
5812
+ // src/adapter/resources/webgl-command-encoder.ts
5813
+ var WEBGLCommandEncoder = class extends import_api25.CommandEncoder {
5814
+ constructor(device, props) {
5815
+ super(props);
5816
+ this.device = device;
5817
+ this.commandBuffer = new WEBGLCommandBuffer(device);
5818
+ }
5819
+ destroy() {
5820
+ }
5821
+ finish() {
5822
+ this.commandBuffer.submitCommands();
5823
+ }
5824
+ // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;
5825
+ // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;
5826
+ // finish(options?: {id?: string}): GPUCommandBuffer;
5827
+ copyBufferToBuffer(options) {
5828
+ this.commandBuffer.commands.push({ name: "copy-buffer-to-buffer", options });
5829
+ }
5830
+ copyBufferToTexture(options) {
5831
+ this.commandBuffer.commands.push({ name: "copy-buffer-to-texture", options });
5832
+ }
5833
+ copyTextureToBuffer(options) {
5834
+ this.commandBuffer.commands.push({ name: "copy-texture-to-buffer", options });
5835
+ }
5836
+ copyTextureToTexture(options) {
5837
+ this.commandBuffer.commands.push({ name: "copy-texture-to-texture", options });
5838
+ }
5839
+ pushDebugGroup(groupLabel) {
5840
+ }
5841
+ popDebugGroup() {
5842
+ }
5843
+ insertDebugMarker(markerLabel) {
5844
+ }
5845
+ // writeTimestamp(querySet: Query, queryIndex: number): void {}
5846
+ // resolveQuerySet(options: {
5847
+ // querySet: GPUQuerySet,
5848
+ // firstQuery: number,
5849
+ // queryCount: number,
5850
+ // destination: Buffer,
5851
+ // destinationOffset?: number;
5852
+ // }): void;
5853
+ };
5854
+
5638
5855
  // src/adapter/webgl-device.ts
5639
5856
  var LOG_LEVEL2 = 1;
5640
- var _WebGLDevice = class extends import_api24.Device {
5857
+ var _WebGLDevice = class extends import_api26.Device {
5641
5858
  //
5642
5859
  // Public API
5643
5860
  //
5644
5861
  constructor(props) {
5645
5862
  var _a;
5646
- super(__spreadProps(__spreadValues({}, props), { id: props.id || (0, import_api24.uid)("webgl-device") }));
5863
+ super(__spreadProps(__spreadValues({}, props), { id: props.id || (0, import_api26.uid)("webgl-device") }));
5647
5864
  this.renderPass = null;
5648
5865
  /** WebGL2 typed context. Need to check isWebGL2 or isWebGL1 before using. */
5649
5866
  this.gl2 = null;
@@ -5687,22 +5904,22 @@ var _WebGLDevice = class extends import_api24.Device {
5687
5904
  trackContextState(this.gl, {
5688
5905
  enable: enable2,
5689
5906
  copyState,
5690
- log: (...args) => import_api24.log.log(1, ...args)()
5907
+ log: (...args) => import_api26.log.log(1, ...args)()
5691
5908
  });
5692
5909
  if ((0, import_env2.isBrowser)() && props.debug) {
5693
5910
  this.gl = makeDebugContext(this.gl, __spreadProps(__spreadValues({}, props), { webgl2: this.isWebGL2, throwOnError: true }));
5694
5911
  this.gl2 = this.gl;
5695
5912
  this.debug = true;
5696
- import_api24.log.level = Math.max(import_api24.log.level, 1);
5697
- import_api24.log.warn("WebGL debug mode activated. Performance reduced.")();
5913
+ import_api26.log.level = Math.max(import_api26.log.level, 1);
5914
+ import_api26.log.warn("WebGL debug mode activated. Performance reduced.")();
5698
5915
  }
5699
5916
  if ((0, import_env2.isBrowser)() && props.spector) {
5700
5917
  const canvas = this.handle.canvas || props.canvas;
5701
5918
  this.spector = initializeSpectorJS(__spreadProps(__spreadValues({}, this.props), { canvas }));
5702
5919
  }
5703
5920
  const message2 = `Created ${this.info.type}${this.debug ? " debug" : ""} context: ${this.info.vendor}, ${this.info.renderer} for canvas: ${this.canvasContext.id}`;
5704
- import_api24.log.probe(LOG_LEVEL2, message2)();
5705
- import_api24.log.groupEnd(LOG_LEVEL2)();
5921
+ import_api26.log.probe(LOG_LEVEL2, message2)();
5922
+ import_api26.log.groupEnd(LOG_LEVEL2)();
5706
5923
  }
5707
5924
  static isSupported() {
5708
5925
  return typeof WebGLRenderingContext !== "undefined" || isHeadlessGLRegistered();
@@ -5728,7 +5945,7 @@ var _WebGLDevice = class extends import_api24.Device {
5728
5945
  if (gl instanceof _WebGLDevice) {
5729
5946
  return gl;
5730
5947
  }
5731
- if ((gl == null ? void 0 : gl.device) instanceof import_api24.Device) {
5948
+ if ((gl == null ? void 0 : gl.device) instanceof import_api26.Device) {
5732
5949
  return gl.device;
5733
5950
  }
5734
5951
  if (!isWebGL3(gl)) {
@@ -5738,9 +5955,9 @@ var _WebGLDevice = class extends import_api24.Device {
5738
5955
  }
5739
5956
  static create() {
5740
5957
  return __async(this, arguments, function* (props = {}) {
5741
- import_api24.log.groupCollapsed(LOG_LEVEL2, "WebGLDevice created");
5958
+ import_api26.log.groupCollapsed(LOG_LEVEL2, "WebGLDevice created");
5742
5959
  if (typeof props.canvas === "string") {
5743
- yield import_api24.CanvasContext.pageLoaded;
5960
+ yield import_api26.CanvasContext.pageLoaded;
5744
5961
  }
5745
5962
  if (props.debug) {
5746
5963
  yield loadWebGLDeveloperTools();
@@ -5748,7 +5965,7 @@ var _WebGLDevice = class extends import_api24.Device {
5748
5965
  if (props.spector) {
5749
5966
  yield loadSpectorJS();
5750
5967
  }
5751
- import_api24.log.probe(LOG_LEVEL2 + 1, "DOM is loaded")();
5968
+ import_api26.log.probe(LOG_LEVEL2 + 1, "DOM is loaded")();
5752
5969
  if (props.gl && props.gl.device) {
5753
5970
  return _WebGLDevice.attach(props.gl);
5754
5971
  }
@@ -5792,8 +6009,9 @@ var _WebGLDevice = class extends import_api24.Device {
5792
6009
  createCanvasContext(props) {
5793
6010
  throw new Error("WebGL only supports a single canvas");
5794
6011
  }
5795
- _createBuffer(props) {
5796
- return new ClassicBuffer(this, props);
6012
+ createBuffer(props) {
6013
+ const newProps = this._getBufferProps(props);
6014
+ return new ClassicBuffer(this, newProps);
5797
6015
  }
5798
6016
  _createTexture(props) {
5799
6017
  return new WEBGLTexture(this, props);
@@ -5828,6 +6046,9 @@ var _WebGLDevice = class extends import_api24.Device {
5828
6046
  });
5829
6047
  return this.renderPass;
5830
6048
  }
6049
+ createCommandEncoder(props) {
6050
+ return new WEBGLCommandEncoder(this, props);
6051
+ }
5831
6052
  /**
5832
6053
  * Offscreen Canvas Support: Commit the frame
5833
6054
  * https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/commit
@@ -5844,20 +6065,22 @@ var _WebGLDevice = class extends import_api24.Device {
5844
6065
  return this._webglLimits;
5845
6066
  }
5846
6067
  /**
5847
- * Loses the context
5848
- * @note Triggers context loss, mainly for testing
5849
- * @todo Promote to `Device` API?
6068
+ * Triggers device (or WebGL context) loss.
6069
+ * @note primarily intended for testing how application reacts to device loss
5850
6070
  */
5851
6071
  loseDevice() {
5852
6072
  var _a;
6073
+ let deviceLossTriggered = false;
5853
6074
  const ext = this.gl.getExtension("WEBGL_lose_context");
5854
6075
  if (ext) {
6076
+ deviceLossTriggered = true;
5855
6077
  ext.loseContext();
5856
6078
  }
5857
6079
  (_a = this._resolveContextLost) == null ? void 0 : _a.call(this, {
5858
6080
  reason: "destroyed",
5859
6081
  message: "Application triggered context loss"
5860
6082
  });
6083
+ return deviceLossTriggered;
5861
6084
  }
5862
6085
  /** Save current WebGL context state onto an internal stack */
5863
6086
  pushState() {
@@ -5874,6 +6097,21 @@ var _WebGLDevice = class extends import_api24.Device {
5874
6097
  setSpectorMetadata(handle, props) {
5875
6098
  handle.__SPECTOR_Metadata = props;
5876
6099
  }
6100
+ /**
6101
+ * Returns the GL.<KEY> constant that corresponds to a numeric value of a GL constant
6102
+ * Be aware that there are some duplicates especially for constants that are 0,
6103
+ * so this isn't guaranteed to return the right key in all cases.
6104
+ */
6105
+ getGLKey(value, gl) {
6106
+ gl = gl || this.gl2 || this.gl;
6107
+ const number = Number(value);
6108
+ for (const key in gl) {
6109
+ if (gl[key] === number) {
6110
+ return `GL.${key}`;
6111
+ }
6112
+ }
6113
+ return String(value);
6114
+ }
5877
6115
  };
5878
6116
  var WebGLDevice = _WebGLDevice;
5879
6117
  //
@@ -5895,54 +6133,3 @@ function isWebGL22(gl) {
5895
6133
  }
5896
6134
  return Boolean(gl && gl._version === 2);
5897
6135
  }
5898
-
5899
- // src/adapter/resources/webgl-command-encoder.ts
5900
- var import_api25 = require("@luma.gl/api");
5901
-
5902
- // src/adapter/resources/webgl-command-buffer.ts
5903
- var import_constants26 = __toESM(require("@luma.gl/constants"), 1);
5904
- var CommandBuffer = class {
5905
- constructor() {
5906
- this.commands = [];
5907
- }
5908
- };
5909
-
5910
- // src/adapter/resources/webgl-command-encoder.ts
5911
- var WEBGLCommandEncoder = class extends import_api25.CommandEncoder {
5912
- constructor(device, props) {
5913
- super(props);
5914
- this.commandBuffer = new CommandBuffer();
5915
- this.device = device;
5916
- }
5917
- destroy() {
5918
- }
5919
- // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;
5920
- // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;
5921
- // finish(options?: {id?: string}): GPUCommandBuffer;
5922
- copyBufferToBuffer(options) {
5923
- this.commandBuffer.commands.push({ name: "copy-buffer-to-buffer", options });
5924
- }
5925
- copyBufferToTexture(options) {
5926
- this.commandBuffer.commands.push({ name: "copy-buffer-to-texture", options });
5927
- }
5928
- copyTextureToBuffer(options) {
5929
- this.commandBuffer.commands.push({ name: "copy-texture-to-buffer", options });
5930
- }
5931
- copyTextureToTexture(options) {
5932
- this.commandBuffer.commands.push({ name: "copy-texture-to-texture", options });
5933
- }
5934
- pushDebugGroup(groupLabel) {
5935
- }
5936
- popDebugGroup() {
5937
- }
5938
- insertDebugMarker(markerLabel) {
5939
- }
5940
- // writeTimestamp(querySet: Query, queryIndex: number): void {}
5941
- // resolveQuerySet(options: {
5942
- // querySet: GPUQuerySet,
5943
- // firstQuery: number,
5944
- // queryCount: number,
5945
- // destination: Buffer,
5946
- // destinationOffset?: number;
5947
- // }): void;
5948
- };