@luma.gl/webgl 9.0.0-beta.6 → 9.0.0-beta.8

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 (97) hide show
  1. package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
  2. package/dist/adapter/converters/device-parameters.js +81 -84
  3. package/dist/adapter/converters/sampler-parameters.js +17 -17
  4. package/dist/adapter/converters/shader-formats.js +12 -12
  5. package/dist/adapter/converters/texture-formats.d.ts +10 -8
  6. package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
  7. package/dist/adapter/converters/texture-formats.js +175 -168
  8. package/dist/adapter/converters/vertex-formats.js +20 -20
  9. package/dist/adapter/device-helpers/webgl-device-features.d.ts +2 -1
  10. package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -1
  11. package/dist/adapter/device-helpers/webgl-device-features.js +14 -2
  12. package/dist/adapter/device-helpers/webgl-device-info.js +5 -5
  13. package/dist/adapter/device-helpers/webgl-device-limits.js +10 -10
  14. package/dist/adapter/helpers/decode-webgl-types.js +45 -45
  15. package/dist/adapter/helpers/get-shader-layout.js +29 -29
  16. package/dist/adapter/helpers/set-uniform.js +40 -40
  17. package/dist/adapter/helpers/webgl-topology-utils.js +38 -38
  18. package/dist/adapter/objects/webgl-renderbuffer.js +6 -6
  19. package/dist/adapter/objects/webgl-resource.js +1 -2
  20. package/dist/adapter/resources/webgl-buffer.js +14 -14
  21. package/dist/adapter/resources/webgl-command-buffer.js +25 -25
  22. package/dist/adapter/resources/webgl-external-texture.js +3 -3
  23. package/dist/adapter/resources/webgl-framebuffer.d.ts +2 -4
  24. package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
  25. package/dist/adapter/resources/webgl-framebuffer.js +41 -36
  26. package/dist/adapter/resources/webgl-query-set.js +6 -6
  27. package/dist/adapter/resources/webgl-render-pass.js +5 -5
  28. package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
  29. package/dist/adapter/resources/webgl-render-pipeline.js +19 -13
  30. package/dist/adapter/resources/webgl-sampler.js +2 -2
  31. package/dist/adapter/resources/webgl-shader.js +4 -4
  32. package/dist/adapter/resources/webgl-texture.d.ts +2 -1
  33. package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
  34. package/dist/adapter/resources/webgl-texture.js +29 -27
  35. package/dist/adapter/resources/webgl-transform-feedback.js +8 -8
  36. package/dist/adapter/resources/webgl-vertex-array.d.ts +1 -1
  37. package/dist/adapter/resources/webgl-vertex-array.js +5 -5
  38. package/dist/adapter/webgl-device.d.ts +6 -3
  39. package/dist/adapter/webgl-device.d.ts.map +1 -1
  40. package/dist/adapter/webgl-device.js +22 -17
  41. package/dist/classic/accessor.js +4 -4
  42. package/dist/classic/clear.js +2 -2
  43. package/dist/classic/copy-and-blit.js +15 -16
  44. package/dist/classic/format-utils.d.ts +2 -2
  45. package/dist/classic/format-utils.js +14 -14
  46. package/dist/classic/typed-array-utils.js +18 -18
  47. package/dist/context/parameters/unified-parameter-api.d.ts +3 -4
  48. package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
  49. package/dist/context/parameters/unified-parameter-api.js +4 -9
  50. package/dist/context/parameters/webgl-parameter-tables.d.ts +2 -13
  51. package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
  52. package/dist/context/parameters/webgl-parameter-tables.js +292 -298
  53. package/dist/context/state-tracker/with-parameters.d.ts +1 -2
  54. package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
  55. package/dist/context/state-tracker/with-parameters.js +2 -5
  56. package/dist/dist.dev.js +3796 -5522
  57. package/dist/dist.min.js +10 -0
  58. package/dist/index.cjs +1253 -1188
  59. package/dist/index.cjs.map +4 -4
  60. package/dist/index.d.ts +2 -2
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +1 -1
  63. package/package.json +6 -7
  64. package/src/.DS_Store +0 -0
  65. package/src/adapter/.DS_Store +0 -0
  66. package/src/adapter/converters/device-parameters.ts +9 -11
  67. package/src/adapter/converters/texture-formats.ts +64 -61
  68. package/src/adapter/device-helpers/webgl-device-features.ts +22 -2
  69. package/src/adapter/objects/webgl-renderbuffer.ts +1 -1
  70. package/src/adapter/objects/webgl-resource.ts +1 -1
  71. package/src/adapter/resources/webgl-external-texture.ts +3 -3
  72. package/src/adapter/resources/webgl-framebuffer.ts +29 -26
  73. package/src/adapter/resources/webgl-render-pass.ts +3 -3
  74. package/src/adapter/resources/webgl-render-pipeline.ts +13 -6
  75. package/src/adapter/resources/webgl-texture.ts +7 -3
  76. package/src/adapter/webgl-device.ts +24 -19
  77. package/src/classic/clear.ts +2 -2
  78. package/src/context/.DS_Store +0 -0
  79. package/src/context/parameters/unified-parameter-api.ts +4 -16
  80. package/src/context/state-tracker/with-parameters.ts +2 -7
  81. package/src/index.ts +4 -4
  82. package/dist/adapter/device-helpers/device-features.d.ts +0 -6
  83. package/dist/adapter/device-helpers/device-features.d.ts.map +0 -1
  84. package/dist/adapter/device-helpers/device-features.js +0 -65
  85. package/dist/adapter/device-helpers/device-limits.d.ts +0 -50
  86. package/dist/adapter/device-helpers/device-limits.d.ts.map +0 -1
  87. package/dist/adapter/device-helpers/device-limits.js +0 -92
  88. package/dist/adapter/device-helpers/get-device-info.d.ts +0 -4
  89. package/dist/adapter/device-helpers/get-device-info.d.ts.map +0 -1
  90. package/dist/adapter/device-helpers/get-device-info.js +0 -87
  91. package/dist/context/context/context-data.d.ts +0 -14
  92. package/dist/context/context/context-data.d.ts.map +0 -1
  93. package/dist/context/context/context-data.js +0 -33
  94. package/dist/context/context/create-browser-context.d.ts +0 -35
  95. package/dist/context/context/create-browser-context.d.ts.map +0 -1
  96. package/dist/context/context/create-browser-context.js +0 -66
  97. package/dist.min.js +0 -19
package/dist/index.cjs CHANGED
@@ -30,7 +30,6 @@ __export(dist_exports, {
30
30
  WEBGLFramebuffer: () => WEBGLFramebuffer,
31
31
  WEBGLRenderPass: () => WEBGLRenderPass,
32
32
  WEBGLRenderPipeline: () => WEBGLRenderPipeline,
33
- WEBGLRenderbuffer: () => WEBGLRenderbuffer,
34
33
  WEBGLResource: () => WebGLResource,
35
34
  WEBGLSampler: () => WEBGLSampler,
36
35
  WEBGLShader: () => WEBGLShader,
@@ -41,6 +40,7 @@ __export(dist_exports, {
41
40
  WebGLDevice: () => WebGLDevice,
42
41
  WebGLResource: () => WebGLResource,
43
42
  _TEXTURE_FORMATS: () => TEXTURE_FORMATS,
43
+ _WEBGLRenderbuffer: () => WEBGLRenderbuffer,
44
44
  convertGLToTextureFormat: () => convertGLToTextureFormat,
45
45
  getGLParameters: () => getGLParameters,
46
46
  getShaderLayout: () => getShaderLayout,
@@ -56,7 +56,7 @@ __export(dist_exports, {
56
56
  module.exports = __toCommonJS(dist_exports);
57
57
 
58
58
  // dist/adapter/webgl-device.js
59
- var import_core29 = require("@luma.gl/core");
59
+ var import_core27 = require("@luma.gl/core");
60
60
 
61
61
  // dist/context/state-tracker/track-context-state.js
62
62
  var import_core = require("@luma.gl/core");
@@ -64,99 +64,99 @@ var import_core = require("@luma.gl/core");
64
64
  // dist/context/parameters/webgl-parameter-tables.js
65
65
  var import_constants = require("@luma.gl/constants");
66
66
  var GL_PARAMETER_DEFAULTS = {
67
- [import_constants.GL.BLEND]: false,
68
- [import_constants.GL.BLEND_COLOR]: new Float32Array([0, 0, 0, 0]),
69
- [import_constants.GL.BLEND_EQUATION_RGB]: import_constants.GL.FUNC_ADD,
70
- [import_constants.GL.BLEND_EQUATION_ALPHA]: import_constants.GL.FUNC_ADD,
71
- [import_constants.GL.BLEND_SRC_RGB]: import_constants.GL.ONE,
72
- [import_constants.GL.BLEND_DST_RGB]: import_constants.GL.ZERO,
73
- [import_constants.GL.BLEND_SRC_ALPHA]: import_constants.GL.ONE,
74
- [import_constants.GL.BLEND_DST_ALPHA]: import_constants.GL.ZERO,
75
- [import_constants.GL.COLOR_CLEAR_VALUE]: new Float32Array([0, 0, 0, 0]),
67
+ [3042]: false,
68
+ [32773]: new Float32Array([0, 0, 0, 0]),
69
+ [32777]: 32774,
70
+ [34877]: 32774,
71
+ [32969]: 1,
72
+ [32968]: 0,
73
+ [32971]: 1,
74
+ [32970]: 0,
75
+ [3106]: new Float32Array([0, 0, 0, 0]),
76
76
  // TBD
77
- [import_constants.GL.COLOR_WRITEMASK]: [true, true, true, true],
78
- [import_constants.GL.CULL_FACE]: false,
79
- [import_constants.GL.CULL_FACE_MODE]: import_constants.GL.BACK,
80
- [import_constants.GL.DEPTH_TEST]: false,
81
- [import_constants.GL.DEPTH_CLEAR_VALUE]: 1,
82
- [import_constants.GL.DEPTH_FUNC]: import_constants.GL.LESS,
83
- [import_constants.GL.DEPTH_RANGE]: new Float32Array([0, 1]),
77
+ [3107]: [true, true, true, true],
78
+ [2884]: false,
79
+ [2885]: 1029,
80
+ [2929]: false,
81
+ [2931]: 1,
82
+ [2932]: 513,
83
+ [2928]: new Float32Array([0, 1]),
84
84
  // TBD
85
- [import_constants.GL.DEPTH_WRITEMASK]: true,
86
- [import_constants.GL.DITHER]: true,
87
- [import_constants.GL.CURRENT_PROGRAM]: null,
85
+ [2930]: true,
86
+ [3024]: true,
87
+ [35725]: null,
88
88
  // FRAMEBUFFER_BINDING and DRAW_FRAMEBUFFER_BINDING(WebGL2) refer same state.
89
- [import_constants.GL.FRAMEBUFFER_BINDING]: null,
90
- [import_constants.GL.RENDERBUFFER_BINDING]: null,
91
- [import_constants.GL.VERTEX_ARRAY_BINDING]: null,
92
- [import_constants.GL.ARRAY_BUFFER_BINDING]: null,
93
- [import_constants.GL.FRONT_FACE]: import_constants.GL.CCW,
94
- [import_constants.GL.GENERATE_MIPMAP_HINT]: import_constants.GL.DONT_CARE,
95
- [import_constants.GL.LINE_WIDTH]: 1,
96
- [import_constants.GL.POLYGON_OFFSET_FILL]: false,
97
- [import_constants.GL.POLYGON_OFFSET_FACTOR]: 0,
98
- [import_constants.GL.POLYGON_OFFSET_UNITS]: 0,
99
- [import_constants.GL.SAMPLE_ALPHA_TO_COVERAGE]: false,
100
- [import_constants.GL.SAMPLE_COVERAGE]: false,
101
- [import_constants.GL.SAMPLE_COVERAGE_VALUE]: 1,
102
- [import_constants.GL.SAMPLE_COVERAGE_INVERT]: false,
103
- [import_constants.GL.SCISSOR_TEST]: false,
89
+ [36006]: null,
90
+ [36007]: null,
91
+ [34229]: null,
92
+ [34964]: null,
93
+ [2886]: 2305,
94
+ [33170]: 4352,
95
+ [2849]: 1,
96
+ [32823]: false,
97
+ [32824]: 0,
98
+ [10752]: 0,
99
+ [32926]: false,
100
+ [32928]: false,
101
+ [32938]: 1,
102
+ [32939]: false,
103
+ [3089]: false,
104
104
  // Note: Dynamic value. If scissor test enabled we expect users to set correct scissor box
105
- [import_constants.GL.SCISSOR_BOX]: new Int32Array([0, 0, 1024, 1024]),
106
- [import_constants.GL.STENCIL_TEST]: false,
107
- [import_constants.GL.STENCIL_CLEAR_VALUE]: 0,
108
- [import_constants.GL.STENCIL_WRITEMASK]: 4294967295,
109
- [import_constants.GL.STENCIL_BACK_WRITEMASK]: 4294967295,
110
- [import_constants.GL.STENCIL_FUNC]: import_constants.GL.ALWAYS,
111
- [import_constants.GL.STENCIL_REF]: 0,
112
- [import_constants.GL.STENCIL_VALUE_MASK]: 4294967295,
113
- [import_constants.GL.STENCIL_BACK_FUNC]: import_constants.GL.ALWAYS,
114
- [import_constants.GL.STENCIL_BACK_REF]: 0,
115
- [import_constants.GL.STENCIL_BACK_VALUE_MASK]: 4294967295,
116
- [import_constants.GL.STENCIL_FAIL]: import_constants.GL.KEEP,
117
- [import_constants.GL.STENCIL_PASS_DEPTH_FAIL]: import_constants.GL.KEEP,
118
- [import_constants.GL.STENCIL_PASS_DEPTH_PASS]: import_constants.GL.KEEP,
119
- [import_constants.GL.STENCIL_BACK_FAIL]: import_constants.GL.KEEP,
120
- [import_constants.GL.STENCIL_BACK_PASS_DEPTH_FAIL]: import_constants.GL.KEEP,
121
- [import_constants.GL.STENCIL_BACK_PASS_DEPTH_PASS]: import_constants.GL.KEEP,
105
+ [3088]: new Int32Array([0, 0, 1024, 1024]),
106
+ [2960]: false,
107
+ [2961]: 0,
108
+ [2968]: 4294967295,
109
+ [36005]: 4294967295,
110
+ [2962]: 519,
111
+ [2967]: 0,
112
+ [2963]: 4294967295,
113
+ [34816]: 519,
114
+ [36003]: 0,
115
+ [36004]: 4294967295,
116
+ [2964]: 7680,
117
+ [2965]: 7680,
118
+ [2966]: 7680,
119
+ [34817]: 7680,
120
+ [34818]: 7680,
121
+ [34819]: 7680,
122
122
  // Dynamic value: We use [0, 0, 1024, 1024] as default, but usually this is updated in each frame.
123
- [import_constants.GL.VIEWPORT]: [0, 0, 1024, 1024],
124
- [import_constants.GL.TRANSFORM_FEEDBACK_BINDING]: null,
125
- [import_constants.GL.COPY_READ_BUFFER_BINDING]: null,
126
- [import_constants.GL.COPY_WRITE_BUFFER_BINDING]: null,
127
- [import_constants.GL.PIXEL_PACK_BUFFER_BINDING]: null,
128
- [import_constants.GL.PIXEL_UNPACK_BUFFER_BINDING]: null,
129
- [import_constants.GL.FRAGMENT_SHADER_DERIVATIVE_HINT]: import_constants.GL.DONT_CARE,
130
- [import_constants.GL.READ_FRAMEBUFFER_BINDING]: null,
131
- [import_constants.GL.RASTERIZER_DISCARD]: false,
132
- [import_constants.GL.PACK_ALIGNMENT]: 4,
133
- [import_constants.GL.UNPACK_ALIGNMENT]: 4,
134
- [import_constants.GL.UNPACK_FLIP_Y_WEBGL]: false,
135
- [import_constants.GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL]: false,
136
- [import_constants.GL.UNPACK_COLORSPACE_CONVERSION_WEBGL]: import_constants.GL.BROWSER_DEFAULT_WEBGL,
137
- [import_constants.GL.PACK_ROW_LENGTH]: 0,
138
- [import_constants.GL.PACK_SKIP_PIXELS]: 0,
139
- [import_constants.GL.PACK_SKIP_ROWS]: 0,
140
- [import_constants.GL.UNPACK_ROW_LENGTH]: 0,
141
- [import_constants.GL.UNPACK_IMAGE_HEIGHT]: 0,
142
- [import_constants.GL.UNPACK_SKIP_PIXELS]: 0,
143
- [import_constants.GL.UNPACK_SKIP_ROWS]: 0,
144
- [import_constants.GL.UNPACK_SKIP_IMAGES]: 0
123
+ [2978]: [0, 0, 1024, 1024],
124
+ [36389]: null,
125
+ [36662]: null,
126
+ [36663]: null,
127
+ [35053]: null,
128
+ [35055]: null,
129
+ [35723]: 4352,
130
+ [36010]: null,
131
+ [35977]: false,
132
+ [3333]: 4,
133
+ [3317]: 4,
134
+ [37440]: false,
135
+ [37441]: false,
136
+ [37443]: 37444,
137
+ [3330]: 0,
138
+ [3332]: 0,
139
+ [3331]: 0,
140
+ [3314]: 0,
141
+ [32878]: 0,
142
+ [3316]: 0,
143
+ [3315]: 0,
144
+ [32877]: 0
145
145
  };
146
146
  var enable = (gl, value, key) => value ? gl.enable(key) : gl.disable(key);
147
147
  var hint = (gl, value, key) => gl.hint(key, value);
148
148
  var pixelStorei = (gl, value, key) => gl.pixelStorei(key, value);
149
149
  var bindFramebuffer = (gl, value, key) => {
150
- const target = key === import_constants.GL.FRAMEBUFFER_BINDING ? import_constants.GL.DRAW_FRAMEBUFFER : import_constants.GL.READ_FRAMEBUFFER;
150
+ const target = key === 36006 ? 36009 : 36008;
151
151
  return gl.bindFramebuffer(target, value);
152
152
  };
153
153
  var bindBuffer = (gl, value, key) => {
154
154
  const bindingMap = {
155
- [import_constants.GL.ARRAY_BUFFER_BINDING]: import_constants.GL.ARRAY_BUFFER,
156
- [import_constants.GL.COPY_READ_BUFFER_BINDING]: import_constants.GL.COPY_READ_BUFFER,
157
- [import_constants.GL.COPY_WRITE_BUFFER_BINDING]: import_constants.GL.COPY_WRITE_BUFFER,
158
- [import_constants.GL.PIXEL_PACK_BUFFER_BINDING]: import_constants.GL.PIXEL_PACK_BUFFER,
159
- [import_constants.GL.PIXEL_UNPACK_BUFFER_BINDING]: import_constants.GL.PIXEL_UNPACK_BUFFER
155
+ [34964]: 34962,
156
+ [36662]: 36662,
157
+ [36663]: 36663,
158
+ [35053]: 35051,
159
+ [35055]: 35052
160
160
  };
161
161
  const glTarget = bindingMap[key];
162
162
  gl.bindBuffer(glTarget, value);
@@ -165,108 +165,108 @@ function isArray(array) {
165
165
  return Array.isArray(array) || ArrayBuffer.isView(array) && !(array instanceof DataView);
166
166
  }
167
167
  var GL_PARAMETER_SETTERS = {
168
- [import_constants.GL.BLEND]: enable,
169
- [import_constants.GL.BLEND_COLOR]: (gl, value) => gl.blendColor(...value),
170
- [import_constants.GL.BLEND_EQUATION_RGB]: "blendEquation",
171
- [import_constants.GL.BLEND_EQUATION_ALPHA]: "blendEquation",
172
- [import_constants.GL.BLEND_SRC_RGB]: "blendFunc",
173
- [import_constants.GL.BLEND_DST_RGB]: "blendFunc",
174
- [import_constants.GL.BLEND_SRC_ALPHA]: "blendFunc",
175
- [import_constants.GL.BLEND_DST_ALPHA]: "blendFunc",
176
- [import_constants.GL.COLOR_CLEAR_VALUE]: (gl, value) => gl.clearColor(...value),
177
- [import_constants.GL.COLOR_WRITEMASK]: (gl, value) => gl.colorMask(...value),
178
- [import_constants.GL.CULL_FACE]: enable,
179
- [import_constants.GL.CULL_FACE_MODE]: (gl, value) => gl.cullFace(value),
180
- [import_constants.GL.DEPTH_TEST]: enable,
181
- [import_constants.GL.DEPTH_CLEAR_VALUE]: (gl, value) => gl.clearDepth(value),
182
- [import_constants.GL.DEPTH_FUNC]: (gl, value) => gl.depthFunc(value),
183
- [import_constants.GL.DEPTH_RANGE]: (gl, value) => gl.depthRange(...value),
184
- [import_constants.GL.DEPTH_WRITEMASK]: (gl, value) => gl.depthMask(value),
185
- [import_constants.GL.DITHER]: enable,
186
- [import_constants.GL.FRAGMENT_SHADER_DERIVATIVE_HINT]: hint,
187
- [import_constants.GL.CURRENT_PROGRAM]: (gl, value) => gl.useProgram(value),
188
- [import_constants.GL.RENDERBUFFER_BINDING]: (gl, value) => gl.bindRenderbuffer(import_constants.GL.RENDERBUFFER, value),
189
- [import_constants.GL.TRANSFORM_FEEDBACK_BINDING]: (gl, value) => {
168
+ [3042]: enable,
169
+ [32773]: (gl, value) => gl.blendColor(...value),
170
+ [32777]: "blendEquation",
171
+ [34877]: "blendEquation",
172
+ [32969]: "blendFunc",
173
+ [32968]: "blendFunc",
174
+ [32971]: "blendFunc",
175
+ [32970]: "blendFunc",
176
+ [3106]: (gl, value) => gl.clearColor(...value),
177
+ [3107]: (gl, value) => gl.colorMask(...value),
178
+ [2884]: enable,
179
+ [2885]: (gl, value) => gl.cullFace(value),
180
+ [2929]: enable,
181
+ [2931]: (gl, value) => gl.clearDepth(value),
182
+ [2932]: (gl, value) => gl.depthFunc(value),
183
+ [2928]: (gl, value) => gl.depthRange(...value),
184
+ [2930]: (gl, value) => gl.depthMask(value),
185
+ [3024]: enable,
186
+ [35723]: hint,
187
+ [35725]: (gl, value) => gl.useProgram(value),
188
+ [36007]: (gl, value) => gl.bindRenderbuffer(36161, value),
189
+ [36389]: (gl, value) => {
190
190
  var _a;
191
- return (_a = gl.bindTransformFeedback) == null ? void 0 : _a.call(gl, import_constants.GL.TRANSFORM_FEEDBACK, value);
191
+ return (_a = gl.bindTransformFeedback) == null ? void 0 : _a.call(gl, 36386, value);
192
192
  },
193
- [import_constants.GL.VERTEX_ARRAY_BINDING]: (gl, value) => gl.bindVertexArray(value),
193
+ [34229]: (gl, value) => gl.bindVertexArray(value),
194
194
  // NOTE: FRAMEBUFFER_BINDING and DRAW_FRAMEBUFFER_BINDING(WebGL2) refer same state.
195
- [import_constants.GL.FRAMEBUFFER_BINDING]: bindFramebuffer,
196
- [import_constants.GL.READ_FRAMEBUFFER_BINDING]: bindFramebuffer,
195
+ [36006]: bindFramebuffer,
196
+ [36010]: bindFramebuffer,
197
197
  // Buffers
198
- [import_constants.GL.ARRAY_BUFFER_BINDING]: bindBuffer,
199
- [import_constants.GL.COPY_READ_BUFFER_BINDING]: bindBuffer,
200
- [import_constants.GL.COPY_WRITE_BUFFER_BINDING]: bindBuffer,
201
- [import_constants.GL.PIXEL_PACK_BUFFER_BINDING]: bindBuffer,
202
- [import_constants.GL.PIXEL_UNPACK_BUFFER_BINDING]: bindBuffer,
203
- [import_constants.GL.FRONT_FACE]: (gl, value) => gl.frontFace(value),
204
- [import_constants.GL.GENERATE_MIPMAP_HINT]: hint,
205
- [import_constants.GL.LINE_WIDTH]: (gl, value) => gl.lineWidth(value),
206
- [import_constants.GL.POLYGON_OFFSET_FILL]: enable,
207
- [import_constants.GL.POLYGON_OFFSET_FACTOR]: "polygonOffset",
208
- [import_constants.GL.POLYGON_OFFSET_UNITS]: "polygonOffset",
209
- [import_constants.GL.RASTERIZER_DISCARD]: enable,
210
- [import_constants.GL.SAMPLE_ALPHA_TO_COVERAGE]: enable,
211
- [import_constants.GL.SAMPLE_COVERAGE]: enable,
212
- [import_constants.GL.SAMPLE_COVERAGE_VALUE]: "sampleCoverage",
213
- [import_constants.GL.SAMPLE_COVERAGE_INVERT]: "sampleCoverage",
214
- [import_constants.GL.SCISSOR_TEST]: enable,
215
- [import_constants.GL.SCISSOR_BOX]: (gl, value) => gl.scissor(...value),
216
- [import_constants.GL.STENCIL_TEST]: enable,
217
- [import_constants.GL.STENCIL_CLEAR_VALUE]: (gl, value) => gl.clearStencil(value),
218
- [import_constants.GL.STENCIL_WRITEMASK]: (gl, value) => gl.stencilMaskSeparate(import_constants.GL.FRONT, value),
219
- [import_constants.GL.STENCIL_BACK_WRITEMASK]: (gl, value) => gl.stencilMaskSeparate(import_constants.GL.BACK, value),
220
- [import_constants.GL.STENCIL_FUNC]: "stencilFuncFront",
221
- [import_constants.GL.STENCIL_REF]: "stencilFuncFront",
222
- [import_constants.GL.STENCIL_VALUE_MASK]: "stencilFuncFront",
223
- [import_constants.GL.STENCIL_BACK_FUNC]: "stencilFuncBack",
224
- [import_constants.GL.STENCIL_BACK_REF]: "stencilFuncBack",
225
- [import_constants.GL.STENCIL_BACK_VALUE_MASK]: "stencilFuncBack",
226
- [import_constants.GL.STENCIL_FAIL]: "stencilOpFront",
227
- [import_constants.GL.STENCIL_PASS_DEPTH_FAIL]: "stencilOpFront",
228
- [import_constants.GL.STENCIL_PASS_DEPTH_PASS]: "stencilOpFront",
229
- [import_constants.GL.STENCIL_BACK_FAIL]: "stencilOpBack",
230
- [import_constants.GL.STENCIL_BACK_PASS_DEPTH_FAIL]: "stencilOpBack",
231
- [import_constants.GL.STENCIL_BACK_PASS_DEPTH_PASS]: "stencilOpBack",
232
- [import_constants.GL.VIEWPORT]: (gl, value) => gl.viewport(...value),
198
+ [34964]: bindBuffer,
199
+ [36662]: bindBuffer,
200
+ [36663]: bindBuffer,
201
+ [35053]: bindBuffer,
202
+ [35055]: bindBuffer,
203
+ [2886]: (gl, value) => gl.frontFace(value),
204
+ [33170]: hint,
205
+ [2849]: (gl, value) => gl.lineWidth(value),
206
+ [32823]: enable,
207
+ [32824]: "polygonOffset",
208
+ [10752]: "polygonOffset",
209
+ [35977]: enable,
210
+ [32926]: enable,
211
+ [32928]: enable,
212
+ [32938]: "sampleCoverage",
213
+ [32939]: "sampleCoverage",
214
+ [3089]: enable,
215
+ [3088]: (gl, value) => gl.scissor(...value),
216
+ [2960]: enable,
217
+ [2961]: (gl, value) => gl.clearStencil(value),
218
+ [2968]: (gl, value) => gl.stencilMaskSeparate(1028, value),
219
+ [36005]: (gl, value) => gl.stencilMaskSeparate(1029, value),
220
+ [2962]: "stencilFuncFront",
221
+ [2967]: "stencilFuncFront",
222
+ [2963]: "stencilFuncFront",
223
+ [34816]: "stencilFuncBack",
224
+ [36003]: "stencilFuncBack",
225
+ [36004]: "stencilFuncBack",
226
+ [2964]: "stencilOpFront",
227
+ [2965]: "stencilOpFront",
228
+ [2966]: "stencilOpFront",
229
+ [34817]: "stencilOpBack",
230
+ [34818]: "stencilOpBack",
231
+ [34819]: "stencilOpBack",
232
+ [2978]: (gl, value) => gl.viewport(...value),
233
233
  // WEBGL2 EXTENSIONS
234
234
  // EXT_depth_clamp https://registry.khronos.org/webgl/extensions/EXT_depth_clamp/
235
- [import_constants.GL.DEPTH_CLAMP_EXT]: enable,
235
+ [34383]: enable,
236
236
  // WEBGL_provoking_vertex https://registry.khronos.org/webgl/extensions/WEBGL_provoking_vertex/
237
237
  // [GL.PROVOKING_VERTEX_WEBL]: TODO - extension function needed
238
238
  // WEBGL_polygon_mode https://registry.khronos.org/webgl/extensions/WEBGL_polygon_mode/
239
239
  // POLYGON_MODE_WEBGL TODO - extension function needed
240
- [import_constants.GL.POLYGON_OFFSET_LINE_WEBGL]: enable,
240
+ [10754]: enable,
241
241
  // WEBGL_clip_cull_distance https://registry.khronos.org/webgl/extensions/WEBGL_clip_cull_distance/
242
- [import_constants.GL.CLIP_DISTANCE0_WEBGL]: enable,
243
- [import_constants.GL.CLIP_DISTANCE1_WEBGL]: enable,
244
- [import_constants.GL.CLIP_DISTANCE2_WEBGL]: enable,
245
- [import_constants.GL.CLIP_DISTANCE3_WEBGL]: enable,
246
- [import_constants.GL.CLIP_DISTANCE4_WEBGL]: enable,
247
- [import_constants.GL.CLIP_DISTANCE5_WEBGL]: enable,
248
- [import_constants.GL.CLIP_DISTANCE6_WEBGL]: enable,
249
- [import_constants.GL.CLIP_DISTANCE7_WEBGL]: enable,
242
+ [12288]: enable,
243
+ [12289]: enable,
244
+ [12290]: enable,
245
+ [12291]: enable,
246
+ [12292]: enable,
247
+ [12293]: enable,
248
+ [12294]: enable,
249
+ [12295]: enable,
250
250
  // PIXEL PACK/UNPACK MODES
251
- [import_constants.GL.PACK_ALIGNMENT]: pixelStorei,
252
- [import_constants.GL.UNPACK_ALIGNMENT]: pixelStorei,
253
- [import_constants.GL.UNPACK_FLIP_Y_WEBGL]: pixelStorei,
254
- [import_constants.GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL]: pixelStorei,
255
- [import_constants.GL.UNPACK_COLORSPACE_CONVERSION_WEBGL]: pixelStorei,
256
- [import_constants.GL.PACK_ROW_LENGTH]: pixelStorei,
257
- [import_constants.GL.PACK_SKIP_PIXELS]: pixelStorei,
258
- [import_constants.GL.PACK_SKIP_ROWS]: pixelStorei,
259
- [import_constants.GL.UNPACK_ROW_LENGTH]: pixelStorei,
260
- [import_constants.GL.UNPACK_IMAGE_HEIGHT]: pixelStorei,
261
- [import_constants.GL.UNPACK_SKIP_PIXELS]: pixelStorei,
262
- [import_constants.GL.UNPACK_SKIP_ROWS]: pixelStorei,
263
- [import_constants.GL.UNPACK_SKIP_IMAGES]: pixelStorei,
251
+ [3333]: pixelStorei,
252
+ [3317]: pixelStorei,
253
+ [37440]: pixelStorei,
254
+ [37441]: pixelStorei,
255
+ [37443]: pixelStorei,
256
+ [3330]: pixelStorei,
257
+ [3332]: pixelStorei,
258
+ [3331]: pixelStorei,
259
+ [3314]: pixelStorei,
260
+ [32878]: pixelStorei,
261
+ [3316]: pixelStorei,
262
+ [3315]: pixelStorei,
263
+ [32877]: pixelStorei,
264
264
  // Function-style setters
265
265
  framebuffer: (gl, framebuffer) => {
266
266
  const handle = framebuffer && "handle" in framebuffer ? framebuffer.handle : framebuffer;
267
- return gl.bindFramebuffer(import_constants.GL.FRAMEBUFFER, handle);
267
+ return gl.bindFramebuffer(36160, handle);
268
268
  },
269
- blend: (gl, value) => value ? gl.enable(import_constants.GL.BLEND) : gl.disable(import_constants.GL.BLEND),
269
+ blend: (gl, value) => value ? gl.enable(3042) : gl.disable(3042),
270
270
  blendColor: (gl, value) => gl.blendColor(...value),
271
271
  blendEquation: (gl, args) => {
272
272
  const separateModes = typeof args === "number" ? [args, args] : args;
@@ -280,42 +280,42 @@ var GL_PARAMETER_SETTERS = {
280
280
  clearDepth: (gl, value) => gl.clearDepth(value),
281
281
  clearStencil: (gl, value) => gl.clearStencil(value),
282
282
  colorMask: (gl, value) => gl.colorMask(...value),
283
- cull: (gl, value) => value ? gl.enable(import_constants.GL.CULL_FACE) : gl.disable(import_constants.GL.CULL_FACE),
283
+ cull: (gl, value) => value ? gl.enable(2884) : gl.disable(2884),
284
284
  cullFace: (gl, value) => gl.cullFace(value),
285
- depthTest: (gl, value) => value ? gl.enable(import_constants.GL.DEPTH_TEST) : gl.disable(import_constants.GL.DEPTH_TEST),
285
+ depthTest: (gl, value) => value ? gl.enable(2929) : gl.disable(2929),
286
286
  depthFunc: (gl, value) => gl.depthFunc(value),
287
287
  depthMask: (gl, value) => gl.depthMask(value),
288
288
  depthRange: (gl, value) => gl.depthRange(...value),
289
- dither: (gl, value) => value ? gl.enable(import_constants.GL.DITHER) : gl.disable(import_constants.GL.DITHER),
289
+ dither: (gl, value) => value ? gl.enable(3024) : gl.disable(3024),
290
290
  derivativeHint: (gl, value) => {
291
- gl.hint(import_constants.GL.FRAGMENT_SHADER_DERIVATIVE_HINT, value);
291
+ gl.hint(35723, value);
292
292
  },
293
293
  frontFace: (gl, value) => gl.frontFace(value),
294
- mipmapHint: (gl, value) => gl.hint(import_constants.GL.GENERATE_MIPMAP_HINT, value),
294
+ mipmapHint: (gl, value) => gl.hint(33170, value),
295
295
  lineWidth: (gl, value) => gl.lineWidth(value),
296
- polygonOffsetFill: (gl, value) => value ? gl.enable(import_constants.GL.POLYGON_OFFSET_FILL) : gl.disable(import_constants.GL.POLYGON_OFFSET_FILL),
296
+ polygonOffsetFill: (gl, value) => value ? gl.enable(32823) : gl.disable(32823),
297
297
  polygonOffset: (gl, value) => gl.polygonOffset(...value),
298
298
  sampleCoverage: (gl, value) => gl.sampleCoverage(...value),
299
- scissorTest: (gl, value) => value ? gl.enable(import_constants.GL.SCISSOR_TEST) : gl.disable(import_constants.GL.SCISSOR_TEST),
299
+ scissorTest: (gl, value) => value ? gl.enable(3089) : gl.disable(3089),
300
300
  scissor: (gl, value) => gl.scissor(...value),
301
- stencilTest: (gl, value) => value ? gl.enable(import_constants.GL.STENCIL_TEST) : gl.disable(import_constants.GL.STENCIL_TEST),
301
+ stencilTest: (gl, value) => value ? gl.enable(2960) : gl.disable(2960),
302
302
  stencilMask: (gl, value) => {
303
303
  value = isArray(value) ? value : [value, value];
304
304
  const [mask, backMask] = value;
305
- gl.stencilMaskSeparate(import_constants.GL.FRONT, mask);
306
- gl.stencilMaskSeparate(import_constants.GL.BACK, backMask);
305
+ gl.stencilMaskSeparate(1028, mask);
306
+ gl.stencilMaskSeparate(1029, backMask);
307
307
  },
308
308
  stencilFunc: (gl, args) => {
309
309
  args = isArray(args) && args.length === 3 ? [...args, ...args] : args;
310
310
  const [func, ref, mask, backFunc, backRef, backMask] = args;
311
- gl.stencilFuncSeparate(import_constants.GL.FRONT, func, ref, mask);
312
- gl.stencilFuncSeparate(import_constants.GL.BACK, backFunc, backRef, backMask);
311
+ gl.stencilFuncSeparate(1028, func, ref, mask);
312
+ gl.stencilFuncSeparate(1029, backFunc, backRef, backMask);
313
313
  },
314
314
  stencilOp: (gl, args) => {
315
315
  args = isArray(args) && args.length === 3 ? [...args, ...args] : args;
316
316
  const [sfail, dpfail, dppass, backSfail, backDpfail, backDppass] = args;
317
- gl.stencilOpSeparate(import_constants.GL.FRONT, sfail, dpfail, dppass);
318
- gl.stencilOpSeparate(import_constants.GL.BACK, backSfail, backDpfail, backDppass);
317
+ gl.stencilOpSeparate(1028, sfail, dpfail, dppass);
318
+ gl.stencilOpSeparate(1029, backSfail, backDpfail, backDppass);
319
319
  },
320
320
  viewport: (gl, value) => gl.viewport(...value)
321
321
  };
@@ -323,14 +323,14 @@ function getValue(glEnum, values, cache) {
323
323
  return values[glEnum] !== void 0 ? values[glEnum] : cache[glEnum];
324
324
  }
325
325
  var GL_COMPOSITE_PARAMETER_SETTERS = {
326
- blendEquation: (gl, values, cache) => gl.blendEquationSeparate(getValue(import_constants.GL.BLEND_EQUATION_RGB, values, cache), getValue(import_constants.GL.BLEND_EQUATION_ALPHA, values, cache)),
327
- blendFunc: (gl, values, cache) => gl.blendFuncSeparate(getValue(import_constants.GL.BLEND_SRC_RGB, values, cache), getValue(import_constants.GL.BLEND_DST_RGB, values, cache), getValue(import_constants.GL.BLEND_SRC_ALPHA, values, cache), getValue(import_constants.GL.BLEND_DST_ALPHA, values, cache)),
328
- polygonOffset: (gl, values, cache) => gl.polygonOffset(getValue(import_constants.GL.POLYGON_OFFSET_FACTOR, values, cache), getValue(import_constants.GL.POLYGON_OFFSET_UNITS, values, cache)),
329
- sampleCoverage: (gl, values, cache) => gl.sampleCoverage(getValue(import_constants.GL.SAMPLE_COVERAGE_VALUE, values, cache), getValue(import_constants.GL.SAMPLE_COVERAGE_INVERT, values, cache)),
330
- stencilFuncFront: (gl, values, cache) => gl.stencilFuncSeparate(import_constants.GL.FRONT, getValue(import_constants.GL.STENCIL_FUNC, values, cache), getValue(import_constants.GL.STENCIL_REF, values, cache), getValue(import_constants.GL.STENCIL_VALUE_MASK, values, cache)),
331
- stencilFuncBack: (gl, values, cache) => gl.stencilFuncSeparate(import_constants.GL.BACK, getValue(import_constants.GL.STENCIL_BACK_FUNC, values, cache), getValue(import_constants.GL.STENCIL_BACK_REF, values, cache), getValue(import_constants.GL.STENCIL_BACK_VALUE_MASK, values, cache)),
332
- stencilOpFront: (gl, values, cache) => gl.stencilOpSeparate(import_constants.GL.FRONT, getValue(import_constants.GL.STENCIL_FAIL, values, cache), getValue(import_constants.GL.STENCIL_PASS_DEPTH_FAIL, values, cache), getValue(import_constants.GL.STENCIL_PASS_DEPTH_PASS, values, cache)),
333
- stencilOpBack: (gl, values, cache) => gl.stencilOpSeparate(import_constants.GL.BACK, getValue(import_constants.GL.STENCIL_BACK_FAIL, values, cache), getValue(import_constants.GL.STENCIL_BACK_PASS_DEPTH_FAIL, values, cache), getValue(import_constants.GL.STENCIL_BACK_PASS_DEPTH_PASS, values, cache))
326
+ blendEquation: (gl, values, cache) => gl.blendEquationSeparate(getValue(32777, values, cache), getValue(34877, values, cache)),
327
+ blendFunc: (gl, values, cache) => gl.blendFuncSeparate(getValue(32969, values, cache), getValue(32968, values, cache), getValue(32971, values, cache), getValue(32970, values, cache)),
328
+ polygonOffset: (gl, values, cache) => gl.polygonOffset(getValue(32824, values, cache), getValue(10752, values, cache)),
329
+ sampleCoverage: (gl, values, cache) => gl.sampleCoverage(getValue(32938, values, cache), getValue(32939, values, cache)),
330
+ stencilFuncFront: (gl, values, cache) => gl.stencilFuncSeparate(1028, getValue(2962, values, cache), getValue(2967, values, cache), getValue(2963, values, cache)),
331
+ stencilFuncBack: (gl, values, cache) => gl.stencilFuncSeparate(1029, getValue(34816, values, cache), getValue(36003, values, cache), getValue(36004, values, cache)),
332
+ stencilOpFront: (gl, values, cache) => gl.stencilOpSeparate(1028, getValue(2964, values, cache), getValue(2965, values, cache), getValue(2966, values, cache)),
333
+ stencilOpBack: (gl, values, cache) => gl.stencilOpSeparate(1029, getValue(34817, values, cache), getValue(34818, values, cache), getValue(34819, values, cache))
334
334
  };
335
335
  var GL_HOOKED_SETTERS = {
336
336
  // GENERIC SETTERS
@@ -348,39 +348,39 @@ var GL_HOOKED_SETTERS = {
348
348
  }),
349
349
  // SPECIFIC SETTERS
350
350
  useProgram: (update, value) => update({
351
- [import_constants.GL.CURRENT_PROGRAM]: value
351
+ [35725]: value
352
352
  }),
353
353
  bindRenderbuffer: (update, target, value) => update({
354
- [import_constants.GL.RENDERBUFFER_BINDING]: value
354
+ [36007]: value
355
355
  }),
356
356
  bindTransformFeedback: (update, target, value) => update({
357
- [import_constants.GL.TRANSFORM_FEEDBACK_BINDING]: value
357
+ [36389]: value
358
358
  }),
359
359
  bindVertexArray: (update, value) => update({
360
- [import_constants.GL.VERTEX_ARRAY_BINDING]: value
360
+ [34229]: value
361
361
  }),
362
362
  bindFramebuffer: (update, target, framebuffer) => {
363
363
  switch (target) {
364
- case import_constants.GL.FRAMEBUFFER:
364
+ case 36160:
365
365
  return update({
366
- [import_constants.GL.DRAW_FRAMEBUFFER_BINDING]: framebuffer,
367
- [import_constants.GL.READ_FRAMEBUFFER_BINDING]: framebuffer
366
+ [36006]: framebuffer,
367
+ [36010]: framebuffer
368
368
  });
369
- case import_constants.GL.DRAW_FRAMEBUFFER:
370
- return update({ [import_constants.GL.DRAW_FRAMEBUFFER_BINDING]: framebuffer });
371
- case import_constants.GL.READ_FRAMEBUFFER:
372
- return update({ [import_constants.GL.READ_FRAMEBUFFER_BINDING]: framebuffer });
369
+ case 36009:
370
+ return update({ [36006]: framebuffer });
371
+ case 36008:
372
+ return update({ [36010]: framebuffer });
373
373
  default:
374
374
  return null;
375
375
  }
376
376
  },
377
377
  bindBuffer: (update, target, buffer) => {
378
378
  const pname = {
379
- [import_constants.GL.ARRAY_BUFFER]: [import_constants.GL.ARRAY_BUFFER_BINDING],
380
- [import_constants.GL.COPY_READ_BUFFER]: [import_constants.GL.COPY_READ_BUFFER_BINDING],
381
- [import_constants.GL.COPY_WRITE_BUFFER]: [import_constants.GL.COPY_WRITE_BUFFER_BINDING],
382
- [import_constants.GL.PIXEL_PACK_BUFFER]: [import_constants.GL.PIXEL_PACK_BUFFER_BINDING],
383
- [import_constants.GL.PIXEL_UNPACK_BUFFER]: [import_constants.GL.PIXEL_UNPACK_BUFFER_BINDING]
379
+ [34962]: [34964],
380
+ [36662]: [36662],
381
+ [36663]: [36663],
382
+ [35051]: [35053],
383
+ [35052]: [35055]
384
384
  }[target];
385
385
  if (pname) {
386
386
  return update({ [pname]: buffer });
@@ -388,162 +388,154 @@ var GL_HOOKED_SETTERS = {
388
388
  return { valueChanged: true };
389
389
  },
390
390
  blendColor: (update, r, g, b, a) => update({
391
- [import_constants.GL.BLEND_COLOR]: new Float32Array([r, g, b, a])
391
+ [32773]: new Float32Array([r, g, b, a])
392
392
  }),
393
393
  blendEquation: (update, mode) => update({
394
- [import_constants.GL.BLEND_EQUATION_RGB]: mode,
395
- [import_constants.GL.BLEND_EQUATION_ALPHA]: mode
394
+ [32777]: mode,
395
+ [34877]: mode
396
396
  }),
397
397
  blendEquationSeparate: (update, modeRGB, modeAlpha) => update({
398
- [import_constants.GL.BLEND_EQUATION_RGB]: modeRGB,
399
- [import_constants.GL.BLEND_EQUATION_ALPHA]: modeAlpha
398
+ [32777]: modeRGB,
399
+ [34877]: modeAlpha
400
400
  }),
401
401
  blendFunc: (update, src, dst) => update({
402
- [import_constants.GL.BLEND_SRC_RGB]: src,
403
- [import_constants.GL.BLEND_DST_RGB]: dst,
404
- [import_constants.GL.BLEND_SRC_ALPHA]: src,
405
- [import_constants.GL.BLEND_DST_ALPHA]: dst
402
+ [32969]: src,
403
+ [32968]: dst,
404
+ [32971]: src,
405
+ [32970]: dst
406
406
  }),
407
407
  blendFuncSeparate: (update, srcRGB, dstRGB, srcAlpha, dstAlpha) => update({
408
- [import_constants.GL.BLEND_SRC_RGB]: srcRGB,
409
- [import_constants.GL.BLEND_DST_RGB]: dstRGB,
410
- [import_constants.GL.BLEND_SRC_ALPHA]: srcAlpha,
411
- [import_constants.GL.BLEND_DST_ALPHA]: dstAlpha
408
+ [32969]: srcRGB,
409
+ [32968]: dstRGB,
410
+ [32971]: srcAlpha,
411
+ [32970]: dstAlpha
412
412
  }),
413
413
  clearColor: (update, r, g, b, a) => update({
414
- [import_constants.GL.COLOR_CLEAR_VALUE]: new Float32Array([r, g, b, a])
414
+ [3106]: new Float32Array([r, g, b, a])
415
415
  }),
416
416
  clearDepth: (update, depth) => update({
417
- [import_constants.GL.DEPTH_CLEAR_VALUE]: depth
417
+ [2931]: depth
418
418
  }),
419
419
  clearStencil: (update, s) => update({
420
- [import_constants.GL.STENCIL_CLEAR_VALUE]: s
420
+ [2961]: s
421
421
  }),
422
422
  colorMask: (update, r, g, b, a) => update({
423
- [import_constants.GL.COLOR_WRITEMASK]: [r, g, b, a]
423
+ [3107]: [r, g, b, a]
424
424
  }),
425
425
  cullFace: (update, mode) => update({
426
- [import_constants.GL.CULL_FACE_MODE]: mode
426
+ [2885]: mode
427
427
  }),
428
428
  depthFunc: (update, func) => update({
429
- [import_constants.GL.DEPTH_FUNC]: func
429
+ [2932]: func
430
430
  }),
431
431
  depthRange: (update, zNear, zFar) => update({
432
- [import_constants.GL.DEPTH_RANGE]: new Float32Array([zNear, zFar])
432
+ [2928]: new Float32Array([zNear, zFar])
433
433
  }),
434
434
  depthMask: (update, mask) => update({
435
- [import_constants.GL.DEPTH_WRITEMASK]: mask
435
+ [2930]: mask
436
436
  }),
437
437
  frontFace: (update, face) => update({
438
- [import_constants.GL.FRONT_FACE]: face
438
+ [2886]: face
439
439
  }),
440
440
  lineWidth: (update, width) => update({
441
- [import_constants.GL.LINE_WIDTH]: width
441
+ [2849]: width
442
442
  }),
443
443
  polygonOffset: (update, factor, units) => update({
444
- [import_constants.GL.POLYGON_OFFSET_FACTOR]: factor,
445
- [import_constants.GL.POLYGON_OFFSET_UNITS]: units
444
+ [32824]: factor,
445
+ [10752]: units
446
446
  }),
447
447
  sampleCoverage: (update, value, invert) => update({
448
- [import_constants.GL.SAMPLE_COVERAGE_VALUE]: value,
449
- [import_constants.GL.SAMPLE_COVERAGE_INVERT]: invert
448
+ [32938]: value,
449
+ [32939]: invert
450
450
  }),
451
451
  scissor: (update, x, y, width, height) => update({
452
- [import_constants.GL.SCISSOR_BOX]: new Int32Array([x, y, width, height])
452
+ [3088]: new Int32Array([x, y, width, height])
453
453
  }),
454
454
  stencilMask: (update, mask) => update({
455
- [import_constants.GL.STENCIL_WRITEMASK]: mask,
456
- [import_constants.GL.STENCIL_BACK_WRITEMASK]: mask
455
+ [2968]: mask,
456
+ [36005]: mask
457
457
  }),
458
458
  stencilMaskSeparate: (update, face, mask) => update({
459
- [face === import_constants.GL.FRONT ? import_constants.GL.STENCIL_WRITEMASK : import_constants.GL.STENCIL_BACK_WRITEMASK]: mask
459
+ [face === 1028 ? 2968 : 36005]: mask
460
460
  }),
461
461
  stencilFunc: (update, func, ref, mask) => update({
462
- [import_constants.GL.STENCIL_FUNC]: func,
463
- [import_constants.GL.STENCIL_REF]: ref,
464
- [import_constants.GL.STENCIL_VALUE_MASK]: mask,
465
- [import_constants.GL.STENCIL_BACK_FUNC]: func,
466
- [import_constants.GL.STENCIL_BACK_REF]: ref,
467
- [import_constants.GL.STENCIL_BACK_VALUE_MASK]: mask
462
+ [2962]: func,
463
+ [2967]: ref,
464
+ [2963]: mask,
465
+ [34816]: func,
466
+ [36003]: ref,
467
+ [36004]: mask
468
468
  }),
469
469
  stencilFuncSeparate: (update, face, func, ref, mask) => update({
470
- [face === import_constants.GL.FRONT ? import_constants.GL.STENCIL_FUNC : import_constants.GL.STENCIL_BACK_FUNC]: func,
471
- [face === import_constants.GL.FRONT ? import_constants.GL.STENCIL_REF : import_constants.GL.STENCIL_BACK_REF]: ref,
472
- [face === import_constants.GL.FRONT ? import_constants.GL.STENCIL_VALUE_MASK : import_constants.GL.STENCIL_BACK_VALUE_MASK]: mask
470
+ [face === 1028 ? 2962 : 34816]: func,
471
+ [face === 1028 ? 2967 : 36003]: ref,
472
+ [face === 1028 ? 2963 : 36004]: mask
473
473
  }),
474
474
  stencilOp: (update, fail, zfail, zpass) => update({
475
- [import_constants.GL.STENCIL_FAIL]: fail,
476
- [import_constants.GL.STENCIL_PASS_DEPTH_FAIL]: zfail,
477
- [import_constants.GL.STENCIL_PASS_DEPTH_PASS]: zpass,
478
- [import_constants.GL.STENCIL_BACK_FAIL]: fail,
479
- [import_constants.GL.STENCIL_BACK_PASS_DEPTH_FAIL]: zfail,
480
- [import_constants.GL.STENCIL_BACK_PASS_DEPTH_PASS]: zpass
475
+ [2964]: fail,
476
+ [2965]: zfail,
477
+ [2966]: zpass,
478
+ [34817]: fail,
479
+ [34818]: zfail,
480
+ [34819]: zpass
481
481
  }),
482
482
  stencilOpSeparate: (update, face, fail, zfail, zpass) => update({
483
- [face === import_constants.GL.FRONT ? import_constants.GL.STENCIL_FAIL : import_constants.GL.STENCIL_BACK_FAIL]: fail,
484
- [face === import_constants.GL.FRONT ? import_constants.GL.STENCIL_PASS_DEPTH_FAIL : import_constants.GL.STENCIL_BACK_PASS_DEPTH_FAIL]: zfail,
485
- [face === import_constants.GL.FRONT ? import_constants.GL.STENCIL_PASS_DEPTH_PASS : import_constants.GL.STENCIL_BACK_PASS_DEPTH_PASS]: zpass
483
+ [face === 1028 ? 2964 : 34817]: fail,
484
+ [face === 1028 ? 2965 : 34818]: zfail,
485
+ [face === 1028 ? 2966 : 34819]: zpass
486
486
  }),
487
487
  viewport: (update, x, y, width, height) => update({
488
- [import_constants.GL.VIEWPORT]: [x, y, width, height]
488
+ [2978]: [x, y, width, height]
489
489
  })
490
490
  };
491
491
  var isEnabled = (gl, key) => gl.isEnabled(key);
492
492
  var GL_PARAMETER_GETTERS = {
493
- [import_constants.GL.BLEND]: isEnabled,
494
- [import_constants.GL.CULL_FACE]: isEnabled,
495
- [import_constants.GL.DEPTH_TEST]: isEnabled,
496
- [import_constants.GL.DITHER]: isEnabled,
497
- [import_constants.GL.POLYGON_OFFSET_FILL]: isEnabled,
498
- [import_constants.GL.SAMPLE_ALPHA_TO_COVERAGE]: isEnabled,
499
- [import_constants.GL.SAMPLE_COVERAGE]: isEnabled,
500
- [import_constants.GL.SCISSOR_TEST]: isEnabled,
501
- [import_constants.GL.STENCIL_TEST]: isEnabled,
502
- [import_constants.GL.RASTERIZER_DISCARD]: isEnabled
493
+ [3042]: isEnabled,
494
+ [2884]: isEnabled,
495
+ [2929]: isEnabled,
496
+ [3024]: isEnabled,
497
+ [32823]: isEnabled,
498
+ [32926]: isEnabled,
499
+ [32928]: isEnabled,
500
+ [3089]: isEnabled,
501
+ [2960]: isEnabled,
502
+ [35977]: isEnabled
503
503
  };
504
504
  var NON_CACHE_PARAMETERS = /* @__PURE__ */ new Set([
505
- // setter not intercepted
506
- import_constants.GL.ACTIVE_TEXTURE,
507
- import_constants.GL.TRANSFORM_FEEDBACK_ACTIVE,
508
- import_constants.GL.TRANSFORM_FEEDBACK_PAUSED,
509
- // setters bindBufferRange/bindBufferBase cannot be pruned based on cache
510
- import_constants.GL.TRANSFORM_FEEDBACK_BUFFER_BINDING,
511
- import_constants.GL.UNIFORM_BUFFER_BINDING,
512
- // states depending on VERTEX_ARRAY_BINDING
513
- import_constants.GL.ELEMENT_ARRAY_BUFFER_BINDING,
514
- // states depending on READ_FRAMEBUFFER_BINDING
515
- import_constants.GL.IMPLEMENTATION_COLOR_READ_FORMAT,
516
- import_constants.GL.IMPLEMENTATION_COLOR_READ_TYPE,
517
- // states depending on FRAMEBUFFER_BINDING
518
- import_constants.GL.READ_BUFFER,
519
- import_constants.GL.DRAW_BUFFER0,
520
- import_constants.GL.DRAW_BUFFER1,
521
- import_constants.GL.DRAW_BUFFER2,
522
- import_constants.GL.DRAW_BUFFER3,
523
- import_constants.GL.DRAW_BUFFER4,
524
- import_constants.GL.DRAW_BUFFER5,
525
- import_constants.GL.DRAW_BUFFER6,
526
- import_constants.GL.DRAW_BUFFER7,
527
- import_constants.GL.DRAW_BUFFER8,
528
- import_constants.GL.DRAW_BUFFER9,
529
- import_constants.GL.DRAW_BUFFER10,
530
- import_constants.GL.DRAW_BUFFER11,
531
- import_constants.GL.DRAW_BUFFER12,
532
- import_constants.GL.DRAW_BUFFER13,
533
- import_constants.GL.DRAW_BUFFER14,
534
- import_constants.GL.DRAW_BUFFER15,
535
- // states depending on ACTIVE_TEXTURE
536
- import_constants.GL.SAMPLER_BINDING,
537
- import_constants.GL.TEXTURE_BINDING_2D,
538
- import_constants.GL.TEXTURE_BINDING_2D_ARRAY,
539
- import_constants.GL.TEXTURE_BINDING_3D,
540
- import_constants.GL.TEXTURE_BINDING_CUBE_MAP
505
+ 34016,
506
+ 36388,
507
+ 36387,
508
+ 35983,
509
+ 35368,
510
+ 34965,
511
+ 35739,
512
+ 35738,
513
+ 3074,
514
+ 34853,
515
+ 34854,
516
+ 34855,
517
+ 34856,
518
+ 34857,
519
+ 34858,
520
+ 34859,
521
+ 34860,
522
+ 34861,
523
+ 34862,
524
+ 34863,
525
+ 34864,
526
+ 34865,
527
+ 34866,
528
+ 34867,
529
+ 34868,
530
+ 35097,
531
+ 32873,
532
+ 35869,
533
+ 32874,
534
+ 34068
541
535
  ]);
542
536
 
543
537
  // dist/context/parameters/unified-parameter-api.js
544
- function setGLParameters(device, parameters) {
545
- const webglDevice = WebGLDevice.attach(device);
546
- const gl = webglDevice.gl;
538
+ function setGLParameters(gl, parameters) {
547
539
  if (isObjectEmpty(parameters)) {
548
540
  return;
549
541
  }
@@ -567,9 +559,7 @@ function setGLParameters(device, parameters) {
567
559
  }
568
560
  }
569
561
  }
570
- function getGLParameters(device, parameters = GL_PARAMETER_DEFAULTS) {
571
- const webglDevice = WebGLDevice.attach(device);
572
- const gl = webglDevice.gl;
562
+ function getGLParameters(gl, parameters = GL_PARAMETER_DEFAULTS) {
573
563
  if (typeof parameters === "number") {
574
564
  const key = parameters;
575
565
  const getter = GL_PARAMETER_GETTERS[key];
@@ -583,8 +573,8 @@ function getGLParameters(device, parameters = GL_PARAMETER_DEFAULTS) {
583
573
  }
584
574
  return state;
585
575
  }
586
- function resetGLParameters(device) {
587
- setGLParameters(device, GL_PARAMETER_DEFAULTS);
576
+ function resetGLParameters(gl) {
577
+ setGLParameters(gl, GL_PARAMETER_DEFAULTS);
588
578
  }
589
579
  function isObjectEmpty(object) {
590
580
  for (const key in object) {
@@ -796,15 +786,15 @@ function getWebGLExtension(gl, name, extensions) {
796
786
 
797
787
  // dist/adapter/device-helpers/webgl-device-info.js
798
788
  function getDeviceInfo(gl, extensions) {
799
- const vendorMasked = gl.getParameter(import_constants2.GL.VENDOR);
800
- const rendererMasked = gl.getParameter(import_constants2.GL.RENDERER);
789
+ const vendorMasked = gl.getParameter(7936);
790
+ const rendererMasked = gl.getParameter(7937);
801
791
  getWebGLExtension(gl, "WEBGL_debug_renderer_info", extensions);
802
792
  const ext = extensions.WEBGL_debug_renderer_info;
803
- const vendorUnmasked = gl.getParameter(ext ? ext.UNMASKED_VENDOR_WEBGL : import_constants2.GL.VENDOR);
804
- const rendererUnmasked = gl.getParameter(ext ? ext.UNMASKED_RENDERER_WEBGL : import_constants2.GL.RENDERER);
793
+ const vendorUnmasked = gl.getParameter(ext ? ext.UNMASKED_VENDOR_WEBGL : 7936);
794
+ const rendererUnmasked = gl.getParameter(ext ? ext.UNMASKED_RENDERER_WEBGL : 7937);
805
795
  const vendor = vendorUnmasked || vendorMasked;
806
796
  const renderer = rendererUnmasked || rendererMasked;
807
- const version = gl.getParameter(import_constants2.GL.VERSION);
797
+ const version = gl.getParameter(7938);
808
798
  const gpu = identifyGPUVendor(vendor, renderer);
809
799
  const gpuBackend = identifyGPUBackend(vendor, renderer);
810
800
  const gpuType = identifyGPUType(vendor, renderer);
@@ -878,29 +868,29 @@ var import_constants3 = require("@luma.gl/constants");
878
868
  function getGLFromVertexType(dataType) {
879
869
  switch (dataType) {
880
870
  case "uint8":
881
- return import_constants3.GL.UNSIGNED_BYTE;
871
+ return 5121;
882
872
  case "sint8":
883
- return import_constants3.GL.BYTE;
873
+ return 5120;
884
874
  case "unorm8":
885
- return import_constants3.GL.UNSIGNED_BYTE;
875
+ return 5121;
886
876
  case "snorm8":
887
- return import_constants3.GL.BYTE;
877
+ return 5120;
888
878
  case "uint16":
889
- return import_constants3.GL.UNSIGNED_SHORT;
879
+ return 5123;
890
880
  case "sint16":
891
- return import_constants3.GL.SHORT;
881
+ return 5122;
892
882
  case "unorm16":
893
- return import_constants3.GL.UNSIGNED_SHORT;
883
+ return 5123;
894
884
  case "snorm16":
895
- return import_constants3.GL.SHORT;
885
+ return 5122;
896
886
  case "uint32":
897
- return import_constants3.GL.UNSIGNED_INT;
887
+ return 5125;
898
888
  case "sint32":
899
- return import_constants3.GL.INT;
889
+ return 5124;
900
890
  case "float16":
901
- return import_constants3.GL.HALF_FLOAT;
891
+ return 5131;
902
892
  case "float32":
903
- return import_constants3.GL.FLOAT;
893
+ return 5126;
904
894
  }
905
895
  throw new Error(String(dataType));
906
896
  }
@@ -962,210 +952,259 @@ function checkTextureFeature(gl, feature, extensions) {
962
952
  return textureExtensions.every((extension) => getWebGLExtension(gl, extension, extensions));
963
953
  }
964
954
  var TEXTURE_FORMATS = {
965
- // Unsized formats that leave the precision up to the driver.
966
- // TODO - Fix bpp constants
967
- // 'r8unorm-unsized': {gl: GL.LUMINANCE, b: 4, c: 2, bpp: 4},
955
+ // Unsized formats that leave the precision up to the driver. TODO - Fix bpp constants
968
956
  "rgb8unorm-unsized": {
969
- gl: import_constants4.GL.RGB,
957
+ gl: 6407,
970
958
  b: 4,
971
959
  c: 2,
972
960
  bpp: 4,
973
- dataFormat: import_constants4.GL.RGB,
974
- types: [import_constants4.GL.UNSIGNED_BYTE, import_constants4.GL.UNSIGNED_SHORT_5_6_5]
961
+ dataFormat: 6407,
962
+ types: [5121, 33635]
975
963
  },
976
964
  "rgba8unorm-unsized": {
977
- gl: import_constants4.GL.RGBA,
965
+ gl: 6408,
978
966
  b: 4,
979
967
  c: 2,
980
968
  bpp: 4,
981
- dataFormat: import_constants4.GL.RGBA,
982
- types: [import_constants4.GL.UNSIGNED_BYTE, import_constants4.GL.UNSIGNED_SHORT_4_4_4_4, import_constants4.GL.UNSIGNED_SHORT_5_5_5_1]
969
+ dataFormat: 6408,
970
+ types: [5121, 32819, 32820]
983
971
  },
972
+ // 'r8unorm-unsized': {gl: GL.LUMINANCE, b: 4, c: 2, bpp: 4},
984
973
  // 'rgb8unorm-srgb-unsized': {gl: GL.SRGB_EXT, b: 4, c: 2, bpp: 4, gl1Ext: SRGB},
985
974
  // 'rgba8unorm-srgb-unsized': {gl: GL.SRGB_ALPHA_EXT, b: 4, c: 2, bpp: 4, gl1Ext: SRGB},
986
975
  // 8-bit formats
987
- "r8unorm": { gl: import_constants4.GL.R8, b: 1, c: 1, renderbuffer: true },
988
- "r8snorm": { gl: import_constants4.GL.R8_SNORM, b: 1, c: 1, render: snorm8_renderable },
989
- "r8uint": { gl: import_constants4.GL.R8UI, b: 1, c: 1, renderbuffer: true },
990
- "r8sint": { gl: import_constants4.GL.R8I, b: 1, c: 1, renderbuffer: true },
976
+ "r8unorm": { gl: 33321, b: 1, c: 1, rb: true },
977
+ "r8snorm": { gl: 36756, b: 1, c: 1, render: snorm8_renderable },
978
+ "r8uint": { gl: 33330, b: 1, c: 1, rb: true },
979
+ "r8sint": { gl: 33329, b: 1, c: 1, rb: true },
991
980
  // 16-bit formats
992
- "rg8unorm": { gl: import_constants4.GL.RG8, b: 2, c: 2, renderbuffer: true },
993
- "rg8snorm": { gl: import_constants4.GL.RG8_SNORM, b: 2, c: 2, render: snorm8_renderable },
994
- "rg8uint": { gl: import_constants4.GL.RG8UI, b: 2, c: 2, renderbuffer: true },
995
- "rg8sint": { gl: import_constants4.GL.RG8I, b: 2, c: 2, renderbuffer: true },
996
- "r16uint": { gl: import_constants4.GL.R16UI, b: 2, c: 1, renderbuffer: true },
997
- "r16sint": { gl: import_constants4.GL.R16I, b: 2, c: 1, renderbuffer: true },
998
- "r16float": { gl: import_constants4.GL.R16F, b: 2, c: 1, render: float16_renderable, filter: "float16-filterable-webgl", renderbuffer: true },
999
- "r16unorm-webgl": { gl: import_constants4.GL.R16_EXT, b: 2, c: 1, f: norm16_renderable, renderbuffer: true },
1000
- "r16snorm-webgl": { gl: import_constants4.GL.R16_SNORM_EXT, b: 2, c: 1, f: snorm16_renderable },
981
+ "rg8unorm": { gl: 33323, b: 2, c: 2, rb: true },
982
+ "rg8snorm": { gl: 36757, b: 2, c: 2, render: snorm8_renderable },
983
+ "rg8uint": { gl: 33336, b: 2, c: 2, rb: true },
984
+ "rg8sint": { gl: 33335, b: 2, c: 2, rb: true },
985
+ "r16uint": { gl: 33332, b: 2, c: 1, rb: true },
986
+ "r16sint": { gl: 33331, b: 2, c: 1, rb: true },
987
+ "r16float": { gl: 33325, b: 2, c: 1, render: float16_renderable, filter: "float16-filterable-webgl", rb: true },
988
+ "r16unorm-webgl": { gl: 33322, b: 2, c: 1, f: norm16_renderable, rb: true },
989
+ "r16snorm-webgl": { gl: 36760, b: 2, c: 1, f: snorm16_renderable },
1001
990
  // Packed 16-bit formats
1002
- "rgba4unorm-webgl": { gl: import_constants4.GL.RGBA4, b: 2, c: 4, wgpu: false, renderbuffer: true },
1003
- "rgb565unorm-webgl": { gl: import_constants4.GL.RGB565, b: 2, c: 4, wgpu: false, renderbuffer: true },
1004
- "rgb5a1unorm-webgl": { gl: import_constants4.GL.RGB5_A1, b: 2, c: 4, wgpu: false, renderbuffer: true },
991
+ "rgba4unorm-webgl": { gl: 32854, b: 2, c: 4, wgpu: false, rb: true },
992
+ "rgb565unorm-webgl": { gl: 36194, b: 2, c: 4, wgpu: false, rb: true },
993
+ "rgb5a1unorm-webgl": { gl: 32855, b: 2, c: 4, wgpu: false, rb: true },
1005
994
  // 24-bit formats
1006
- "rgb8unorm-webgl": { gl: import_constants4.GL.RGB8, b: 3, c: 3, wgpu: false },
1007
- "rgb8snorm-webgl": { gl: import_constants4.GL.RGB8_SNORM, b: 3, c: 3, wgpu: false },
995
+ "rgb8unorm-webgl": { gl: 32849, b: 3, c: 3, wgpu: false },
996
+ "rgb8snorm-webgl": { gl: 36758, b: 3, c: 3, wgpu: false },
1008
997
  // 32-bit formats
1009
- "rgba8unorm": { gl: import_constants4.GL.RGBA8, b: 4, c: 2, bpp: 4 },
1010
- "rgba8unorm-srgb": { gl: import_constants4.GL.SRGB8_ALPHA8, b: 4, c: 4, bpp: 4 },
1011
- "rgba8snorm": { gl: import_constants4.GL.RGBA8_SNORM, b: 4, c: 4, render: snorm8_renderable },
1012
- "rgba8uint": { gl: import_constants4.GL.RGBA8UI, b: 4, c: 4, bpp: 4 },
1013
- "rgba8sint": { gl: import_constants4.GL.RGBA8I, b: 4, c: 4, bpp: 4 },
998
+ "rgba8unorm": { gl: 32856, b: 4, c: 2, bpp: 4 },
999
+ "rgba8unorm-srgb": { gl: 35907, b: 4, c: 4, bpp: 4 },
1000
+ "rgba8snorm": { gl: 36759, b: 4, c: 4, render: snorm8_renderable },
1001
+ "rgba8uint": { gl: 36220, b: 4, c: 4, bpp: 4 },
1002
+ "rgba8sint": { gl: 36238, b: 4, c: 4, bpp: 4 },
1014
1003
  // reverse colors, webgpu only
1015
1004
  "bgra8unorm": { b: 4, c: 4 },
1016
1005
  "bgra8unorm-srgb": { b: 4, c: 4 },
1017
- "rg16uint": { gl: import_constants4.GL.RG16UI, b: 4, c: 1, bpp: 4 },
1018
- "rg16sint": { gl: import_constants4.GL.RG16I, b: 4, c: 2, bpp: 4 },
1006
+ "rg16uint": { gl: 33338, b: 4, c: 1, bpp: 4 },
1007
+ "rg16sint": { gl: 33337, b: 4, c: 2, bpp: 4 },
1019
1008
  // When using a WebGL 2 context and the EXT_color_buffer_float WebGL2 extension
1020
- "rg16float": { gl: import_constants4.GL.RG16F, bpp: 4, b: 4, c: 2, render: float16_renderable, filter: float16_filterable, renderbuffer: true },
1021
- "rg16unorm-webgl": { gl: import_constants4.GL.RG16_EXT, b: 2, c: 2, render: norm16_renderable },
1022
- "rg16snorm-webgl": { gl: import_constants4.GL.RG16_SNORM_EXT, b: 2, c: 2, render: snorm16_renderable },
1023
- "r32uint": { gl: import_constants4.GL.R32UI, b: 4, c: 1, bpp: 4, renderbuffer: true },
1024
- "r32sint": { gl: import_constants4.GL.R32I, b: 4, c: 1, bpp: 4, renderbuffer: true },
1025
- "r32float": { gl: import_constants4.GL.R32F, bpp: 4, b: 4, c: 1, render: float32_renderable, filter: float32_filterable },
1009
+ "rg16float": { gl: 33327, bpp: 4, b: 4, c: 2, render: float16_renderable, filter: float16_filterable, rb: true },
1010
+ "rg16unorm-webgl": { gl: 33324, b: 2, c: 2, render: norm16_renderable },
1011
+ "rg16snorm-webgl": { gl: 36761, b: 2, c: 2, render: snorm16_renderable },
1012
+ "r32uint": { gl: 33334, b: 4, c: 1, bpp: 4, rb: true },
1013
+ "r32sint": { gl: 33333, b: 4, c: 1, bpp: 4, rb: true },
1014
+ "r32float": { gl: 33326, bpp: 4, b: 4, c: 1, render: float32_renderable, filter: float32_filterable },
1026
1015
  // Packed 32-bit formats
1027
- "rgb9e5ufloat": { gl: import_constants4.GL.RGB9_E5, b: 4, c: 3, p: 1, render: rgb9e5ufloat_renderable },
1016
+ "rgb9e5ufloat": { gl: 35901, b: 4, c: 3, p: 1, render: rgb9e5ufloat_renderable },
1028
1017
  // , filter: true},
1029
- "rg11b10ufloat": { gl: import_constants4.GL.R11F_G11F_B10F, b: 4, c: 3, p: 1, render: float32_renderable, renderbuffer: true },
1030
- "rgb10a2unorm": { gl: import_constants4.GL.RGB10_A2, b: 4, c: 4, p: 1, renderbuffer: true },
1031
- "rgb10a2uint-webgl": { b: 4, c: 4, gl: import_constants4.GL.RGB10_A2UI, p: 1, wgpu: false, bpp: 4, renderbuffer: true },
1018
+ "rg11b10ufloat": { gl: 35898, b: 4, c: 3, p: 1, render: float32_renderable, rb: true },
1019
+ "rgb10a2unorm": { gl: 32857, b: 4, c: 4, p: 1, rb: true },
1020
+ "rgb10a2uint-webgl": { b: 4, c: 4, gl: 36975, p: 1, wgpu: false, bpp: 4, rb: true },
1032
1021
  // 48-bit formats
1033
- "rgb16unorm-webgl": { gl: import_constants4.GL.RGB16_EXT, b: 2, c: 3, f: norm16_renderable },
1022
+ "rgb16unorm-webgl": { gl: 32852, b: 2, c: 3, f: norm16_renderable },
1034
1023
  // rgb not renderable
1035
- "rgb16snorm-webgl": { gl: import_constants4.GL.RGB16_SNORM_EXT, b: 2, c: 3, f: norm16_renderable },
1024
+ "rgb16snorm-webgl": { gl: 36762, b: 2, c: 3, f: norm16_renderable },
1036
1025
  // rgb not renderable
1037
1026
  // 64-bit formats
1038
- "rg32uint": { gl: import_constants4.GL.RG32UI, b: 8, c: 2, renderbuffer: true },
1039
- "rg32sint": { gl: import_constants4.GL.RG32I, b: 8, c: 2, renderbuffer: true },
1040
- "rg32float": { gl: import_constants4.GL.RG32F, b: 8, c: 2, render: float32_renderable, filter: float32_filterable, renderbuffer: true },
1041
- "rgba16uint": { gl: import_constants4.GL.RGBA16UI, b: 8, c: 4, renderbuffer: true },
1042
- "rgba16sint": { gl: import_constants4.GL.RGBA16I, b: 8, c: 4, renderbuffer: true },
1043
- "rgba16float": { gl: import_constants4.GL.RGBA16F, b: 8, c: 4, render: float16_renderable, filter: float16_filterable },
1044
- "rgba16unorm-webgl": { gl: import_constants4.GL.RGBA16_EXT, b: 2, c: 4, render: norm16_renderable, renderbuffer: true },
1045
- "rgba16snorm-webgl": { gl: import_constants4.GL.RGBA16_SNORM_EXT, b: 2, c: 4, render: snorm16_renderable },
1027
+ "rg32uint": { gl: 33340, b: 8, c: 2, rb: true },
1028
+ "rg32sint": { gl: 33339, b: 8, c: 2, rb: true },
1029
+ "rg32float": { gl: 33328, b: 8, c: 2, render: float32_renderable, filter: float32_filterable, rb: true },
1030
+ "rgba16uint": { gl: 36214, b: 8, c: 4, rb: true },
1031
+ "rgba16sint": { gl: 36232, b: 8, c: 4, rb: true },
1032
+ "rgba16float": { gl: 34842, b: 8, c: 4, render: float16_renderable, filter: float16_filterable },
1033
+ "rgba16unorm-webgl": { gl: 32859, b: 2, c: 4, render: norm16_renderable, rb: true },
1034
+ "rgba16snorm-webgl": { gl: 36763, b: 2, c: 4, render: snorm16_renderable },
1046
1035
  // 96-bit formats (deprecated!)
1047
1036
  "rgb32float-webgl": {
1048
- gl: import_constants4.GL.RGB32F,
1037
+ gl: 34837,
1049
1038
  render: float32_renderable,
1050
1039
  filter: float32_filterable,
1051
1040
  gl2ext: EXT_color_buffer_float,
1052
- dataFormat: import_constants4.GL.RGB,
1053
- types: [import_constants4.GL.FLOAT]
1041
+ dataFormat: 6407,
1042
+ types: [5126]
1054
1043
  },
1055
1044
  // 128-bit formats
1056
- "rgba32uint": { gl: import_constants4.GL.RGBA32UI, b: 16, c: 4, renderbuffer: true },
1057
- "rgba32sint": { gl: import_constants4.GL.RGBA32I, b: 16, c: 4, renderbuffer: true },
1058
- "rgba32float": { gl: import_constants4.GL.RGBA32F, b: 16, c: 4, render: float32_renderable, filter: float32_filterable, renderbuffer: true },
1045
+ "rgba32uint": { gl: 36208, b: 16, c: 4, rb: true },
1046
+ "rgba32sint": { gl: 36226, b: 16, c: 4, rb: true },
1047
+ "rgba32float": { gl: 34836, b: 16, c: 4, render: float32_renderable, filter: float32_filterable, rb: true },
1059
1048
  // Depth and stencil formats
1060
- "stencil8": { gl: import_constants4.GL.STENCIL_INDEX8, b: 1, c: 1, attachment: import_constants4.GL.STENCIL_ATTACHMENT, renderbuffer: true },
1049
+ "stencil8": { gl: 36168, b: 1, c: 1, attachment: 36128, rb: true },
1061
1050
  // 8 stencil bits
1062
- "depth16unorm": { gl: import_constants4.GL.DEPTH_COMPONENT16, b: 2, c: 1, attachment: import_constants4.GL.DEPTH_ATTACHMENT, renderbuffer: true },
1051
+ "depth16unorm": {
1052
+ gl: 33189,
1053
+ b: 2,
1054
+ c: 1,
1055
+ attachment: 36096,
1056
+ dataFormat: 6402,
1057
+ types: [5123],
1058
+ rb: true
1059
+ },
1063
1060
  // 16 depth bits
1064
- "depth24plus": { gl: import_constants4.GL.DEPTH_COMPONENT24, b: 3, c: 1, attachment: import_constants4.GL.DEPTH_ATTACHMENT },
1065
- "depth32float": { gl: import_constants4.GL.DEPTH_COMPONENT32F, b: 4, c: 1, attachment: import_constants4.GL.DEPTH_ATTACHMENT, renderbuffer: true },
1061
+ "depth24plus": {
1062
+ gl: 33190,
1063
+ b: 3,
1064
+ c: 1,
1065
+ attachment: 36096,
1066
+ dataFormat: 6402,
1067
+ types: [5125]
1068
+ },
1069
+ "depth32float": {
1070
+ gl: 36012,
1071
+ b: 4,
1072
+ c: 1,
1073
+ attachment: 36096,
1074
+ dataFormat: 6402,
1075
+ types: [5126],
1076
+ rb: true
1077
+ },
1066
1078
  // The depth component of the "depth24plus" and "depth24plus-stencil8" formats may be implemented as either a 24-bit depth value or a "depth32float" value.
1067
- "depth24plus-stencil8": { gl: import_constants4.GL.DEPTH_STENCIL, b: 4, c: 2, p: 1, attachment: import_constants4.GL.DEPTH_STENCIL_ATTACHMENT, renderbuffer: true, depthTexture: true },
1079
+ "depth24plus-stencil8": {
1080
+ gl: 35056,
1081
+ b: 4,
1082
+ c: 2,
1083
+ p: 1,
1084
+ attachment: 33306,
1085
+ rb: true,
1086
+ depthTexture: true,
1087
+ dataFormat: 34041,
1088
+ types: [34042]
1089
+ },
1068
1090
  // "depth24unorm-stencil8" feature
1069
- "depth24unorm-stencil8": { gl: import_constants4.GL.DEPTH24_STENCIL8, b: 4, c: 2, p: 1, attachment: import_constants4.GL.DEPTH_STENCIL_ATTACHMENT, renderbuffer: true },
1070
- // "depth32float-stencil8" feature
1071
- "depth32float-stencil8": { gl: import_constants4.GL.DEPTH32F_STENCIL8, b: 5, c: 2, p: 1, attachment: import_constants4.GL.DEPTH_STENCIL_ATTACHMENT, renderbuffer: true },
1091
+ "depth24unorm-stencil8": {
1092
+ gl: 35056,
1093
+ b: 4,
1094
+ c: 2,
1095
+ p: 1,
1096
+ attachment: 33306,
1097
+ dataFormat: 34041,
1098
+ types: [34042],
1099
+ rb: true
1100
+ },
1101
+ // "depth32float-stencil8" feature - TODO below is render buffer only?
1102
+ "depth32float-stencil8": {
1103
+ gl: 36013,
1104
+ b: 5,
1105
+ c: 2,
1106
+ p: 1,
1107
+ attachment: 33306,
1108
+ dataFormat: 34041,
1109
+ types: [36269],
1110
+ rb: true
1111
+ },
1072
1112
  // BC compressed formats: check device.features.has("texture-compression-bc");
1073
- "bc1-rgb-unorm-webgl": { gl: import_constants4.GL.COMPRESSED_RGB_S3TC_DXT1_EXT, x: X_S3TC, f: texture_compression_bc },
1074
- "bc1-rgb-unorm-srgb-webgl": { gl: import_constants4.GL.COMPRESSED_SRGB_S3TC_DXT1_EXT, x: X_S3TC_SRGB, f: texture_compression_bc },
1075
- "bc1-rgba-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_S3TC_DXT1_EXT, x: X_S3TC, f: texture_compression_bc },
1076
- "bc1-rgba-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB_S3TC_DXT1_EXT, x: X_S3TC_SRGB, f: texture_compression_bc },
1077
- "bc2-rgba-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_S3TC_DXT3_EXT, x: X_S3TC, f: texture_compression_bc },
1078
- "bc2-rgba-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, x: X_S3TC_SRGB, f: texture_compression_bc },
1079
- "bc3-rgba-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_S3TC_DXT5_EXT, x: X_S3TC, f: texture_compression_bc },
1080
- "bc3-rgba-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, x: X_S3TC_SRGB, f: texture_compression_bc },
1081
- "bc4-r-unorm": { gl: import_constants4.GL.COMPRESSED_RED_RGTC1_EXT, x: X_RGTC, f: texture_compression_bc },
1082
- "bc4-r-snorm": { gl: import_constants4.GL.COMPRESSED_SIGNED_RED_RGTC1_EXT, x: X_RGTC, f: texture_compression_bc },
1083
- "bc5-rg-unorm": { gl: import_constants4.GL.COMPRESSED_RED_GREEN_RGTC2_EXT, x: X_RGTC, f: texture_compression_bc },
1084
- "bc5-rg-snorm": { gl: import_constants4.GL.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, x: X_RGTC, f: texture_compression_bc },
1085
- "bc6h-rgb-ufloat": { gl: import_constants4.GL.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, x: X_BPTC, f: texture_compression_bc },
1086
- "bc6h-rgb-float": { gl: import_constants4.GL.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, x: X_BPTC, f: texture_compression_bc },
1087
- "bc7-rgba-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_BPTC_UNORM_EXT, x: X_BPTC, f: texture_compression_bc },
1088
- "bc7-rgba-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, x: X_BPTC, f: texture_compression_bc },
1113
+ "bc1-rgb-unorm-webgl": { gl: 33776, x: X_S3TC, f: texture_compression_bc },
1114
+ "bc1-rgb-unorm-srgb-webgl": { gl: 35916, x: X_S3TC_SRGB, f: texture_compression_bc },
1115
+ "bc1-rgba-unorm": { gl: 33777, x: X_S3TC, f: texture_compression_bc },
1116
+ "bc1-rgba-unorm-srgb": { gl: 35916, x: X_S3TC_SRGB, f: texture_compression_bc },
1117
+ "bc2-rgba-unorm": { gl: 33778, x: X_S3TC, f: texture_compression_bc },
1118
+ "bc2-rgba-unorm-srgb": { gl: 35918, x: X_S3TC_SRGB, f: texture_compression_bc },
1119
+ "bc3-rgba-unorm": { gl: 33779, x: X_S3TC, f: texture_compression_bc },
1120
+ "bc3-rgba-unorm-srgb": { gl: 35919, x: X_S3TC_SRGB, f: texture_compression_bc },
1121
+ "bc4-r-unorm": { gl: 36283, x: X_RGTC, f: texture_compression_bc },
1122
+ "bc4-r-snorm": { gl: 36284, x: X_RGTC, f: texture_compression_bc },
1123
+ "bc5-rg-unorm": { gl: 36285, x: X_RGTC, f: texture_compression_bc },
1124
+ "bc5-rg-snorm": { gl: 36286, x: X_RGTC, f: texture_compression_bc },
1125
+ "bc6h-rgb-ufloat": { gl: 36495, x: X_BPTC, f: texture_compression_bc },
1126
+ "bc6h-rgb-float": { gl: 36494, x: X_BPTC, f: texture_compression_bc },
1127
+ "bc7-rgba-unorm": { gl: 36492, x: X_BPTC, f: texture_compression_bc },
1128
+ "bc7-rgba-unorm-srgb": { gl: 36493, x: X_BPTC, f: texture_compression_bc },
1089
1129
  // WEBGL_compressed_texture_etc: device.features.has("texture-compression-etc2")
1090
1130
  // Note: Supposedly guaranteed availability compressed formats in WebGL2, but through CPU decompression
1091
- "etc2-rgb8unorm": { gl: import_constants4.GL.COMPRESSED_RGB8_ETC2, f: texture_compression_etc2 },
1092
- "etc2-rgb8unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_ETC2, f: texture_compression_etc2 },
1093
- "etc2-rgb8a1unorm": { gl: import_constants4.GL.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, f: texture_compression_etc2 },
1094
- "etc2-rgb8a1unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, f: texture_compression_etc2 },
1095
- "etc2-rgba8unorm": { gl: import_constants4.GL.COMPRESSED_RGBA8_ETC2_EAC, f: texture_compression_etc2 },
1096
- "etc2-rgba8unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, f: texture_compression_etc2 },
1097
- "eac-r11unorm": { gl: import_constants4.GL.COMPRESSED_R11_EAC, f: texture_compression_etc2 },
1098
- "eac-r11snorm": { gl: import_constants4.GL.COMPRESSED_SIGNED_R11_EAC, f: texture_compression_etc2 },
1099
- "eac-rg11unorm": { gl: import_constants4.GL.COMPRESSED_RG11_EAC, f: texture_compression_etc2 },
1100
- "eac-rg11snorm": { gl: import_constants4.GL.COMPRESSED_SIGNED_RG11_EAC, f: texture_compression_etc2 },
1131
+ "etc2-rgb8unorm": { gl: 37492, f: texture_compression_etc2 },
1132
+ "etc2-rgb8unorm-srgb": { gl: 37494, f: texture_compression_etc2 },
1133
+ "etc2-rgb8a1unorm": { gl: 37496, f: texture_compression_etc2 },
1134
+ "etc2-rgb8a1unorm-srgb": { gl: 37497, f: texture_compression_etc2 },
1135
+ "etc2-rgba8unorm": { gl: 37493, f: texture_compression_etc2 },
1136
+ "etc2-rgba8unorm-srgb": { gl: 37495, f: texture_compression_etc2 },
1137
+ "eac-r11unorm": { gl: 37488, f: texture_compression_etc2 },
1138
+ "eac-r11snorm": { gl: 37489, f: texture_compression_etc2 },
1139
+ "eac-rg11unorm": { gl: 37490, f: texture_compression_etc2 },
1140
+ "eac-rg11snorm": { gl: 37491, f: texture_compression_etc2 },
1101
1141
  // X_ASTC compressed formats: device.features.has("texture-compression-astc")
1102
- "astc-4x4-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_ASTC_4x4_KHR, f: texture_compression_astc },
1103
- "astc-4x4-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, f: texture_compression_astc },
1104
- "astc-5x4-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_ASTC_5x4_KHR, f: texture_compression_astc },
1105
- "astc-5x4-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, f: texture_compression_astc },
1106
- "astc-5x5-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_ASTC_5x5_KHR, f: texture_compression_astc },
1107
- "astc-5x5-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, f: texture_compression_astc },
1108
- "astc-6x5-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_ASTC_6x5_KHR, f: texture_compression_astc },
1109
- "astc-6x5-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, f: texture_compression_astc },
1110
- "astc-6x6-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_ASTC_6x6_KHR, f: texture_compression_astc },
1111
- "astc-6x6-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, f: texture_compression_astc },
1112
- "astc-8x5-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_ASTC_8x5_KHR, f: texture_compression_astc },
1113
- "astc-8x5-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, f: texture_compression_astc },
1114
- "astc-8x6-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_ASTC_8x6_KHR, f: texture_compression_astc },
1115
- "astc-8x6-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, f: texture_compression_astc },
1116
- "astc-8x8-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_ASTC_8x8_KHR, f: texture_compression_astc },
1117
- "astc-8x8-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, f: texture_compression_astc },
1118
- "astc-10x5-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_ASTC_10x10_KHR, f: texture_compression_astc },
1119
- "astc-10x5-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, f: texture_compression_astc },
1120
- "astc-10x6-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_ASTC_10x6_KHR, f: texture_compression_astc },
1121
- "astc-10x6-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, f: texture_compression_astc },
1122
- "astc-10x8-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_ASTC_10x8_KHR, f: texture_compression_astc },
1123
- "astc-10x8-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, f: texture_compression_astc },
1124
- "astc-10x10-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_ASTC_10x10_KHR, f: texture_compression_astc },
1125
- "astc-10x10-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, f: texture_compression_astc },
1126
- "astc-12x10-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_ASTC_12x10_KHR, f: texture_compression_astc },
1127
- "astc-12x10-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, f: texture_compression_astc },
1128
- "astc-12x12-unorm": { gl: import_constants4.GL.COMPRESSED_RGBA_ASTC_12x12_KHR, f: texture_compression_astc },
1129
- "astc-12x12-unorm-srgb": { gl: import_constants4.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, f: texture_compression_astc },
1142
+ "astc-4x4-unorm": { gl: 37808, f: texture_compression_astc },
1143
+ "astc-4x4-unorm-srgb": { gl: 37840, f: texture_compression_astc },
1144
+ "astc-5x4-unorm": { gl: 37809, f: texture_compression_astc },
1145
+ "astc-5x4-unorm-srgb": { gl: 37841, f: texture_compression_astc },
1146
+ "astc-5x5-unorm": { gl: 37810, f: texture_compression_astc },
1147
+ "astc-5x5-unorm-srgb": { gl: 37842, f: texture_compression_astc },
1148
+ "astc-6x5-unorm": { gl: 37811, f: texture_compression_astc },
1149
+ "astc-6x5-unorm-srgb": { gl: 37843, f: texture_compression_astc },
1150
+ "astc-6x6-unorm": { gl: 37812, f: texture_compression_astc },
1151
+ "astc-6x6-unorm-srgb": { gl: 37844, f: texture_compression_astc },
1152
+ "astc-8x5-unorm": { gl: 37813, f: texture_compression_astc },
1153
+ "astc-8x5-unorm-srgb": { gl: 37845, f: texture_compression_astc },
1154
+ "astc-8x6-unorm": { gl: 37814, f: texture_compression_astc },
1155
+ "astc-8x6-unorm-srgb": { gl: 37846, f: texture_compression_astc },
1156
+ "astc-8x8-unorm": { gl: 37815, f: texture_compression_astc },
1157
+ "astc-8x8-unorm-srgb": { gl: 37847, f: texture_compression_astc },
1158
+ "astc-10x5-unorm": { gl: 37819, f: texture_compression_astc },
1159
+ "astc-10x5-unorm-srgb": { gl: 37851, f: texture_compression_astc },
1160
+ "astc-10x6-unorm": { gl: 37817, f: texture_compression_astc },
1161
+ "astc-10x6-unorm-srgb": { gl: 37849, f: texture_compression_astc },
1162
+ "astc-10x8-unorm": { gl: 37818, f: texture_compression_astc },
1163
+ "astc-10x8-unorm-srgb": { gl: 37850, f: texture_compression_astc },
1164
+ "astc-10x10-unorm": { gl: 37819, f: texture_compression_astc },
1165
+ "astc-10x10-unorm-srgb": { gl: 37851, f: texture_compression_astc },
1166
+ "astc-12x10-unorm": { gl: 37820, f: texture_compression_astc },
1167
+ "astc-12x10-unorm-srgb": { gl: 37852, f: texture_compression_astc },
1168
+ "astc-12x12-unorm": { gl: 37821, f: texture_compression_astc },
1169
+ "astc-12x12-unorm-srgb": { gl: 37853, f: texture_compression_astc },
1130
1170
  // WEBGL_compressed_texture_pvrtc
1131
- "pvrtc-rgb4unorm-webgl": { gl: import_constants4.GL.COMPRESSED_RGB_PVRTC_4BPPV1_IMG, f: texture_compression_pvrtc_webgl },
1132
- "pvrtc-rgba4unorm-webgl": { gl: import_constants4.GL.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, f: texture_compression_pvrtc_webgl },
1133
- "pvrtc-rbg2unorm-webgl": { gl: import_constants4.GL.COMPRESSED_RGB_PVRTC_2BPPV1_IMG, f: texture_compression_pvrtc_webgl },
1134
- "pvrtc-rgba2unorm-webgl": { gl: import_constants4.GL.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, f: texture_compression_pvrtc_webgl },
1171
+ "pvrtc-rgb4unorm-webgl": { gl: 35840, f: texture_compression_pvrtc_webgl },
1172
+ "pvrtc-rgba4unorm-webgl": { gl: 35842, f: texture_compression_pvrtc_webgl },
1173
+ "pvrtc-rbg2unorm-webgl": { gl: 35841, f: texture_compression_pvrtc_webgl },
1174
+ "pvrtc-rgba2unorm-webgl": { gl: 35843, f: texture_compression_pvrtc_webgl },
1135
1175
  // WEBGL_compressed_texture_etc1
1136
- "etc1-rbg-unorm-webgl": { gl: import_constants4.GL.COMPRESSED_RGB_ETC1_WEBGL, f: texture_compression_etc1_webgl },
1176
+ "etc1-rbg-unorm-webgl": { gl: 36196, f: texture_compression_etc1_webgl },
1137
1177
  // WEBGL_compressed_texture_atc
1138
- "atc-rgb-unorm-webgl": { gl: import_constants4.GL.COMPRESSED_RGB_ATC_WEBGL, f: texture_compression_atc_webgl },
1139
- "atc-rgba-unorm-webgl": { gl: import_constants4.GL.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL, f: texture_compression_atc_webgl },
1140
- "atc-rgbai-unorm-webgl": { gl: import_constants4.GL.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL, f: texture_compression_atc_webgl }
1178
+ "atc-rgb-unorm-webgl": { gl: 35986, f: texture_compression_atc_webgl },
1179
+ "atc-rgba-unorm-webgl": { gl: 35986, f: texture_compression_atc_webgl },
1180
+ "atc-rgbai-unorm-webgl": { gl: 34798, f: texture_compression_atc_webgl }
1141
1181
  };
1142
1182
  var DATA_FORMAT_CHANNELS = {
1143
- [import_constants4.GL.RED]: 1,
1144
- [import_constants4.GL.RED_INTEGER]: 1,
1145
- [import_constants4.GL.RG]: 2,
1146
- [import_constants4.GL.RG_INTEGER]: 2,
1147
- [import_constants4.GL.RGB]: 3,
1148
- [import_constants4.GL.RGB_INTEGER]: 3,
1149
- [import_constants4.GL.RGBA]: 4,
1150
- [import_constants4.GL.RGBA_INTEGER]: 4,
1151
- [import_constants4.GL.DEPTH_COMPONENT]: 1,
1152
- [import_constants4.GL.DEPTH_STENCIL]: 1,
1153
- [import_constants4.GL.ALPHA]: 1,
1154
- [import_constants4.GL.LUMINANCE]: 1,
1155
- [import_constants4.GL.LUMINANCE_ALPHA]: 2
1183
+ [6403]: 1,
1184
+ [36244]: 1,
1185
+ [33319]: 2,
1186
+ [33320]: 2,
1187
+ [6407]: 3,
1188
+ [36248]: 3,
1189
+ [6408]: 4,
1190
+ [36249]: 4,
1191
+ [6402]: 1,
1192
+ [34041]: 1,
1193
+ [6406]: 1,
1194
+ [6409]: 1,
1195
+ [6410]: 2
1156
1196
  };
1157
1197
  var TYPE_SIZES = {
1158
- [import_constants4.GL.FLOAT]: 4,
1159
- [import_constants4.GL.UNSIGNED_INT]: 4,
1160
- [import_constants4.GL.INT]: 4,
1161
- [import_constants4.GL.UNSIGNED_SHORT]: 2,
1162
- [import_constants4.GL.SHORT]: 2,
1163
- [import_constants4.GL.HALF_FLOAT]: 2,
1164
- [import_constants4.GL.BYTE]: 1,
1165
- [import_constants4.GL.UNSIGNED_BYTE]: 1
1198
+ [5126]: 4,
1199
+ [5125]: 4,
1200
+ [5124]: 4,
1201
+ [5123]: 2,
1202
+ [5122]: 2,
1203
+ [5131]: 2,
1204
+ [5120]: 1,
1205
+ [5121]: 1
1166
1206
  };
1167
- function isTextureFormatSupported(gl, formatOrGL, extensions) {
1168
- const format = convertGLToTextureFormat(formatOrGL);
1207
+ function isTextureFormatSupported(gl, format, extensions) {
1169
1208
  const info = TEXTURE_FORMATS[format];
1170
1209
  if (!info) {
1171
1210
  return false;
@@ -1181,7 +1220,7 @@ function isTextureFormatSupported(gl, formatOrGL, extensions) {
1181
1220
  }
1182
1221
  function isRenderbufferFormatSupported(gl, format, extensions) {
1183
1222
  var _a;
1184
- return isTextureFormatSupported(gl, format, extensions) && ((_a = TEXTURE_FORMATS[format]) == null ? void 0 : _a.renderbuffer);
1223
+ return isTextureFormatSupported(gl, format, extensions) && ((_a = TEXTURE_FORMATS[format]) == null ? void 0 : _a.rb);
1185
1224
  }
1186
1225
  function convertGLToTextureFormat(format) {
1187
1226
  if (typeof format === "string") {
@@ -1201,11 +1240,13 @@ function convertTextureFormatToGL(format) {
1201
1240
  }
1202
1241
  return webglFormat;
1203
1242
  }
1204
- function isTextureFormatFilterable(gl, formatOrGL, extensions) {
1205
- const format = convertGLToTextureFormat(formatOrGL);
1243
+ function isTextureFormatFilterable(gl, format, extensions) {
1206
1244
  if (!isTextureFormatSupported(gl, format, extensions)) {
1207
1245
  return false;
1208
1246
  }
1247
+ if (format.startsWith("depth") || format.startsWith("stencil")) {
1248
+ return false;
1249
+ }
1209
1250
  try {
1210
1251
  const decoded = (0, import_core2.decodeTextureFormat)(format);
1211
1252
  if (decoded.signed) {
@@ -1222,8 +1263,7 @@ function isTextureFormatFilterable(gl, formatOrGL, extensions) {
1222
1263
  }
1223
1264
  return true;
1224
1265
  }
1225
- function isTextureFormatRenderable(gl, formatOrGL, extensions) {
1226
- const format = convertGLToTextureFormat(formatOrGL);
1266
+ function isTextureFormatRenderable(gl, format, extensions) {
1227
1267
  if (!isTextureFormatSupported(gl, format, extensions)) {
1228
1268
  return false;
1229
1269
  }
@@ -1232,15 +1272,16 @@ function isTextureFormatRenderable(gl, formatOrGL, extensions) {
1232
1272
  }
1233
1273
  return true;
1234
1274
  }
1235
- function getWebGLTextureParameters(formatOrGL) {
1236
- const format = convertGLToTextureFormat(formatOrGL);
1275
+ function getWebGLTextureParameters(format) {
1276
+ var _a;
1277
+ const formatData = TEXTURE_FORMATS[format];
1237
1278
  const webglFormat = convertTextureFormatToGL(format);
1238
1279
  const decoded = (0, import_core2.decodeTextureFormat)(format);
1239
1280
  return {
1240
1281
  format: webglFormat,
1241
- dataFormat: getWebGLPixelDataFormat(decoded.format, decoded.integer, decoded.normalized, webglFormat),
1282
+ dataFormat: (formatData == null ? void 0 : formatData.dataFormat) || getWebGLPixelDataFormat(decoded.format, decoded.integer, decoded.normalized, webglFormat),
1242
1283
  // depth formats don't have a type
1243
- type: decoded.dataType ? getGLFromVertexType(decoded.dataType) : import_constants4.GL.UNSIGNED_BYTE,
1284
+ type: decoded.dataType ? getGLFromVertexType(decoded.dataType) : ((_a = formatData == null ? void 0 : formatData.types) == null ? void 0 : _a[0]) || 5121,
1244
1285
  // @ts-expect-error
1245
1286
  compressed: decoded.compressed
1246
1287
  };
@@ -1252,28 +1293,27 @@ function getDepthStencilAttachmentWebGL(format) {
1252
1293
  }
1253
1294
  return info.attachment;
1254
1295
  }
1255
- function getTextureFormatBytesPerPixel(formatOrGL) {
1256
- const format = convertGLToTextureFormat(formatOrGL);
1296
+ function getTextureFormatBytesPerPixel(format) {
1257
1297
  const params = getWebGLTextureParameters(format);
1258
1298
  const channels = DATA_FORMAT_CHANNELS[params.dataFormat] || 4;
1259
1299
  const channelSize = TYPE_SIZES[params.type] || 1;
1260
1300
  return channels * channelSize;
1261
1301
  }
1262
1302
  function getWebGLPixelDataFormat(dataFormat, integer, normalized, format) {
1263
- if (format === import_constants4.GL.RGBA || format === import_constants4.GL.RGB) {
1303
+ if (format === 6408 || format === 6407) {
1264
1304
  return format;
1265
1305
  }
1266
1306
  switch (dataFormat) {
1267
1307
  case "r":
1268
- return integer && !normalized ? import_constants4.GL.RED_INTEGER : import_constants4.GL.RED;
1308
+ return integer && !normalized ? 36244 : 6403;
1269
1309
  case "rg":
1270
- return integer && !normalized ? import_constants4.GL.RG_INTEGER : import_constants4.GL.RG;
1310
+ return integer && !normalized ? 33320 : 33319;
1271
1311
  case "rgb":
1272
- return integer && !normalized ? import_constants4.GL.RGB_INTEGER : import_constants4.GL.RGB;
1312
+ return integer && !normalized ? 36248 : 6407;
1273
1313
  case "rgba":
1274
- return integer && !normalized ? import_constants4.GL.RGBA_INTEGER : import_constants4.GL.RGBA;
1314
+ return integer && !normalized ? 36249 : 6408;
1275
1315
  default:
1276
- return import_constants4.GL.RGBA;
1316
+ return 6408;
1277
1317
  }
1278
1318
  }
1279
1319
 
@@ -1301,8 +1341,8 @@ var WebGLDeviceFeatures = class extends import_core3.DeviceFeatures {
1301
1341
  gl;
1302
1342
  extensions;
1303
1343
  testedFeatures = /* @__PURE__ */ new Set();
1304
- constructor(gl, extensions) {
1305
- super();
1344
+ constructor(gl, extensions, disabledFeatures) {
1345
+ super([], disabledFeatures);
1306
1346
  this.gl = gl;
1307
1347
  this.extensions = extensions;
1308
1348
  getWebGLExtension(gl, "EXT_color_buffer_float", extensions);
@@ -1321,6 +1361,9 @@ var WebGLDeviceFeatures = class extends import_core3.DeviceFeatures {
1321
1361
  return [];
1322
1362
  }
1323
1363
  has(feature) {
1364
+ if (this.disabledFeatures[feature]) {
1365
+ return false;
1366
+ }
1324
1367
  if (!this.testedFeatures.has(feature)) {
1325
1368
  this.testedFeatures.add(feature);
1326
1369
  if (isTextureFeature(feature) && checkTextureFeature(this.gl, feature, this.extensions)) {
@@ -1332,6 +1375,12 @@ var WebGLDeviceFeatures = class extends import_core3.DeviceFeatures {
1332
1375
  }
1333
1376
  return this.features.has(feature);
1334
1377
  }
1378
+ // FOR DEVICE
1379
+ initializeFeatures() {
1380
+ for (const feature of this) {
1381
+ }
1382
+ }
1383
+ // IMPLEMENTATION
1335
1384
  /** Extract all WebGL features */
1336
1385
  getWebGLFeature(feature) {
1337
1386
  const featureInfo = WEBGL_FEATURES[feature];
@@ -1349,13 +1398,13 @@ var WebGLDeviceLimits = class extends import_core4.DeviceLimits {
1349
1398
  }
1350
1399
  // WebGL does not support 1D textures
1351
1400
  get maxTextureDimension2D() {
1352
- return this.getParameter(import_constants5.GL.MAX_TEXTURE_SIZE);
1401
+ return this.getParameter(3379);
1353
1402
  }
1354
1403
  get maxTextureDimension3D() {
1355
- return this.getParameter(import_constants5.GL.MAX_3D_TEXTURE_SIZE);
1404
+ return this.getParameter(32883);
1356
1405
  }
1357
1406
  get maxTextureArrayLayers() {
1358
- return this.getParameter(import_constants5.GL.MAX_ARRAY_TEXTURE_LAYERS);
1407
+ return this.getParameter(35071);
1359
1408
  }
1360
1409
  get maxBindGroups() {
1361
1410
  return 0;
@@ -1369,11 +1418,11 @@ var WebGLDeviceLimits = class extends import_core4.DeviceLimits {
1369
1418
  }
1370
1419
  // TBD
1371
1420
  get maxSampledTexturesPerShaderStage() {
1372
- return this.getParameter(import_constants5.GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
1421
+ return this.getParameter(35660);
1373
1422
  }
1374
1423
  // ) TBD
1375
1424
  get maxSamplersPerShaderStage() {
1376
- return this.getParameter(import_constants5.GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS);
1425
+ return this.getParameter(35661);
1377
1426
  }
1378
1427
  get maxStorageBuffersPerShaderStage() {
1379
1428
  return 0;
@@ -1384,16 +1433,16 @@ var WebGLDeviceLimits = class extends import_core4.DeviceLimits {
1384
1433
  }
1385
1434
  // TBD
1386
1435
  get maxUniformBuffersPerShaderStage() {
1387
- return this.getParameter(import_constants5.GL.MAX_UNIFORM_BUFFER_BINDINGS);
1436
+ return this.getParameter(35375);
1388
1437
  }
1389
1438
  get maxUniformBufferBindingSize() {
1390
- return this.getParameter(import_constants5.GL.MAX_UNIFORM_BLOCK_SIZE);
1439
+ return this.getParameter(35376);
1391
1440
  }
1392
1441
  get maxStorageBufferBindingSize() {
1393
1442
  return 0;
1394
1443
  }
1395
1444
  get minUniformBufferOffsetAlignment() {
1396
- return this.getParameter(import_constants5.GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT);
1445
+ return this.getParameter(35380);
1397
1446
  }
1398
1447
  get minStorageBufferOffsetAlignment() {
1399
1448
  return 0;
@@ -1403,14 +1452,14 @@ var WebGLDeviceLimits = class extends import_core4.DeviceLimits {
1403
1452
  }
1404
1453
  // WebGL 2 supports 16 buffers, see https://github.com/gpuweb/gpuweb/issues/4284
1405
1454
  get maxVertexAttributes() {
1406
- return this.getParameter(import_constants5.GL.MAX_VERTEX_ATTRIBS);
1455
+ return this.getParameter(34921);
1407
1456
  }
1408
1457
  get maxVertexBufferArrayStride() {
1409
1458
  return 2048;
1410
1459
  }
1411
1460
  // TBD, this is just the default value from WebGPU
1412
1461
  get maxInterStageShaderComponents() {
1413
- return this.getParameter(import_constants5.GL.MAX_VARYING_COMPONENTS);
1462
+ return this.getParameter(35659);
1414
1463
  }
1415
1464
  get maxComputeWorkgroupStorageSize() {
1416
1465
  return 0;
@@ -1452,22 +1501,20 @@ var WebGLDeviceLimits = class extends import_core4.DeviceLimits {
1452
1501
  };
1453
1502
 
1454
1503
  // dist/adapter/webgl-canvas-context.js
1455
- var import_core13 = require("@luma.gl/core");
1504
+ var import_core11 = require("@luma.gl/core");
1456
1505
 
1457
1506
  // dist/adapter/resources/webgl-framebuffer.js
1458
- var import_core12 = require("@luma.gl/core");
1459
- var import_constants12 = require("@luma.gl/constants");
1507
+ var import_core10 = require("@luma.gl/core");
1508
+ var import_constants11 = require("@luma.gl/constants");
1460
1509
 
1461
1510
  // dist/adapter/resources/webgl-texture.js
1462
1511
  var import_core9 = require("@luma.gl/core");
1463
1512
  var import_constants10 = require("@luma.gl/constants");
1464
1513
 
1465
1514
  // dist/context/state-tracker/with-parameters.js
1466
- function withGLParameters(device, parameters, func) {
1467
- const webglDevice = WebGLDevice.attach(device);
1468
- const gl = webglDevice.gl;
1515
+ function withGLParameters(gl, parameters, func) {
1469
1516
  if (isObjectEmpty2(parameters)) {
1470
- return func(device);
1517
+ return func(gl);
1471
1518
  }
1472
1519
  const { nocatch = true } = parameters;
1473
1520
  pushContextState(gl);
@@ -1502,13 +1549,14 @@ function withDeviceAndGLParameters(device, parameters, glParameters, func) {
1502
1549
  if ((0, import_core5.isObjectEmpty)(parameters)) {
1503
1550
  return func(device);
1504
1551
  }
1505
- pushContextState(device.gl);
1552
+ const webglDevice = device;
1553
+ pushContextState(webglDevice.gl);
1506
1554
  try {
1507
1555
  setDeviceParameters(device, parameters);
1508
- setGLParameters(device, glParameters);
1556
+ setGLParameters(webglDevice.gl, glParameters);
1509
1557
  return func(device);
1510
1558
  } finally {
1511
- popContextState(device.gl);
1559
+ popContextState(webglDevice.gl);
1512
1560
  }
1513
1561
  }
1514
1562
  function withDeviceParameters(device, parameters, func) {
@@ -1524,32 +1572,32 @@ function withDeviceParameters(device, parameters, func) {
1524
1572
  }
1525
1573
  }
1526
1574
  function setDeviceParameters(device, parameters) {
1527
- const webglDevice = WebGLDevice.attach(device);
1575
+ const webglDevice = device;
1528
1576
  const { gl } = webglDevice;
1529
1577
  if (parameters.cullMode) {
1530
1578
  switch (parameters.cullMode) {
1531
1579
  case "none":
1532
- gl.disable(import_constants6.GL.CULL_FACE);
1580
+ gl.disable(2884);
1533
1581
  break;
1534
1582
  case "front":
1535
- gl.enable(import_constants6.GL.CULL_FACE);
1536
- gl.cullFace(import_constants6.GL.FRONT);
1583
+ gl.enable(2884);
1584
+ gl.cullFace(1028);
1537
1585
  break;
1538
1586
  case "back":
1539
- gl.enable(import_constants6.GL.CULL_FACE);
1540
- gl.cullFace(import_constants6.GL.BACK);
1587
+ gl.enable(2884);
1588
+ gl.cullFace(1029);
1541
1589
  break;
1542
1590
  }
1543
1591
  }
1544
1592
  if (parameters.frontFace) {
1545
1593
  gl.frontFace(map("frontFace", parameters.frontFace, {
1546
- ccw: import_constants6.GL.CCW,
1547
- cw: import_constants6.GL.CW
1594
+ ccw: 2305,
1595
+ cw: 2304
1548
1596
  }));
1549
1597
  }
1550
1598
  if (parameters.unclippedDepth) {
1551
1599
  if (device.features.has("depth-clip-control")) {
1552
- gl.enable(import_constants6.GL.DEPTH_CLAMP_EXT);
1600
+ gl.enable(34383);
1553
1601
  }
1554
1602
  }
1555
1603
  if (parameters.depthBias !== void 0) {
@@ -1560,8 +1608,8 @@ function setDeviceParameters(device, parameters) {
1560
1608
  const ext = extensions.WEBGL_provoking_vertex;
1561
1609
  if (parameters.provokingVertex) {
1562
1610
  const vertex = map("provokingVertex", parameters.provokingVertex, {
1563
- first: import_constants6.GL.FIRST_VERTEX_CONVENTION_WEBGL,
1564
- last: import_constants6.GL.LAST_VERTEX_CONVENTION_WEBGL
1611
+ first: 36429,
1612
+ last: 36430
1565
1613
  });
1566
1614
  ext == null ? void 0 : ext.provokingVertexWEBGL(vertex);
1567
1615
  }
@@ -1571,53 +1619,53 @@ function setDeviceParameters(device, parameters) {
1571
1619
  const ext = extensions.WEBGL_polygon_mode;
1572
1620
  if (parameters.polygonMode) {
1573
1621
  const mode = map("polygonMode", parameters.provokingVertex, {
1574
- fill: import_constants6.GL.FILL_WEBGL,
1575
- lint: import_constants6.GL.LINE_WEBGL
1622
+ fill: 6914,
1623
+ lint: 6913
1576
1624
  });
1577
- ext == null ? void 0 : ext.polygonModeWEBGL(import_constants6.GL.FRONT, mode);
1578
- ext == null ? void 0 : ext.polygonModeWEBGL(import_constants6.GL.BACK, mode);
1625
+ ext == null ? void 0 : ext.polygonModeWEBGL(1028, mode);
1626
+ ext == null ? void 0 : ext.polygonModeWEBGL(1029, mode);
1579
1627
  }
1580
1628
  if (parameters.polygonOffsetLine) {
1581
- gl.enable(import_constants6.GL.POLYGON_OFFSET_LINE_WEBGL);
1629
+ gl.enable(10754);
1582
1630
  }
1583
1631
  }
1584
1632
  if (device.features.has("shader-clip-cull-distance-webgl")) {
1585
1633
  if (parameters.clipDistance0) {
1586
- gl.enable(import_constants6.GL.CLIP_DISTANCE0_WEBGL);
1634
+ gl.enable(12288);
1587
1635
  }
1588
1636
  if (parameters.clipDistance1) {
1589
- gl.enable(import_constants6.GL.CLIP_DISTANCE1_WEBGL);
1637
+ gl.enable(12289);
1590
1638
  }
1591
1639
  if (parameters.clipDistance2) {
1592
- gl.enable(import_constants6.GL.CLIP_DISTANCE2_WEBGL);
1640
+ gl.enable(12290);
1593
1641
  }
1594
1642
  if (parameters.clipDistance3) {
1595
- gl.enable(import_constants6.GL.CLIP_DISTANCE3_WEBGL);
1643
+ gl.enable(12291);
1596
1644
  }
1597
1645
  if (parameters.clipDistance4) {
1598
- gl.enable(import_constants6.GL.CLIP_DISTANCE4_WEBGL);
1646
+ gl.enable(12292);
1599
1647
  }
1600
1648
  if (parameters.clipDistance5) {
1601
- gl.enable(import_constants6.GL.CLIP_DISTANCE5_WEBGL);
1649
+ gl.enable(12293);
1602
1650
  }
1603
1651
  if (parameters.clipDistance6) {
1604
- gl.enable(import_constants6.GL.CLIP_DISTANCE6_WEBGL);
1652
+ gl.enable(12294);
1605
1653
  }
1606
1654
  if (parameters.clipDistance7) {
1607
- gl.enable(import_constants6.GL.CLIP_DISTANCE7_WEBGL);
1655
+ gl.enable(12295);
1608
1656
  }
1609
1657
  }
1610
1658
  if (parameters.depthWriteEnabled !== void 0) {
1611
1659
  gl.depthMask(mapBoolean("depthWriteEnabled", parameters.depthWriteEnabled));
1612
1660
  }
1613
1661
  if (parameters.depthCompare) {
1614
- parameters.depthCompare !== "always" ? gl.enable(import_constants6.GL.DEPTH_TEST) : gl.disable(import_constants6.GL.DEPTH_TEST);
1662
+ parameters.depthCompare !== "always" ? gl.enable(2929) : gl.disable(2929);
1615
1663
  gl.depthFunc(convertCompareFunction("depthCompare", parameters.depthCompare));
1616
1664
  }
1617
1665
  if (parameters.stencilWriteMask) {
1618
1666
  const mask = parameters.stencilWriteMask;
1619
- gl.stencilMaskSeparate(import_constants6.GL.FRONT, mask);
1620
- gl.stencilMaskSeparate(import_constants6.GL.BACK, mask);
1667
+ gl.stencilMaskSeparate(1028, mask);
1668
+ gl.stencilMaskSeparate(1029, mask);
1621
1669
  }
1622
1670
  if (parameters.stencilReadMask) {
1623
1671
  import_core5.log.warn("stencilReadMask not supported under WebGL");
@@ -1625,19 +1673,19 @@ function setDeviceParameters(device, parameters) {
1625
1673
  if (parameters.stencilCompare) {
1626
1674
  const mask = parameters.stencilReadMask || 4294967295;
1627
1675
  const glValue = convertCompareFunction("depthCompare", parameters.stencilCompare);
1628
- parameters.stencilCompare !== "always" ? gl.enable(import_constants6.GL.STENCIL_TEST) : gl.disable(import_constants6.GL.STENCIL_TEST);
1629
- gl.stencilFuncSeparate(import_constants6.GL.FRONT, glValue, 0, mask);
1630
- gl.stencilFuncSeparate(import_constants6.GL.BACK, glValue, 0, mask);
1676
+ parameters.stencilCompare !== "always" ? gl.enable(2960) : gl.disable(2960);
1677
+ gl.stencilFuncSeparate(1028, glValue, 0, mask);
1678
+ gl.stencilFuncSeparate(1029, glValue, 0, mask);
1631
1679
  }
1632
1680
  if (parameters.stencilPassOperation && parameters.stencilFailOperation && parameters.stencilDepthFailOperation) {
1633
1681
  const dppass = convertStencilOperation("stencilPassOperation", parameters.stencilPassOperation);
1634
1682
  const sfail = convertStencilOperation("stencilFailOperation", parameters.stencilFailOperation);
1635
1683
  const dpfail = convertStencilOperation("stencilDepthFailOperation", parameters.stencilDepthFailOperation);
1636
- gl.stencilOpSeparate(import_constants6.GL.FRONT, sfail, dpfail, dppass);
1637
- gl.stencilOpSeparate(import_constants6.GL.BACK, sfail, dpfail, dppass);
1684
+ gl.stencilOpSeparate(1028, sfail, dpfail, dppass);
1685
+ gl.stencilOpSeparate(1029, sfail, dpfail, dppass);
1638
1686
  }
1639
1687
  if (parameters.blendColorOperation || parameters.blendAlphaOperation) {
1640
- gl.enable(import_constants6.GL.BLEND);
1688
+ gl.enable(3042);
1641
1689
  const colorEquation = convertBlendOperationToEquation("blendColorOperation", parameters.blendColorOperation || "add");
1642
1690
  const alphaEquation = convertBlendOperationToEquation("blendAlphaOperation", parameters.blendAlphaOperation || "add");
1643
1691
  gl.blendEquationSeparate(colorEquation, alphaEquation);
@@ -1650,49 +1698,49 @@ function setDeviceParameters(device, parameters) {
1650
1698
  }
1651
1699
  function convertCompareFunction(parameter, value) {
1652
1700
  return map(parameter, value, {
1653
- never: import_constants6.GL.NEVER,
1654
- less: import_constants6.GL.LESS,
1655
- equal: import_constants6.GL.EQUAL,
1656
- "less-equal": import_constants6.GL.LEQUAL,
1657
- greater: import_constants6.GL.GREATER,
1658
- "not-equal": import_constants6.GL.NOTEQUAL,
1659
- "greater-equal": import_constants6.GL.GEQUAL,
1660
- always: import_constants6.GL.ALWAYS
1701
+ never: 512,
1702
+ less: 513,
1703
+ equal: 514,
1704
+ "less-equal": 515,
1705
+ greater: 516,
1706
+ "not-equal": 517,
1707
+ "greater-equal": 518,
1708
+ always: 519
1661
1709
  });
1662
1710
  }
1663
1711
  function convertStencilOperation(parameter, value) {
1664
1712
  return map(parameter, value, {
1665
- keep: import_constants6.GL.KEEP,
1666
- zero: import_constants6.GL.ZERO,
1667
- replace: import_constants6.GL.REPLACE,
1668
- invert: import_constants6.GL.INVERT,
1669
- "increment-clamp": import_constants6.GL.INCR,
1670
- "decrement-clamp": import_constants6.GL.DECR,
1671
- "increment-wrap": import_constants6.GL.INCR_WRAP,
1672
- "decrement-wrap": import_constants6.GL.DECR_WRAP
1713
+ keep: 7680,
1714
+ zero: 0,
1715
+ replace: 7681,
1716
+ invert: 5386,
1717
+ "increment-clamp": 7682,
1718
+ "decrement-clamp": 7683,
1719
+ "increment-wrap": 34055,
1720
+ "decrement-wrap": 34056
1673
1721
  });
1674
1722
  }
1675
1723
  function convertBlendOperationToEquation(parameter, value) {
1676
1724
  return map(parameter, value, {
1677
- add: import_constants6.GL.FUNC_ADD,
1678
- subtract: import_constants6.GL.FUNC_SUBTRACT,
1679
- "reverse-subtract": import_constants6.GL.FUNC_REVERSE_SUBTRACT,
1680
- min: import_constants6.GL.MIN,
1681
- max: import_constants6.GL.MAX
1725
+ add: 32774,
1726
+ subtract: 32778,
1727
+ "reverse-subtract": 32779,
1728
+ min: 32775,
1729
+ max: 32776
1682
1730
  });
1683
1731
  }
1684
1732
  function convertBlendFactorToFunction(parameter, value) {
1685
1733
  return map(parameter, value, {
1686
- one: import_constants6.GL.ONE,
1687
- zero: import_constants6.GL.ZERO,
1688
- "src-color": import_constants6.GL.SRC_COLOR,
1689
- "one-minus-src-color": import_constants6.GL.ONE_MINUS_SRC_COLOR,
1690
- "dst-color": import_constants6.GL.DST_COLOR,
1691
- "one-minus-dst-color": import_constants6.GL.ONE_MINUS_DST_COLOR,
1692
- "src-alpha": import_constants6.GL.SRC_ALPHA,
1693
- "one-minus-src-alpha": import_constants6.GL.ONE_MINUS_SRC_ALPHA,
1694
- "dst-alpha": import_constants6.GL.DST_ALPHA,
1695
- "one-minus-dst-alpha": import_constants6.GL.ONE_MINUS_DST_ALPHA
1734
+ one: 1,
1735
+ zero: 0,
1736
+ "src-color": 768,
1737
+ "one-minus-src-color": 769,
1738
+ "dst-color": 774,
1739
+ "one-minus-dst-color": 775,
1740
+ "src-alpha": 770,
1741
+ "one-minus-src-alpha": 771,
1742
+ "dst-alpha": 772,
1743
+ "one-minus-dst-alpha": 773
1696
1744
  });
1697
1745
  }
1698
1746
  function message(parameter, value) {
@@ -1712,53 +1760,53 @@ function mapBoolean(parameter, value) {
1712
1760
  function convertSamplerParametersToWebGL(props) {
1713
1761
  const params = {};
1714
1762
  if (props.addressModeU) {
1715
- params[import_constants7.GL.TEXTURE_WRAP_S] = convertAddressMode(props.addressModeU);
1763
+ params[10242] = convertAddressMode(props.addressModeU);
1716
1764
  }
1717
1765
  if (props.addressModeV) {
1718
- params[import_constants7.GL.TEXTURE_WRAP_T] = convertAddressMode(props.addressModeV);
1766
+ params[10243] = convertAddressMode(props.addressModeV);
1719
1767
  }
1720
1768
  if (props.addressModeW) {
1721
- params[import_constants7.GL.TEXTURE_WRAP_R] = convertAddressMode(props.addressModeW);
1769
+ params[32882] = convertAddressMode(props.addressModeW);
1722
1770
  }
1723
1771
  if (props.magFilter) {
1724
- params[import_constants7.GL.TEXTURE_MAG_FILTER] = convertMaxFilterMode(props.magFilter);
1772
+ params[10240] = convertMaxFilterMode(props.magFilter);
1725
1773
  }
1726
1774
  if (props.minFilter || props.mipmapFilter) {
1727
- params[import_constants7.GL.TEXTURE_MIN_FILTER] = convertMinFilterMode(props.minFilter || "linear", props.mipmapFilter);
1775
+ params[10241] = convertMinFilterMode(props.minFilter || "linear", props.mipmapFilter);
1728
1776
  }
1729
1777
  if (props.lodMinClamp !== void 0) {
1730
- params[import_constants7.GL.TEXTURE_MIN_LOD] = props.lodMinClamp;
1778
+ params[33082] = props.lodMinClamp;
1731
1779
  }
1732
1780
  if (props.lodMaxClamp !== void 0) {
1733
- params[import_constants7.GL.TEXTURE_MAX_LOD] = props.lodMaxClamp;
1781
+ params[33083] = props.lodMaxClamp;
1734
1782
  }
1735
1783
  if (props.type === "comparison-sampler") {
1736
- params[import_constants7.GL.TEXTURE_COMPARE_MODE] = import_constants7.GL.COMPARE_REF_TO_TEXTURE;
1784
+ params[34892] = 34894;
1737
1785
  }
1738
1786
  if (props.compare) {
1739
- params[import_constants7.GL.TEXTURE_COMPARE_FUNC] = convertCompareFunction("compare", props.compare);
1787
+ params[34893] = convertCompareFunction("compare", props.compare);
1740
1788
  }
1741
1789
  if (props.maxAnisotropy) {
1742
- params[import_constants7.GL.TEXTURE_MAX_ANISOTROPY_EXT] = props.maxAnisotropy;
1790
+ params[34046] = props.maxAnisotropy;
1743
1791
  }
1744
1792
  return params;
1745
1793
  }
1746
1794
  function convertAddressMode(addressMode) {
1747
1795
  switch (addressMode) {
1748
1796
  case "clamp-to-edge":
1749
- return import_constants7.GL.CLAMP_TO_EDGE;
1797
+ return 33071;
1750
1798
  case "repeat":
1751
- return import_constants7.GL.REPEAT;
1799
+ return 10497;
1752
1800
  case "mirror-repeat":
1753
- return import_constants7.GL.MIRRORED_REPEAT;
1801
+ return 33648;
1754
1802
  }
1755
1803
  }
1756
1804
  function convertMaxFilterMode(maxFilter) {
1757
1805
  switch (maxFilter) {
1758
1806
  case "nearest":
1759
- return import_constants7.GL.NEAREST;
1807
+ return 9728;
1760
1808
  case "linear":
1761
- return import_constants7.GL.LINEAR;
1809
+ return 9729;
1762
1810
  }
1763
1811
  }
1764
1812
  function convertMinFilterMode(minFilter, mipmapFilter) {
@@ -1767,9 +1815,9 @@ function convertMinFilterMode(minFilter, mipmapFilter) {
1767
1815
  }
1768
1816
  switch (minFilter) {
1769
1817
  case "nearest":
1770
- return mipmapFilter === "nearest" ? import_constants7.GL.NEAREST_MIPMAP_NEAREST : import_constants7.GL.NEAREST_MIPMAP_LINEAR;
1818
+ return mipmapFilter === "nearest" ? 9984 : 9986;
1771
1819
  case "linear":
1772
- return mipmapFilter === "nearest" ? import_constants7.GL.LINEAR_MIPMAP_NEAREST : import_constants7.GL.LINEAR_MIPMAP_LINEAR;
1820
+ return mipmapFilter === "nearest" ? 9985 : 9987;
1773
1821
  }
1774
1822
  }
1775
1823
 
@@ -1785,7 +1833,7 @@ var WEBGLBuffer = class extends import_core6.Buffer {
1785
1833
  /** Usage is a hint on how frequently the buffer will be updates */
1786
1834
  glUsage;
1787
1835
  /** Index type is needed when issuing draw calls, so we pre-compute it */
1788
- glIndexType = import_constants8.GL.UNSIGNED_SHORT;
1836
+ glIndexType = 5123;
1789
1837
  /** Number of bytes allocated on the GPU for this buffer */
1790
1838
  byteLength;
1791
1839
  /** Number of bytes used */
@@ -1799,7 +1847,7 @@ var WEBGLBuffer = class extends import_core6.Buffer {
1799
1847
  device.setSpectorMetadata(this.handle, { ...this.props, data: typeof this.props.data });
1800
1848
  this.glTarget = getWebGLTarget(this.props.usage);
1801
1849
  this.glUsage = getWebGLUsage(this.props.usage);
1802
- this.glIndexType = this.props.indexType === "uint32" ? import_constants8.GL.UNSIGNED_INT : import_constants8.GL.UNSIGNED_SHORT;
1850
+ this.glIndexType = this.props.indexType === "uint32" ? 5125 : 5123;
1803
1851
  if (props.data) {
1804
1852
  this._initWithData(props.data, props.byteOffset, props.byteLength);
1805
1853
  } else {
@@ -1848,7 +1896,7 @@ var WEBGLBuffer = class extends import_core6.Buffer {
1848
1896
  write(data, byteOffset = 0) {
1849
1897
  const srcOffset = 0;
1850
1898
  const byteLength = void 0;
1851
- const glTarget = import_constants8.GL.COPY_WRITE_BUFFER;
1899
+ const glTarget = 36663;
1852
1900
  this.gl.bindBuffer(glTarget, this.handle);
1853
1901
  if (srcOffset !== 0 || byteLength !== void 0) {
1854
1902
  this.gl.bufferSubData(glTarget, byteOffset, data, srcOffset, byteLength);
@@ -1867,36 +1915,36 @@ var WEBGLBuffer = class extends import_core6.Buffer {
1867
1915
  byteLength = byteLength ?? this.byteLength - byteOffset;
1868
1916
  const data = new Uint8Array(byteLength);
1869
1917
  const dstOffset = 0;
1870
- this.gl.bindBuffer(import_constants8.GL.COPY_READ_BUFFER, this.handle);
1871
- this.gl.getBufferSubData(import_constants8.GL.COPY_READ_BUFFER, byteOffset, data, dstOffset, byteLength);
1872
- this.gl.bindBuffer(import_constants8.GL.COPY_READ_BUFFER, null);
1918
+ this.gl.bindBuffer(36662, this.handle);
1919
+ this.gl.getBufferSubData(36662, byteOffset, data, dstOffset, byteLength);
1920
+ this.gl.bindBuffer(36662, null);
1873
1921
  this._setDebugData(data, byteOffset, byteLength);
1874
1922
  return data;
1875
1923
  }
1876
1924
  };
1877
1925
  function getWebGLTarget(usage) {
1878
1926
  if (usage & import_core6.Buffer.INDEX) {
1879
- return import_constants8.GL.ELEMENT_ARRAY_BUFFER;
1927
+ return 34963;
1880
1928
  }
1881
1929
  if (usage & import_core6.Buffer.VERTEX) {
1882
- return import_constants8.GL.ARRAY_BUFFER;
1930
+ return 34962;
1883
1931
  }
1884
1932
  if (usage & import_core6.Buffer.UNIFORM) {
1885
- return import_constants8.GL.UNIFORM_BUFFER;
1933
+ return 35345;
1886
1934
  }
1887
- return import_constants8.GL.ARRAY_BUFFER;
1935
+ return 34962;
1888
1936
  }
1889
1937
  function getWebGLUsage(usage) {
1890
1938
  if (usage & import_core6.Buffer.INDEX) {
1891
- return import_constants8.GL.STATIC_DRAW;
1939
+ return 35044;
1892
1940
  }
1893
1941
  if (usage & import_core6.Buffer.VERTEX) {
1894
- return import_constants8.GL.STATIC_DRAW;
1942
+ return 35044;
1895
1943
  }
1896
1944
  if (usage & import_core6.Buffer.UNIFORM) {
1897
- return import_constants8.GL.DYNAMIC_DRAW;
1945
+ return 35048;
1898
1946
  }
1899
- return import_constants8.GL.STATIC_DRAW;
1947
+ return 35044;
1900
1948
  }
1901
1949
 
1902
1950
  // dist/adapter/resources/webgl-sampler.js
@@ -1927,8 +1975,8 @@ var WEBGLSampler = class extends import_core7.Sampler {
1927
1975
  for (const [pname, value] of Object.entries(parameters)) {
1928
1976
  const param = Number(pname);
1929
1977
  switch (param) {
1930
- case import_constants9.GL.TEXTURE_MIN_LOD:
1931
- case import_constants9.GL.TEXTURE_MAX_LOD:
1978
+ case 33082:
1979
+ case 33083:
1932
1980
  this.device.gl.samplerParameterf(this.handle, param, value);
1933
1981
  break;
1934
1982
  default:
@@ -2004,7 +2052,7 @@ var _WEBGLTexture = class extends import_core9.Texture {
2004
2052
  this.gl = this.device.gl;
2005
2053
  this.handle = this.props.handle || this.gl.createTexture();
2006
2054
  this.device.setSpectorMetadata(this.handle, { ...this.props, data: typeof this.props.data });
2007
- this.glFormat = import_constants10.GL.RGBA;
2055
+ this.glFormat = 6408;
2008
2056
  this.target = getWebGLTextureTarget(this.props);
2009
2057
  this.loaded = false;
2010
2058
  if (typeof ((_a = this.props) == null ? void 0 : _a.data) === "string") {
@@ -2024,6 +2072,9 @@ var _WEBGLTexture = class extends import_core9.Texture {
2024
2072
  toString() {
2025
2073
  return `Texture(${this.id},${this.width}x${this.height})`;
2026
2074
  }
2075
+ createView(props) {
2076
+ return new WEBGLTextureView(this.device, { ...props, texture: this });
2077
+ }
2027
2078
  // eslint-disable-next-line max-statements
2028
2079
  initialize(props = {}) {
2029
2080
  if (this.props.dimension === "cube") {
@@ -2067,7 +2118,7 @@ var _WEBGLTexture = class extends import_core9.Texture {
2067
2118
  this.dataFormat = dataFormat;
2068
2119
  this.textureUnit = textureUnit;
2069
2120
  if (Number.isFinite(this.textureUnit)) {
2070
- this.gl.activeTexture(import_constants10.GL.TEXTURE0 + this.textureUnit);
2121
+ this.gl.activeTexture(33984 + this.textureUnit);
2071
2122
  this.gl.bindTexture(this.target, this.handle);
2072
2123
  }
2073
2124
  this.mipmaps = mipmaps;
@@ -2085,8 +2136,8 @@ var _WEBGLTexture = class extends import_core9.Texture {
2085
2136
  });
2086
2137
  this.setSampler(props.sampler);
2087
2138
  this._setSamplerParameters(parameters);
2088
- this.view = new WEBGLTextureView(this.device, { ...this.props, texture: this });
2089
- if (mipmaps) {
2139
+ this.view = this.createView({ ...this.props, mipLevelCount: 1, arrayLayerCount: 1 });
2140
+ if (mipmaps && this.device.isTextureFormatFilterable(props.format)) {
2090
2141
  this.generateMipmap();
2091
2142
  }
2092
2143
  if (isVideo) {
@@ -2234,9 +2285,9 @@ var _WEBGLTexture = class extends import_core9.Texture {
2234
2285
  );
2235
2286
  break;
2236
2287
  case "buffer":
2237
- this.device.gl.bindBuffer(import_constants10.GL.PIXEL_UNPACK_BUFFER, data.handle || data);
2288
+ this.device.gl.bindBuffer(35052, data.handle || data);
2238
2289
  this.device.gl.texImage2D(target, level, glFormat, width, height, 0, dataFormat, type, offset);
2239
- this.device.gl.bindBuffer(import_constants10.GL.PIXEL_UNPACK_BUFFER, null);
2290
+ this.device.gl.bindBuffer(35052, null);
2240
2291
  break;
2241
2292
  case "browser-object":
2242
2293
  gl.texImage2D(target, level, glFormat, width, height, 0, dataFormat, type, data);
@@ -2296,9 +2347,9 @@ var _WEBGLTexture = class extends import_core9.Texture {
2296
2347
  } else if (ArrayBuffer.isView(data)) {
2297
2348
  this.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, data, offset);
2298
2349
  } else if (typeof WebGLBuffer !== "undefined" && data instanceof WebGLBuffer) {
2299
- this.device.gl.bindBuffer(import_constants10.GL.PIXEL_UNPACK_BUFFER, data);
2350
+ this.device.gl.bindBuffer(35052, data);
2300
2351
  this.device.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, offset);
2301
- this.device.gl.bindBuffer(import_constants10.GL.PIXEL_UNPACK_BUFFER, null);
2352
+ this.device.gl.bindBuffer(35052, null);
2302
2353
  } else {
2303
2354
  this.device.gl.texSubImage2D(target, level, x, y, width, height, dataFormat, type, data);
2304
2355
  }
@@ -2318,13 +2369,13 @@ var _WEBGLTexture = class extends import_core9.Texture {
2318
2369
  return null;
2319
2370
  }
2320
2371
  getActiveUnit() {
2321
- return this.gl.getParameter(import_constants10.GL.ACTIVE_TEXTURE) - import_constants10.GL.TEXTURE0;
2372
+ return this.gl.getParameter(34016) - 33984;
2322
2373
  }
2323
2374
  bind(textureUnit = this.textureUnit) {
2324
2375
  const { gl } = this;
2325
2376
  if (textureUnit !== void 0) {
2326
2377
  this.textureUnit = textureUnit;
2327
- gl.activeTexture(gl.TEXTURE0 + textureUnit);
2378
+ gl.activeTexture(33984 + textureUnit);
2328
2379
  }
2329
2380
  gl.bindTexture(this.target, this.handle);
2330
2381
  return textureUnit;
@@ -2333,7 +2384,7 @@ var _WEBGLTexture = class extends import_core9.Texture {
2333
2384
  const { gl } = this;
2334
2385
  if (textureUnit !== void 0) {
2335
2386
  this.textureUnit = textureUnit;
2336
- gl.activeTexture(gl.TEXTURE0 + textureUnit);
2387
+ gl.activeTexture(33984 + textureUnit);
2337
2388
  }
2338
2389
  gl.bindTexture(this.target, null);
2339
2390
  return textureUnit;
@@ -2395,7 +2446,7 @@ var _WEBGLTexture = class extends import_core9.Texture {
2395
2446
  /* eslint-disable max-statements, max-len */
2396
2447
  async setCubeMapImageData(options) {
2397
2448
  const { gl } = this;
2398
- const { width, height, pixels, data, format = import_constants10.GL.RGBA, type = import_constants10.GL.UNSIGNED_BYTE } = options;
2449
+ const { width, height, pixels, data, format = 6408, type = 5121 } = options;
2399
2450
  const imageDataMap = pixels || data;
2400
2451
  const resolvedFaces = await Promise.all(_WEBGLTexture.FACES.map((face) => {
2401
2452
  const facePixels = imageDataMap[face];
@@ -2424,8 +2475,8 @@ var _WEBGLTexture = class extends import_core9.Texture {
2424
2475
  height,
2425
2476
  pixels,
2426
2477
  data,
2427
- format = import_constants10.GL.RGBA,
2428
- type = import_constants10.GL.UNSIGNED_BYTE
2478
+ format = 6408,
2479
+ type = 5121
2429
2480
  // generateMipmap = false // TODO
2430
2481
  } = options;
2431
2482
  const { gl } = this;
@@ -2479,7 +2530,7 @@ var _WEBGLTexture = class extends import_core9.Texture {
2479
2530
  );
2480
2531
  }
2481
2532
  if (data instanceof WEBGLBuffer) {
2482
- this.gl.bindBuffer(import_constants10.GL.PIXEL_UNPACK_BUFFER, data.handle);
2533
+ this.gl.bindBuffer(35052, data.handle);
2483
2534
  this.gl.texImage3D(this.target, level, dataFormat, width, height, depth, 0, format, type, offset);
2484
2535
  }
2485
2536
  });
@@ -2506,8 +2557,8 @@ var _WEBGLTexture = class extends import_core9.Texture {
2506
2557
  const param = Number(pname);
2507
2558
  const value = pvalue;
2508
2559
  switch (param) {
2509
- case import_constants10.GL.TEXTURE_MIN_LOD:
2510
- case import_constants10.GL.TEXTURE_MAX_LOD:
2560
+ case 33082:
2561
+ case 33083:
2511
2562
  this.gl.texParameterf(this.target, param, value);
2512
2563
  break;
2513
2564
  default:
@@ -2522,23 +2573,23 @@ var _WEBGLTexture = class extends import_core9.Texture {
2522
2573
  var WEBGLTexture = _WEBGLTexture;
2523
2574
  // TODO - remove?
2524
2575
  __publicField(WEBGLTexture, "FACES", [
2525
- import_constants10.GL.TEXTURE_CUBE_MAP_POSITIVE_X,
2526
- import_constants10.GL.TEXTURE_CUBE_MAP_NEGATIVE_X,
2527
- import_constants10.GL.TEXTURE_CUBE_MAP_POSITIVE_Y,
2528
- import_constants10.GL.TEXTURE_CUBE_MAP_NEGATIVE_Y,
2529
- import_constants10.GL.TEXTURE_CUBE_MAP_POSITIVE_Z,
2530
- import_constants10.GL.TEXTURE_CUBE_MAP_NEGATIVE_Z
2576
+ 34069,
2577
+ 34070,
2578
+ 34071,
2579
+ 34072,
2580
+ 34073,
2581
+ 34074
2531
2582
  ]);
2532
2583
  function getWebGLTextureTarget(props) {
2533
2584
  switch (props.dimension) {
2534
2585
  case "2d":
2535
- return import_constants10.GL.TEXTURE_2D;
2586
+ return 3553;
2536
2587
  case "cube":
2537
- return import_constants10.GL.TEXTURE_CUBE_MAP;
2588
+ return 34067;
2538
2589
  case "2d-array":
2539
- return import_constants10.GL.TEXTURE_2D_ARRAY;
2590
+ return 35866;
2540
2591
  case "3d":
2541
- return import_constants10.GL.TEXTURE_3D;
2592
+ return 32879;
2542
2593
  case "1d":
2543
2594
  case "cube-array":
2544
2595
  default:
@@ -2549,180 +2600,8 @@ function logParameters(parameters) {
2549
2600
  import_core9.log.log(1, "texture sampler parameters", parameters)();
2550
2601
  }
2551
2602
 
2552
- // dist/adapter/objects/webgl-renderbuffer.js
2553
- var import_core11 = require("@luma.gl/core");
2554
- var import_constants11 = require("@luma.gl/constants");
2555
-
2556
- // dist/adapter/objects/webgl-resource.js
2557
- var import_core10 = require("@luma.gl/core");
2558
- var ERR_RESOURCE_METHOD_UNDEFINED = "Resource subclass must define virtual methods";
2559
- var WebGLResource = class extends import_core10.Resource {
2560
- device;
2561
- gl;
2562
- gl2;
2563
- _handle;
2564
- _bound = false;
2565
- // Only meaningful for resources that allocate GPU memory
2566
- byteLength = 0;
2567
- constructor(device, props, defaultProps) {
2568
- super(device, props, defaultProps);
2569
- this.device = WebGLDevice.attach(device);
2570
- const gl = this.device.gl;
2571
- const { id } = props || {};
2572
- this.gl = gl;
2573
- this.gl2 = gl;
2574
- this.id = id || (0, import_core10.uid)(this.constructor.name);
2575
- this._handle = props == null ? void 0 : props.handle;
2576
- if (this._handle === void 0) {
2577
- this._handle = this._createHandle();
2578
- }
2579
- this.byteLength = 0;
2580
- }
2581
- toString() {
2582
- return `${this.constructor.name}(${this.id})`;
2583
- }
2584
- get handle() {
2585
- return this._handle;
2586
- }
2587
- delete({ deleteChildren = false } = {}) {
2588
- const children = this._handle && this._deleteHandle(this._handle);
2589
- if (this._handle) {
2590
- this.removeStats();
2591
- }
2592
- this._handle = null;
2593
- if (children && deleteChildren) {
2594
- children.filter(Boolean).forEach((child) => child.destroy());
2595
- }
2596
- return this;
2597
- }
2598
- bind(funcOrHandle = this.handle) {
2599
- if (typeof funcOrHandle !== "function") {
2600
- this._bindHandle(funcOrHandle);
2601
- return this;
2602
- }
2603
- let value;
2604
- if (!this._bound) {
2605
- this._bindHandle(this.handle);
2606
- this._bound = true;
2607
- value = funcOrHandle();
2608
- this._bound = false;
2609
- this._bindHandle(null);
2610
- } else {
2611
- value = funcOrHandle();
2612
- }
2613
- return value;
2614
- }
2615
- unbind() {
2616
- this.bind(null);
2617
- }
2618
- // Install stubs for removed methods
2619
- stubRemovedMethods(className, version, methodNames) {
2620
- return (0, import_core10.stubRemovedMethods)(this, className, version, methodNames);
2621
- }
2622
- // PUBLIC VIRTUAL METHODS
2623
- initialize(props) {
2624
- }
2625
- // PROTECTED METHODS - These must be overridden by subclass
2626
- _createHandle() {
2627
- throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
2628
- }
2629
- _deleteHandle() {
2630
- throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
2631
- }
2632
- _bindHandle(handle) {
2633
- throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
2634
- }
2635
- _getOptsFromHandle() {
2636
- throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
2637
- }
2638
- _getParameter(pname, props) {
2639
- throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
2640
- }
2641
- _setParameter(pname, value) {
2642
- throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
2643
- }
2644
- };
2645
-
2646
- // dist/adapter/objects/webgl-renderbuffer.js
2647
- var _WEBGLRenderbuffer = class extends WebGLResource {
2648
- get [Symbol.toStringTag]() {
2649
- return "Renderbuffer";
2650
- }
2651
- get width() {
2652
- return this.props.width;
2653
- }
2654
- get height() {
2655
- return this.props.height;
2656
- }
2657
- get format() {
2658
- return this.props.format;
2659
- }
2660
- get samples() {
2661
- return this.props.samples;
2662
- }
2663
- get attachment() {
2664
- return;
2665
- }
2666
- /** WebGL format constant */
2667
- glFormat;
2668
- static isTextureFormatSupported(device, format) {
2669
- return isRenderbufferFormatSupported(device.gl, format, device._extensions);
2670
- }
2671
- constructor(device, props) {
2672
- if (typeof props.format === "number") {
2673
- throw new Error("Renderbuffer");
2674
- }
2675
- super(device, props, _WEBGLRenderbuffer.defaultProps);
2676
- this.glFormat = convertTextureFormatToGL(this.props.format);
2677
- this._initialize(this.props);
2678
- }
2679
- resize(size) {
2680
- if (size.width !== this.width || size.height !== this.height) {
2681
- Object.assign(this.props, { ...size, format: this.format, samples: this.samples });
2682
- this._initialize(this.props);
2683
- }
2684
- }
2685
- // PRIVATE METHODS
2686
- /** Creates and initializes a renderbuffer object's data store */
2687
- _initialize(props) {
2688
- const { format, width, height, samples } = props;
2689
- (0, import_core11.assert)(format, "Needs format");
2690
- this.trackDeallocatedMemory();
2691
- this.gl.bindRenderbuffer(import_constants11.GL.RENDERBUFFER, this.handle);
2692
- if (samples !== 0) {
2693
- this.gl.renderbufferStorageMultisample(import_constants11.GL.RENDERBUFFER, samples, this.glFormat, width, height);
2694
- } else {
2695
- this.gl.renderbufferStorage(import_constants11.GL.RENDERBUFFER, this.glFormat, width, height);
2696
- }
2697
- this.gl.bindRenderbuffer(import_constants11.GL.RENDERBUFFER, null);
2698
- this.trackAllocatedMemory(width * height * (samples || 1) * getTextureFormatBytesPerPixel(this.glFormat));
2699
- }
2700
- // RESOURCE IMPLEMENTATION
2701
- _createHandle() {
2702
- return this.gl.createRenderbuffer();
2703
- }
2704
- _deleteHandle() {
2705
- this.gl.deleteRenderbuffer(this.handle);
2706
- this.trackDeallocatedMemory();
2707
- }
2708
- _bindHandle(handle) {
2709
- this.gl.bindRenderbuffer(import_constants11.GL.RENDERBUFFER, handle);
2710
- }
2711
- };
2712
- var WEBGLRenderbuffer = _WEBGLRenderbuffer;
2713
- __publicField(WEBGLRenderbuffer, "defaultProps", {
2714
- id: void 0,
2715
- handle: void 0,
2716
- userData: void 0,
2717
- format: void 0,
2718
- // 'depth16unorm'
2719
- width: 1,
2720
- height: 1,
2721
- samples: 0
2722
- });
2723
-
2724
2603
  // dist/adapter/resources/webgl-framebuffer.js
2725
- var WEBGLFramebuffer = class extends import_core12.Framebuffer {
2604
+ var WEBGLFramebuffer = class extends import_core10.Framebuffer {
2726
2605
  device;
2727
2606
  gl;
2728
2607
  handle;
@@ -2738,10 +2617,10 @@ var WEBGLFramebuffer = class extends import_core12.Framebuffer {
2738
2617
  if (!isDefaultFramebuffer) {
2739
2618
  device.setSpectorMetadata(this.handle, { id: this.props.id, props: this.props });
2740
2619
  this.autoCreateAttachmentTextures();
2741
- this.gl.bindFramebuffer(import_constants12.GL.FRAMEBUFFER, this.handle);
2620
+ this.gl.bindFramebuffer(36160, this.handle);
2742
2621
  for (let i = 0; i < this.colorAttachments.length; ++i) {
2743
2622
  const attachment = this.colorAttachments[i];
2744
- const attachmentPoint = import_constants12.GL.COLOR_ATTACHMENT0 + i;
2623
+ const attachmentPoint = 36064 + i;
2745
2624
  if (attachment) {
2746
2625
  this._attachOne(attachmentPoint, attachment);
2747
2626
  }
@@ -2750,12 +2629,12 @@ var WEBGLFramebuffer = class extends import_core12.Framebuffer {
2750
2629
  this._attachOne(getDepthStencilAttachmentWebGL(this.depthStencilAttachment.props.format), this.depthStencilAttachment);
2751
2630
  }
2752
2631
  if (props.check !== false) {
2753
- const status = this.gl.checkFramebufferStatus(import_constants12.GL.FRAMEBUFFER);
2754
- if (status !== import_constants12.GL.FRAMEBUFFER_COMPLETE) {
2632
+ const status = this.gl.checkFramebufferStatus(36160);
2633
+ if (status !== 36053) {
2755
2634
  throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
2756
2635
  }
2757
2636
  }
2758
- this.gl.bindFramebuffer(import_constants12.GL.FRAMEBUFFER, null);
2637
+ this.gl.bindFramebuffer(36160, null);
2759
2638
  }
2760
2639
  }
2761
2640
  /** destroys any auto created resources etc. */
@@ -2768,14 +2647,12 @@ var WEBGLFramebuffer = class extends import_core12.Framebuffer {
2768
2647
  // PRIVATE
2769
2648
  /** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
2770
2649
  createDepthStencilTexture(format) {
2771
- return new WEBGLRenderbuffer(this.device, {
2650
+ return new WEBGLTexture(this.device, {
2772
2651
  id: `${this.id}-depth-stencil`,
2773
- // TODO misleading if not depth and stencil?
2774
2652
  format,
2775
- // dataFormat: GL.DEPTH_STENCIL,
2776
- // type: GL.UNSIGNED_INT_24_8,
2777
2653
  width: this.width,
2778
- height: this.height
2654
+ height: this.height,
2655
+ mipmaps: false
2779
2656
  });
2780
2657
  }
2781
2658
  /**
@@ -2803,26 +2680,31 @@ var WEBGLFramebuffer = class extends import_core12.Framebuffer {
2803
2680
  }
2804
2681
  /** Attach one attachment */
2805
2682
  _attachOne(attachmentPoint, attachment) {
2806
- if (attachment instanceof WEBGLRenderbuffer) {
2807
- this._attachWEBGLRenderbuffer(attachmentPoint, attachment);
2808
- return attachment;
2809
- } else if (Array.isArray(attachment)) {
2683
+ if (Array.isArray(attachment)) {
2810
2684
  const [texture, layer = 0, level = 0] = attachment;
2811
2685
  this._attachTexture(attachmentPoint, texture, layer, level);
2812
2686
  return texture;
2813
- } else if (attachment instanceof WEBGLTexture) {
2687
+ }
2688
+ if (attachment instanceof WEBGLTexture) {
2814
2689
  this._attachTexture(attachmentPoint, attachment, 0, 0);
2815
2690
  return attachment;
2816
- } else if (attachment instanceof WEBGLTextureView) {
2691
+ }
2692
+ if (attachment instanceof WEBGLTextureView) {
2817
2693
  const textureView = attachment;
2818
2694
  this._attachTexture(attachmentPoint, textureView.texture, textureView.props.baseMipLevel, textureView.props.baseArrayLayer);
2819
2695
  return attachment.texture;
2820
2696
  }
2821
2697
  throw new Error("attach");
2822
2698
  }
2823
- _attachWEBGLRenderbuffer(attachment, renderbuffer) {
2824
- this.gl.framebufferRenderbuffer(import_constants12.GL.FRAMEBUFFER, attachment, import_constants12.GL.RENDERBUFFER, renderbuffer.handle);
2825
- }
2699
+ // TODO - we do not seem to need render buffers in WebGL 2
2700
+ // protected _attachWEBGLRenderbuffer(attachment: GL, renderbuffer: WEBGLRenderbuffer): void {
2701
+ // this.gl.framebufferRenderbuffer(
2702
+ // GL.FRAMEBUFFER,
2703
+ // attachment,
2704
+ // GL.RENDERBUFFER,
2705
+ // renderbuffer.handle
2706
+ // );
2707
+ // }
2826
2708
  /**
2827
2709
  * @param attachment
2828
2710
  * @param texture
@@ -2833,39 +2715,39 @@ var WEBGLFramebuffer = class extends import_core12.Framebuffer {
2833
2715
  const { gl } = this.device;
2834
2716
  gl.bindTexture(texture.target, texture.handle);
2835
2717
  switch (texture.target) {
2836
- case import_constants12.GL.TEXTURE_2D_ARRAY:
2837
- case import_constants12.GL.TEXTURE_3D:
2838
- gl.framebufferTextureLayer(import_constants12.GL.FRAMEBUFFER, attachment, texture.target, level, layer);
2718
+ case 35866:
2719
+ case 32879:
2720
+ gl.framebufferTextureLayer(36160, attachment, texture.target, level, layer);
2839
2721
  break;
2840
- case import_constants12.GL.TEXTURE_CUBE_MAP:
2722
+ case 34067:
2841
2723
  const face = mapIndexToCubeMapFace(layer);
2842
- gl.framebufferTexture2D(import_constants12.GL.FRAMEBUFFER, attachment, face, texture.handle, level);
2724
+ gl.framebufferTexture2D(36160, attachment, face, texture.handle, level);
2843
2725
  break;
2844
- case import_constants12.GL.TEXTURE_2D:
2845
- gl.framebufferTexture2D(import_constants12.GL.FRAMEBUFFER, attachment, import_constants12.GL.TEXTURE_2D, texture.handle, level);
2726
+ case 3553:
2727
+ gl.framebufferTexture2D(36160, attachment, 3553, texture.handle, level);
2846
2728
  break;
2847
2729
  default:
2848
- (0, import_core12.assert)(false, "Illegal texture type");
2730
+ (0, import_core10.assert)(false, "Illegal texture type");
2849
2731
  }
2850
2732
  gl.bindTexture(texture.target, null);
2851
2733
  }
2852
2734
  };
2853
2735
  function mapIndexToCubeMapFace(layer) {
2854
- return layer < import_constants12.GL.TEXTURE_CUBE_MAP_POSITIVE_X ? layer + import_constants12.GL.TEXTURE_CUBE_MAP_POSITIVE_X : layer;
2736
+ return layer < 34069 ? layer + 34069 : layer;
2855
2737
  }
2856
2738
  function _getFrameBufferStatus(status) {
2857
2739
  switch (status) {
2858
- case import_constants12.GL.FRAMEBUFFER_COMPLETE:
2740
+ case 36053:
2859
2741
  return "success";
2860
- case import_constants12.GL.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
2742
+ case 36054:
2861
2743
  return "Mismatched attachments";
2862
- case import_constants12.GL.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
2744
+ case 36055:
2863
2745
  return "No attachments";
2864
- case import_constants12.GL.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
2746
+ case 36057:
2865
2747
  return "Height/width mismatch";
2866
- case import_constants12.GL.FRAMEBUFFER_UNSUPPORTED:
2748
+ case 36061:
2867
2749
  return "Unsupported or split attachments";
2868
- case import_constants12.GL.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
2750
+ case 36182:
2869
2751
  return "Samples mismatch";
2870
2752
  default:
2871
2753
  return `${status}`;
@@ -2873,7 +2755,7 @@ function _getFrameBufferStatus(status) {
2873
2755
  }
2874
2756
 
2875
2757
  // dist/adapter/webgl-canvas-context.js
2876
- var WebGLCanvasContext = class extends import_core13.CanvasContext {
2758
+ var WebGLCanvasContext = class extends import_core11.CanvasContext {
2877
2759
  device;
2878
2760
  presentationSize;
2879
2761
  _framebuffer = null;
@@ -2924,9 +2806,9 @@ var WebGLCanvasContext = class extends import_core13.CanvasContext {
2924
2806
  };
2925
2807
 
2926
2808
  // dist/context/debug/spector.js
2927
- var import_core14 = require("@luma.gl/core");
2809
+ var import_core12 = require("@luma.gl/core");
2928
2810
  var DEFAULT_SPECTOR_PROPS = {
2929
- spector: import_core14.log.get("spector") || import_core14.log.get("inspect")
2811
+ spector: import_core12.log.get("spector") || import_core12.log.get("inspect")
2930
2812
  };
2931
2813
  var SPECTOR_CDN_URL = "https://spectorcdn.babylonjs.com/spector.bundle.js";
2932
2814
  var LOG_LEVEL = 1;
@@ -2935,9 +2817,9 @@ var initialized = false;
2935
2817
  async function loadSpectorJS(props) {
2936
2818
  if (!globalThis.SPECTOR) {
2937
2819
  try {
2938
- await (0, import_core14.loadScript)(SPECTOR_CDN_URL);
2820
+ await (0, import_core12.loadScript)(SPECTOR_CDN_URL);
2939
2821
  } catch (error) {
2940
- import_core14.log.warn(String(error));
2822
+ import_core12.log.warn(String(error));
2941
2823
  }
2942
2824
  }
2943
2825
  }
@@ -2947,7 +2829,7 @@ function initializeSpectorJS(props) {
2947
2829
  return null;
2948
2830
  }
2949
2831
  if (!spector && globalThis.SPECTOR) {
2950
- import_core14.log.probe(LOG_LEVEL, "SPECTOR found and initialized")();
2832
+ import_core12.log.probe(LOG_LEVEL, "SPECTOR found and initialized")();
2951
2833
  spector = new globalThis.SPECTOR.Spector();
2952
2834
  if (globalThis.luma) {
2953
2835
  globalThis.luma.spector = spector;
@@ -2959,9 +2841,9 @@ function initializeSpectorJS(props) {
2959
2841
  if (!initialized) {
2960
2842
  initialized = true;
2961
2843
  spector.spyCanvases();
2962
- spector == null ? void 0 : spector.onCaptureStarted.add((capture) => import_core14.log.info("Spector capture started:", capture)());
2844
+ spector == null ? void 0 : spector.onCaptureStarted.add((capture) => import_core12.log.info("Spector capture started:", capture)());
2963
2845
  spector == null ? void 0 : spector.onCapture.add((capture) => {
2964
- import_core14.log.info("Spector capture complete:", capture)();
2846
+ import_core12.log.info("Spector capture complete:", capture)();
2965
2847
  spector == null ? void 0 : spector.getResultUI();
2966
2848
  spector == null ? void 0 : spector.resultView.display();
2967
2849
  spector == null ? void 0 : spector.resultView.addCapture(capture);
@@ -2973,7 +2855,7 @@ function initializeSpectorJS(props) {
2973
2855
  }
2974
2856
  spector == null ? void 0 : spector.startCapture(props == null ? void 0 : props.canvas, 500);
2975
2857
  new Promise((resolve) => setTimeout(resolve, 2e3)).then((_) => {
2976
- import_core14.log.info("Spector capture stopped after 2 seconds")();
2858
+ import_core12.log.info("Spector capture stopped after 2 seconds")();
2977
2859
  spector == null ? void 0 : spector.stopCapture();
2978
2860
  });
2979
2861
  }
@@ -2981,8 +2863,8 @@ function initializeSpectorJS(props) {
2981
2863
  }
2982
2864
 
2983
2865
  // dist/context/debug/webgl-developer-tools.js
2984
- var import_core15 = require("@luma.gl/core");
2985
- var import_constants13 = require("@luma.gl/constants");
2866
+ var import_core13 = require("@luma.gl/core");
2867
+ var import_constants12 = require("@luma.gl/constants");
2986
2868
  var import_env = require("@probe.gl/env");
2987
2869
  var WEBGL_DEBUG_CDN_URL = "https://unpkg.com/webgl-debug@2.0.1/index.js";
2988
2870
  function getWebGLContextData(gl) {
@@ -2993,7 +2875,7 @@ async function loadWebGLDeveloperTools() {
2993
2875
  if ((0, import_env.isBrowser)() && !globalThis.WebGLDebugUtils) {
2994
2876
  globalThis.global = globalThis.global || globalThis;
2995
2877
  globalThis.global.module = {};
2996
- await (0, import_core15.loadScript)(WEBGL_DEBUG_CDN_URL);
2878
+ await (0, import_core13.loadScript)(WEBGL_DEBUG_CDN_URL);
2997
2879
  }
2998
2880
  }
2999
2881
  function makeDebugContext(gl, props = {}) {
@@ -3008,18 +2890,18 @@ function getRealContext(gl) {
3008
2890
  }
3009
2891
  function getDebugContext(gl, props) {
3010
2892
  if (!globalThis.WebGLDebugUtils) {
3011
- import_core15.log.warn("webgl-debug not loaded")();
2893
+ import_core13.log.warn("webgl-debug not loaded")();
3012
2894
  return gl;
3013
2895
  }
3014
2896
  const data = getWebGLContextData(gl);
3015
2897
  if (data.debugContext) {
3016
2898
  return data.debugContext;
3017
2899
  }
3018
- globalThis.WebGLDebugUtils.init({ ...import_constants13.GL, ...gl });
2900
+ globalThis.WebGLDebugUtils.init({ ...import_constants12.GL, ...gl });
3019
2901
  const glDebug = globalThis.WebGLDebugUtils.makeDebugContext(gl, onGLError.bind(null, props), onValidateGLFunc.bind(null, props));
3020
- for (const key in import_constants13.GL) {
3021
- if (!(key in glDebug) && typeof import_constants13.GL[key] === "number") {
3022
- glDebug[key] = import_constants13.GL[key];
2902
+ for (const key in import_constants12.GL) {
2903
+ if (!(key in glDebug) && typeof import_constants12.GL[key] === "number") {
2904
+ glDebug[key] = import_constants12.GL[key];
3023
2905
  }
3024
2906
  }
3025
2907
  class WebGLDebugContext {
@@ -3043,7 +2925,7 @@ function onGLError(props, err, functionName, args) {
3043
2925
  const errorMessage = globalThis.WebGLDebugUtils.glEnumToString(err);
3044
2926
  const functionArgs = globalThis.WebGLDebugUtils.glFunctionArgsToString(functionName, args);
3045
2927
  const message2 = `${errorMessage} in gl.${functionName}(${functionArgs})`;
3046
- import_core15.log.error(message2)();
2928
+ import_core13.log.error(message2)();
3047
2929
  debugger;
3048
2930
  if (props.throwOnError) {
3049
2931
  throw new Error(message2);
@@ -3051,9 +2933,9 @@ function onGLError(props, err, functionName, args) {
3051
2933
  }
3052
2934
  function onValidateGLFunc(props, functionName, functionArgs) {
3053
2935
  let functionString = "";
3054
- if (import_core15.log.level >= 1) {
2936
+ if (import_core13.log.level >= 1) {
3055
2937
  functionString = getFunctionString(functionName, functionArgs);
3056
- import_core15.log.log(1, functionString)();
2938
+ import_core13.log.log(1, functionString)();
3057
2939
  }
3058
2940
  if (props.break && props.break.length > 0) {
3059
2941
  functionString = functionString || getFunctionString(functionName, functionArgs);
@@ -3068,7 +2950,7 @@ function onValidateGLFunc(props, functionName, functionArgs) {
3068
2950
  if (props.throwOnError) {
3069
2951
  throw new Error(`Undefined argument: ${functionString}`);
3070
2952
  } else {
3071
- import_core15.log.error(`Undefined argument: ${functionString}`)();
2953
+ import_core13.log.error(`Undefined argument: ${functionString}`)();
3072
2954
  debugger;
3073
2955
  }
3074
2956
  }
@@ -3076,8 +2958,8 @@ function onValidateGLFunc(props, functionName, functionArgs) {
3076
2958
  }
3077
2959
 
3078
2960
  // dist/adapter/resources/webgl-shader.js
3079
- var import_core16 = require("@luma.gl/core");
3080
- var import_constants14 = require("@luma.gl/constants");
2961
+ var import_core14 = require("@luma.gl/core");
2962
+ var import_constants13 = require("@luma.gl/constants");
3081
2963
 
3082
2964
  // dist/adapter/helpers/parse-shader-compiler-log.js
3083
2965
  function parseShaderCompilerLog(errLog) {
@@ -3124,7 +3006,7 @@ function getMessageType(messageType) {
3124
3006
  }
3125
3007
 
3126
3008
  // dist/adapter/resources/webgl-shader.js
3127
- var WEBGLShader = class extends import_core16.Shader {
3009
+ var WEBGLShader = class extends import_core14.Shader {
3128
3010
  device;
3129
3011
  handle;
3130
3012
  constructor(device, props) {
@@ -3132,10 +3014,10 @@ var WEBGLShader = class extends import_core16.Shader {
3132
3014
  this.device = device;
3133
3015
  switch (this.props.stage) {
3134
3016
  case "vertex":
3135
- this.handle = this.props.handle || this.device.gl.createShader(import_constants14.GL.VERTEX_SHADER);
3017
+ this.handle = this.props.handle || this.device.gl.createShader(35633);
3136
3018
  break;
3137
3019
  case "fragment":
3138
- this.handle = this.props.handle || this.device.gl.createShader(import_constants14.GL.FRAGMENT_SHADER);
3020
+ this.handle = this.props.handle || this.device.gl.createShader(35632);
3139
3021
  break;
3140
3022
  default:
3141
3023
  throw new Error(this.props.stage);
@@ -3171,7 +3053,7 @@ ${source2}`;
3171
3053
  const { gl } = this.device;
3172
3054
  gl.shaderSource(this.handle, source);
3173
3055
  gl.compileShader(this.handle);
3174
- if (import_core16.log.level === 0) {
3056
+ if (import_core14.log.level === 0) {
3175
3057
  this.compilationStatus = "pending";
3176
3058
  return;
3177
3059
  }
@@ -3183,9 +3065,9 @@ ${source2}`;
3183
3065
  this.debugShader();
3184
3066
  return;
3185
3067
  }
3186
- import_core16.log.once(1, "Shader compilation is asynchronous")();
3068
+ import_core14.log.once(1, "Shader compilation is asynchronous")();
3187
3069
  await this._waitForCompilationComplete();
3188
- import_core16.log.info(2, `Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)();
3070
+ import_core14.log.info(2, `Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)();
3189
3071
  this._getCompilationStatus();
3190
3072
  this.debugShader();
3191
3073
  }
@@ -3199,7 +3081,7 @@ ${source2}`;
3199
3081
  }
3200
3082
  const { gl } = this.device;
3201
3083
  for (; ; ) {
3202
- const complete = gl.getShaderParameter(this.handle, import_constants14.GL.COMPLETION_STATUS_KHR);
3084
+ const complete = gl.getShaderParameter(this.handle, 37297);
3203
3085
  if (complete) {
3204
3086
  return;
3205
3087
  }
@@ -3212,18 +3094,18 @@ ${source2}`;
3212
3094
  * https://gamedev.stackexchange.com/questions/30429/how-to-detect-glsl-warnings
3213
3095
  */
3214
3096
  _getCompilationStatus() {
3215
- this.compilationStatus = this.device.gl.getShaderParameter(this.handle, import_constants14.GL.COMPILE_STATUS) ? "success" : "error";
3097
+ this.compilationStatus = this.device.gl.getShaderParameter(this.handle, 35713) ? "success" : "error";
3216
3098
  }
3217
3099
  };
3218
3100
 
3219
3101
  // dist/adapter/resources/webgl-render-pass.js
3220
- var import_core17 = require("@luma.gl/core");
3221
- var import_constants15 = require("@luma.gl/constants");
3102
+ var import_core15 = require("@luma.gl/core");
3103
+ var import_constants14 = require("@luma.gl/constants");
3222
3104
  var GL_DEPTH_BUFFER_BIT = 256;
3223
3105
  var GL_STENCIL_BUFFER_BIT = 1024;
3224
3106
  var GL_COLOR_BUFFER_BIT = 16384;
3225
3107
  var GL_COLOR = 6144;
3226
- var WEBGLRenderPass = class extends import_core17.RenderPass {
3108
+ var WEBGLRenderPass = class extends import_core15.RenderPass {
3227
3109
  device;
3228
3110
  /** Parameters that should be applied before each draw call */
3229
3111
  glParameters;
@@ -3237,7 +3119,7 @@ var WEBGLRenderPass = class extends import_core17.RenderPass {
3237
3119
  end() {
3238
3120
  popContextState(this.device.gl);
3239
3121
  if (this.props.framebuffer) {
3240
- setGLParameters(this.device, { framebuffer: null });
3122
+ setGLParameters(this.device.gl, { framebuffer: null });
3241
3123
  }
3242
3124
  }
3243
3125
  pushDebugGroup(groupLabel) {
@@ -3261,7 +3143,7 @@ var WEBGLRenderPass = class extends import_core17.RenderPass {
3261
3143
  glParameters.depthMask = !this.props.depthReadOnly;
3262
3144
  }
3263
3145
  glParameters.stencilMask = this.props.stencilReadOnly ? 0 : 1;
3264
- glParameters[import_constants15.GL.RASTERIZER_DISCARD] = this.props.discard;
3146
+ glParameters[35977] = this.props.discard;
3265
3147
  if (parameters.viewport) {
3266
3148
  if (parameters.viewport.length >= 6) {
3267
3149
  glParameters.viewport = parameters.viewport.slice(0, 4);
@@ -3279,10 +3161,10 @@ var WEBGLRenderPass = class extends import_core17.RenderPass {
3279
3161
  }
3280
3162
  if (parameters.stencilReference) {
3281
3163
  console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL");
3282
- parameters[import_constants15.GL.STENCIL_REF] = parameters.stencilReference;
3164
+ parameters[2967] = parameters.stencilReference;
3283
3165
  }
3284
3166
  this.glParameters = glParameters;
3285
- setGLParameters(this.device, glParameters);
3167
+ setGLParameters(this.device.gl, glParameters);
3286
3168
  }
3287
3169
  beginOcclusionQuery(queryIndex) {
3288
3170
  const webglQuerySet = this.props.occlusionQuerySet;
@@ -3312,7 +3194,7 @@ var WEBGLRenderPass = class extends import_core17.RenderPass {
3312
3194
  glParameters.clearStencil = this.props.clearStencil;
3313
3195
  }
3314
3196
  if (clearMask !== 0) {
3315
- withGLParameters(this.device, glParameters, () => {
3197
+ withGLParameters(this.device.gl, glParameters, () => {
3316
3198
  this.device.gl.clear(clearMask);
3317
3199
  });
3318
3200
  }
@@ -3339,39 +3221,39 @@ var WEBGLRenderPass = class extends import_core17.RenderPass {
3339
3221
  };
3340
3222
 
3341
3223
  // dist/adapter/resources/webgl-render-pipeline.js
3342
- var import_core19 = require("@luma.gl/core");
3343
- var import_core20 = require("@luma.gl/core");
3344
- var import_constants22 = require("@luma.gl/constants");
3224
+ var import_core17 = require("@luma.gl/core");
3225
+ var import_core18 = require("@luma.gl/core");
3226
+ var import_constants21 = require("@luma.gl/constants");
3345
3227
 
3346
3228
  // dist/adapter/helpers/get-shader-layout.js
3347
- var import_constants19 = require("@luma.gl/constants");
3229
+ var import_constants18 = require("@luma.gl/constants");
3348
3230
 
3349
3231
  // dist/classic/accessor.js
3350
- var import_core18 = require("@luma.gl/core");
3351
- var import_constants17 = require("@luma.gl/constants");
3232
+ var import_core16 = require("@luma.gl/core");
3233
+ var import_constants16 = require("@luma.gl/constants");
3352
3234
 
3353
3235
  // dist/classic/typed-array-utils.js
3354
- var import_constants16 = require("@luma.gl/constants");
3236
+ var import_constants15 = require("@luma.gl/constants");
3355
3237
  var ERR_TYPE_DEDUCTION = "Failed to deduce GL constant from typed array";
3356
3238
  function getGLTypeFromTypedArray(arrayOrType) {
3357
3239
  const type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
3358
3240
  switch (type) {
3359
3241
  case Float32Array:
3360
- return import_constants16.GL.FLOAT;
3242
+ return 5126;
3361
3243
  case Uint16Array:
3362
- return import_constants16.GL.UNSIGNED_SHORT;
3244
+ return 5123;
3363
3245
  case Uint32Array:
3364
- return import_constants16.GL.UNSIGNED_INT;
3246
+ return 5125;
3365
3247
  case Uint8Array:
3366
- return import_constants16.GL.UNSIGNED_BYTE;
3248
+ return 5121;
3367
3249
  case Uint8ClampedArray:
3368
- return import_constants16.GL.UNSIGNED_BYTE;
3250
+ return 5121;
3369
3251
  case Int8Array:
3370
- return import_constants16.GL.BYTE;
3252
+ return 5120;
3371
3253
  case Int16Array:
3372
- return import_constants16.GL.SHORT;
3254
+ return 5122;
3373
3255
  case Int32Array:
3374
- return import_constants16.GL.INT;
3256
+ return 5124;
3375
3257
  default:
3376
3258
  throw new Error(ERR_TYPE_DEDUCTION);
3377
3259
  }
@@ -3379,22 +3261,22 @@ function getGLTypeFromTypedArray(arrayOrType) {
3379
3261
  function getTypedArrayFromGLType(glType, options) {
3380
3262
  const { clamped = true } = options || {};
3381
3263
  switch (glType) {
3382
- case import_constants16.GL.FLOAT:
3264
+ case 5126:
3383
3265
  return Float32Array;
3384
- case import_constants16.GL.UNSIGNED_SHORT:
3385
- case import_constants16.GL.UNSIGNED_SHORT_5_6_5:
3386
- case import_constants16.GL.UNSIGNED_SHORT_4_4_4_4:
3387
- case import_constants16.GL.UNSIGNED_SHORT_5_5_5_1:
3266
+ case 5123:
3267
+ case 33635:
3268
+ case 32819:
3269
+ case 32820:
3388
3270
  return Uint16Array;
3389
- case import_constants16.GL.UNSIGNED_INT:
3271
+ case 5125:
3390
3272
  return Uint32Array;
3391
- case import_constants16.GL.UNSIGNED_BYTE:
3273
+ case 5121:
3392
3274
  return clamped ? Uint8ClampedArray : Uint8Array;
3393
- case import_constants16.GL.BYTE:
3275
+ case 5120:
3394
3276
  return Int8Array;
3395
- case import_constants16.GL.SHORT:
3277
+ case 5122:
3396
3278
  return Int16Array;
3397
- case import_constants16.GL.INT:
3279
+ case 5124:
3398
3280
  return Int32Array;
3399
3281
  default:
3400
3282
  throw new Error("Failed to deduce typed array type from GL constant");
@@ -3405,7 +3287,7 @@ function getTypedArrayFromGLType(glType, options) {
3405
3287
  var DEFAULT_ACCESSOR_VALUES = {
3406
3288
  offset: 0,
3407
3289
  stride: 0,
3408
- type: import_constants17.GL.FLOAT,
3290
+ type: 5126,
3409
3291
  size: 1,
3410
3292
  divisor: 0,
3411
3293
  normalized: false,
@@ -3428,12 +3310,12 @@ var Accessor = class {
3428
3310
  buffer;
3429
3311
  index;
3430
3312
  static getBytesPerElement(accessor) {
3431
- const ArrayType = getTypedArrayFromGLType(accessor.type || import_constants17.GL.FLOAT);
3313
+ const ArrayType = getTypedArrayFromGLType(accessor.type || 5126);
3432
3314
  return ArrayType.BYTES_PER_ELEMENT;
3433
3315
  }
3434
3316
  static getBytesPerVertex(accessor) {
3435
- (0, import_core18.assert)(accessor.size);
3436
- const ArrayType = getTypedArrayFromGLType(accessor.type || import_constants17.GL.FLOAT);
3317
+ (0, import_core16.assert)(accessor.size);
3318
+ const ArrayType = getTypedArrayFromGLType(accessor.type || 5126);
3437
3319
  return ArrayType.BYTES_PER_ELEMENT * accessor.size;
3438
3320
  }
3439
3321
  // Combines (merges) a list of accessors. On top of default values
@@ -3461,10 +3343,10 @@ var Accessor = class {
3461
3343
  // PRIVATE
3462
3344
  // eslint-disable-next-line complexity, max-statements
3463
3345
  _assign(props = {}) {
3464
- props = (0, import_core18.checkProps)("Accessor", props, PROP_CHECKS);
3346
+ props = (0, import_core16.checkProps)("Accessor", props, PROP_CHECKS);
3465
3347
  if (props.type !== void 0) {
3466
3348
  this.type = props.type;
3467
- if (props.type === import_constants17.GL.INT || props.type === import_constants17.GL.UNSIGNED_INT) {
3349
+ if (props.type === 5124 || props.type === 5125) {
3468
3350
  this.integer = true;
3469
3351
  }
3470
3352
  }
@@ -3528,62 +3410,62 @@ var Accessor = class {
3528
3410
  };
3529
3411
 
3530
3412
  // dist/adapter/helpers/decode-webgl-types.js
3531
- var import_constants18 = require("@luma.gl/constants");
3413
+ var import_constants17 = require("@luma.gl/constants");
3532
3414
  function isSamplerUniform(type) {
3533
3415
  return SAMPLER_TYPES.includes(type);
3534
3416
  }
3535
3417
  var SAMPLER_TYPES = [
3536
- import_constants18.GL.SAMPLER_2D,
3537
- import_constants18.GL.SAMPLER_CUBE,
3538
- import_constants18.GL.SAMPLER_3D,
3539
- import_constants18.GL.SAMPLER_2D_SHADOW,
3540
- import_constants18.GL.SAMPLER_2D_ARRAY,
3541
- import_constants18.GL.SAMPLER_2D_ARRAY_SHADOW,
3542
- import_constants18.GL.SAMPLER_CUBE_SHADOW,
3543
- import_constants18.GL.INT_SAMPLER_2D,
3544
- import_constants18.GL.INT_SAMPLER_3D,
3545
- import_constants18.GL.INT_SAMPLER_CUBE,
3546
- import_constants18.GL.INT_SAMPLER_2D_ARRAY,
3547
- import_constants18.GL.UNSIGNED_INT_SAMPLER_2D,
3548
- import_constants18.GL.UNSIGNED_INT_SAMPLER_3D,
3549
- import_constants18.GL.UNSIGNED_INT_SAMPLER_CUBE,
3550
- import_constants18.GL.UNSIGNED_INT_SAMPLER_2D_ARRAY
3418
+ 35678,
3419
+ 35680,
3420
+ 35679,
3421
+ 35682,
3422
+ 36289,
3423
+ 36292,
3424
+ 36293,
3425
+ 36298,
3426
+ 36299,
3427
+ 36300,
3428
+ 36303,
3429
+ 36306,
3430
+ 36307,
3431
+ 36308,
3432
+ 36311
3551
3433
  ];
3552
3434
  var COMPOSITE_GL_TYPES = {
3553
- [import_constants18.GL.FLOAT]: [import_constants18.GL.FLOAT, 1, "float", "f32", "float32"],
3554
- [import_constants18.GL.FLOAT_VEC2]: [import_constants18.GL.FLOAT, 2, "vec2", "vec2<f32>", "float32x2"],
3555
- [import_constants18.GL.FLOAT_VEC3]: [import_constants18.GL.FLOAT, 3, "vec3", "vec3<f32>", "float32x3"],
3556
- [import_constants18.GL.FLOAT_VEC4]: [import_constants18.GL.FLOAT, 4, "vec4", "vec4<f32>", "float32x4"],
3557
- [import_constants18.GL.INT]: [import_constants18.GL.INT, 1, "int", "i32", "sint32"],
3558
- [import_constants18.GL.INT_VEC2]: [import_constants18.GL.INT, 2, "ivec2", "vec2<i32>", "sint32x2"],
3559
- [import_constants18.GL.INT_VEC3]: [import_constants18.GL.INT, 3, "ivec3", "vec3<i32>", "sint32x3"],
3560
- [import_constants18.GL.INT_VEC4]: [import_constants18.GL.INT, 4, "ivec4", "vec4<i32>", "sint32x4"],
3561
- [import_constants18.GL.UNSIGNED_INT]: [import_constants18.GL.UNSIGNED_INT, 1, "uint", "u32", "uint32"],
3562
- [import_constants18.GL.UNSIGNED_INT_VEC2]: [import_constants18.GL.UNSIGNED_INT, 2, "uvec2", "vec2<u32>", "uint32x2"],
3563
- [import_constants18.GL.UNSIGNED_INT_VEC3]: [import_constants18.GL.UNSIGNED_INT, 3, "uvec3", "vec3<u32>", "uint32x3"],
3564
- [import_constants18.GL.UNSIGNED_INT_VEC4]: [import_constants18.GL.UNSIGNED_INT, 4, "uvec4", "vec4<u32>", "uint32x4"],
3565
- [import_constants18.GL.BOOL]: [import_constants18.GL.FLOAT, 1, "bool", "f32", "float32"],
3566
- [import_constants18.GL.BOOL_VEC2]: [import_constants18.GL.FLOAT, 2, "bvec2", "vec2<f32>", "float32x2"],
3567
- [import_constants18.GL.BOOL_VEC3]: [import_constants18.GL.FLOAT, 3, "bvec3", "vec3<f32>", "float32x3"],
3568
- [import_constants18.GL.BOOL_VEC4]: [import_constants18.GL.FLOAT, 4, "bvec4", "vec4<f32>", "float32x4"],
3435
+ [5126]: [5126, 1, "float", "f32", "float32"],
3436
+ [35664]: [5126, 2, "vec2", "vec2<f32>", "float32x2"],
3437
+ [35665]: [5126, 3, "vec3", "vec3<f32>", "float32x3"],
3438
+ [35666]: [5126, 4, "vec4", "vec4<f32>", "float32x4"],
3439
+ [5124]: [5124, 1, "int", "i32", "sint32"],
3440
+ [35667]: [5124, 2, "ivec2", "vec2<i32>", "sint32x2"],
3441
+ [35668]: [5124, 3, "ivec3", "vec3<i32>", "sint32x3"],
3442
+ [35669]: [5124, 4, "ivec4", "vec4<i32>", "sint32x4"],
3443
+ [5125]: [5125, 1, "uint", "u32", "uint32"],
3444
+ [36294]: [5125, 2, "uvec2", "vec2<u32>", "uint32x2"],
3445
+ [36295]: [5125, 3, "uvec3", "vec3<u32>", "uint32x3"],
3446
+ [36296]: [5125, 4, "uvec4", "vec4<u32>", "uint32x4"],
3447
+ [35670]: [5126, 1, "bool", "f32", "float32"],
3448
+ [35671]: [5126, 2, "bvec2", "vec2<f32>", "float32x2"],
3449
+ [35672]: [5126, 3, "bvec3", "vec3<f32>", "float32x3"],
3450
+ [35673]: [5126, 4, "bvec4", "vec4<f32>", "float32x4"],
3569
3451
  // TODO - are sizes/components below correct?
3570
- [import_constants18.GL.FLOAT_MAT2]: [import_constants18.GL.FLOAT, 8, "mat2", "mat2x2<f32>"],
3452
+ [35674]: [5126, 8, "mat2", "mat2x2<f32>"],
3571
3453
  // 4
3572
- [import_constants18.GL.FLOAT_MAT2x3]: [import_constants18.GL.FLOAT, 8, "mat2x3", "mat2x3<f32>"],
3454
+ [35685]: [5126, 8, "mat2x3", "mat2x3<f32>"],
3573
3455
  // 6
3574
- [import_constants18.GL.FLOAT_MAT2x4]: [import_constants18.GL.FLOAT, 8, "mat2x4", "mat2x4<f32>"],
3456
+ [35686]: [5126, 8, "mat2x4", "mat2x4<f32>"],
3575
3457
  // 8
3576
- [import_constants18.GL.FLOAT_MAT3x2]: [import_constants18.GL.FLOAT, 12, "mat3x2", "mat3x2<f32>"],
3458
+ [35687]: [5126, 12, "mat3x2", "mat3x2<f32>"],
3577
3459
  // 6
3578
- [import_constants18.GL.FLOAT_MAT3]: [import_constants18.GL.FLOAT, 12, "mat3", "mat3x3<f32>"],
3460
+ [35675]: [5126, 12, "mat3", "mat3x3<f32>"],
3579
3461
  // 9
3580
- [import_constants18.GL.FLOAT_MAT3x4]: [import_constants18.GL.FLOAT, 12, "mat3x4", "mat3x4<f32>"],
3462
+ [35688]: [5126, 12, "mat3x4", "mat3x4<f32>"],
3581
3463
  // 12
3582
- [import_constants18.GL.FLOAT_MAT4x2]: [import_constants18.GL.FLOAT, 16, "mat4x2", "mat4x2<f32>"],
3464
+ [35689]: [5126, 16, "mat4x2", "mat4x2<f32>"],
3583
3465
  // 8
3584
- [import_constants18.GL.FLOAT_MAT4x3]: [import_constants18.GL.FLOAT, 16, "mat4x3", "mat4x3<f32>"],
3466
+ [35690]: [5126, 16, "mat4x3", "mat4x3<f32>"],
3585
3467
  // 12
3586
- [import_constants18.GL.FLOAT_MAT4]: [import_constants18.GL.FLOAT, 16, "mat4", "mat4x4<f32>"]
3468
+ [35676]: [5126, 16, "mat4", "mat4x4<f32>"]
3587
3469
  // 16
3588
3470
  };
3589
3471
  function decodeGLUniformType(glUniformType) {
@@ -3656,7 +3538,7 @@ function getShaderLayout(gl, program) {
3656
3538
  }
3657
3539
  function readAttributeDeclarations(gl, program) {
3658
3540
  const attributes = [];
3659
- const count = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);
3541
+ const count = gl.getProgramParameter(program, 35721);
3660
3542
  for (let index = 0; index < count; index++) {
3661
3543
  const activeInfo = gl.getActiveAttrib(program, index);
3662
3544
  if (!activeInfo) {
@@ -3685,7 +3567,7 @@ function readAttributeDeclarations(gl, program) {
3685
3567
  }
3686
3568
  function readVaryings(gl, program) {
3687
3569
  const varyings = [];
3688
- const count = gl.getProgramParameter(program, import_constants19.GL.TRANSFORM_FEEDBACK_VARYINGS);
3570
+ const count = gl.getProgramParameter(program, 35971);
3689
3571
  for (let location = 0; location < count; location++) {
3690
3572
  const activeInfo = gl.getTransformFeedbackVarying(program, location);
3691
3573
  if (!activeInfo) {
@@ -3702,7 +3584,7 @@ function readVaryings(gl, program) {
3702
3584
  }
3703
3585
  function readUniformBindings(gl, program) {
3704
3586
  const uniforms = [];
3705
- const uniformCount = gl.getProgramParameter(program, import_constants19.GL.ACTIVE_UNIFORMS);
3587
+ const uniformCount = gl.getProgramParameter(program, 35718);
3706
3588
  for (let i = 0; i < uniformCount; i++) {
3707
3589
  const activeInfo = gl.getActiveUniform(program, i);
3708
3590
  if (!activeInfo) {
@@ -3738,22 +3620,22 @@ function readUniformBindings(gl, program) {
3738
3620
  function readUniformBlocks(gl, program) {
3739
3621
  const getBlockParameter = (blockIndex, pname) => gl.getActiveUniformBlockParameter(program, blockIndex, pname);
3740
3622
  const uniformBlocks = [];
3741
- const blockCount = gl.getProgramParameter(program, import_constants19.GL.ACTIVE_UNIFORM_BLOCKS);
3623
+ const blockCount = gl.getProgramParameter(program, 35382);
3742
3624
  for (let blockIndex = 0; blockIndex < blockCount; blockIndex++) {
3743
3625
  const blockInfo = {
3744
3626
  name: gl.getActiveUniformBlockName(program, blockIndex) || "",
3745
- location: getBlockParameter(blockIndex, import_constants19.GL.UNIFORM_BLOCK_BINDING),
3746
- byteLength: getBlockParameter(blockIndex, import_constants19.GL.UNIFORM_BLOCK_DATA_SIZE),
3747
- vertex: getBlockParameter(blockIndex, import_constants19.GL.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),
3748
- fragment: getBlockParameter(blockIndex, import_constants19.GL.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),
3749
- uniformCount: getBlockParameter(blockIndex, import_constants19.GL.UNIFORM_BLOCK_ACTIVE_UNIFORMS),
3627
+ location: getBlockParameter(blockIndex, 35391),
3628
+ byteLength: getBlockParameter(blockIndex, 35392),
3629
+ vertex: getBlockParameter(blockIndex, 35396),
3630
+ fragment: getBlockParameter(blockIndex, 35398),
3631
+ uniformCount: getBlockParameter(blockIndex, 35394),
3750
3632
  uniforms: []
3751
3633
  };
3752
- const uniformIndices = getBlockParameter(blockIndex, import_constants19.GL.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES) || [];
3753
- const uniformType = gl.getActiveUniforms(program, uniformIndices, import_constants19.GL.UNIFORM_TYPE);
3754
- const uniformArrayLength = gl.getActiveUniforms(program, uniformIndices, import_constants19.GL.UNIFORM_SIZE);
3755
- const uniformOffset = gl.getActiveUniforms(program, uniformIndices, import_constants19.GL.UNIFORM_OFFSET);
3756
- const uniformStride = gl.getActiveUniforms(program, uniformIndices, import_constants19.GL.UNIFORM_ARRAY_STRIDE);
3634
+ const uniformIndices = getBlockParameter(blockIndex, 35395) || [];
3635
+ const uniformType = gl.getActiveUniforms(program, uniformIndices, 35383);
3636
+ const uniformArrayLength = gl.getActiveUniforms(program, uniformIndices, 35384);
3637
+ const uniformOffset = gl.getActiveUniforms(program, uniformIndices, 35387);
3638
+ const uniformStride = gl.getActiveUniforms(program, uniformIndices, 35388);
3757
3639
  for (let i = 0; i < blockInfo.uniformCount; ++i) {
3758
3640
  const activeInfo = gl.getActiveUniform(program, uniformIndices[i]);
3759
3641
  if (!activeInfo) {
@@ -3776,21 +3658,21 @@ function readUniformBlocks(gl, program) {
3776
3658
  return uniformBlocks;
3777
3659
  }
3778
3660
  var SAMPLER_UNIFORMS_GL_TO_GPU = {
3779
- [import_constants19.GL.SAMPLER_2D]: ["2d", "float"],
3780
- [import_constants19.GL.SAMPLER_CUBE]: ["cube", "float"],
3781
- [import_constants19.GL.SAMPLER_3D]: ["3d", "float"],
3782
- [import_constants19.GL.SAMPLER_2D_SHADOW]: ["3d", "depth"],
3783
- [import_constants19.GL.SAMPLER_2D_ARRAY]: ["2d-array", "float"],
3784
- [import_constants19.GL.SAMPLER_2D_ARRAY_SHADOW]: ["2d-array", "depth"],
3785
- [import_constants19.GL.SAMPLER_CUBE_SHADOW]: ["cube", "float"],
3786
- [import_constants19.GL.INT_SAMPLER_2D]: ["2d", "sint"],
3787
- [import_constants19.GL.INT_SAMPLER_3D]: ["3d", "sint"],
3788
- [import_constants19.GL.INT_SAMPLER_CUBE]: ["cube", "sint"],
3789
- [import_constants19.GL.INT_SAMPLER_2D_ARRAY]: ["2d-array", "uint"],
3790
- [import_constants19.GL.UNSIGNED_INT_SAMPLER_2D]: ["2d", "uint"],
3791
- [import_constants19.GL.UNSIGNED_INT_SAMPLER_3D]: ["3d", "uint"],
3792
- [import_constants19.GL.UNSIGNED_INT_SAMPLER_CUBE]: ["cube", "uint"],
3793
- [import_constants19.GL.UNSIGNED_INT_SAMPLER_2D_ARRAY]: ["2d-array", "uint"]
3661
+ [35678]: ["2d", "float"],
3662
+ [35680]: ["cube", "float"],
3663
+ [35679]: ["3d", "float"],
3664
+ [35682]: ["3d", "depth"],
3665
+ [36289]: ["2d-array", "float"],
3666
+ [36292]: ["2d-array", "depth"],
3667
+ [36293]: ["cube", "float"],
3668
+ [36298]: ["2d", "sint"],
3669
+ [36299]: ["3d", "sint"],
3670
+ [36300]: ["cube", "sint"],
3671
+ [36303]: ["2d-array", "uint"],
3672
+ [36306]: ["2d", "uint"],
3673
+ [36307]: ["3d", "uint"],
3674
+ [36308]: ["cube", "uint"],
3675
+ [36311]: ["2d-array", "uint"]
3794
3676
  };
3795
3677
  function getSamplerInfo(type) {
3796
3678
  const sampler = SAMPLER_UNIFORMS_GL_TO_GPU[type];
@@ -3821,7 +3703,7 @@ function parseUniformName(name) {
3821
3703
  }
3822
3704
 
3823
3705
  // dist/adapter/helpers/set-uniform.js
3824
- var import_constants20 = require("@luma.gl/constants");
3706
+ var import_constants19 = require("@luma.gl/constants");
3825
3707
  function setUniform(gl, location, type, value) {
3826
3708
  const gl2 = gl;
3827
3709
  let uniformValue = value;
@@ -3833,97 +3715,97 @@ function setUniform(gl, location, type, value) {
3833
3715
  }
3834
3716
  const arrayValue = typeof uniformValue === "number" ? [uniformValue] : uniformValue;
3835
3717
  switch (type) {
3836
- case import_constants20.GL.SAMPLER_2D:
3837
- case import_constants20.GL.SAMPLER_CUBE:
3838
- case import_constants20.GL.SAMPLER_3D:
3839
- case import_constants20.GL.SAMPLER_2D_SHADOW:
3840
- case import_constants20.GL.SAMPLER_2D_ARRAY:
3841
- case import_constants20.GL.SAMPLER_2D_ARRAY_SHADOW:
3842
- case import_constants20.GL.SAMPLER_CUBE_SHADOW:
3843
- case import_constants20.GL.INT_SAMPLER_2D:
3844
- case import_constants20.GL.INT_SAMPLER_3D:
3845
- case import_constants20.GL.INT_SAMPLER_CUBE:
3846
- case import_constants20.GL.INT_SAMPLER_2D_ARRAY:
3847
- case import_constants20.GL.UNSIGNED_INT_SAMPLER_2D:
3848
- case import_constants20.GL.UNSIGNED_INT_SAMPLER_3D:
3849
- case import_constants20.GL.UNSIGNED_INT_SAMPLER_CUBE:
3850
- case import_constants20.GL.UNSIGNED_INT_SAMPLER_2D_ARRAY:
3718
+ case 35678:
3719
+ case 35680:
3720
+ case 35679:
3721
+ case 35682:
3722
+ case 36289:
3723
+ case 36292:
3724
+ case 36293:
3725
+ case 36298:
3726
+ case 36299:
3727
+ case 36300:
3728
+ case 36303:
3729
+ case 36306:
3730
+ case 36307:
3731
+ case 36308:
3732
+ case 36311:
3851
3733
  if (typeof value !== "number") {
3852
3734
  throw new Error("samplers must be set to integers");
3853
3735
  }
3854
3736
  return gl.uniform1i(location, value);
3855
- case import_constants20.GL.FLOAT:
3737
+ case 5126:
3856
3738
  return gl.uniform1fv(location, arrayValue);
3857
- case import_constants20.GL.FLOAT_VEC2:
3739
+ case 35664:
3858
3740
  return gl.uniform2fv(location, arrayValue);
3859
- case import_constants20.GL.FLOAT_VEC3:
3741
+ case 35665:
3860
3742
  return gl.uniform3fv(location, arrayValue);
3861
- case import_constants20.GL.FLOAT_VEC4:
3743
+ case 35666:
3862
3744
  return gl.uniform4fv(location, arrayValue);
3863
- case import_constants20.GL.INT:
3745
+ case 5124:
3864
3746
  return gl.uniform1iv(location, arrayValue);
3865
- case import_constants20.GL.INT_VEC2:
3747
+ case 35667:
3866
3748
  return gl.uniform2iv(location, arrayValue);
3867
- case import_constants20.GL.INT_VEC3:
3749
+ case 35668:
3868
3750
  return gl.uniform3iv(location, arrayValue);
3869
- case import_constants20.GL.INT_VEC4:
3751
+ case 35669:
3870
3752
  return gl.uniform4iv(location, arrayValue);
3871
- case import_constants20.GL.BOOL:
3753
+ case 35670:
3872
3754
  return gl.uniform1iv(location, arrayValue);
3873
- case import_constants20.GL.BOOL_VEC2:
3755
+ case 35671:
3874
3756
  return gl.uniform2iv(location, arrayValue);
3875
- case import_constants20.GL.BOOL_VEC3:
3757
+ case 35672:
3876
3758
  return gl.uniform3iv(location, arrayValue);
3877
- case import_constants20.GL.BOOL_VEC4:
3759
+ case 35673:
3878
3760
  return gl.uniform4iv(location, arrayValue);
3879
- case import_constants20.GL.UNSIGNED_INT:
3761
+ case 5125:
3880
3762
  return gl2.uniform1uiv(location, arrayValue, 1);
3881
- case import_constants20.GL.UNSIGNED_INT_VEC2:
3763
+ case 36294:
3882
3764
  return gl2.uniform2uiv(location, arrayValue, 2);
3883
- case import_constants20.GL.UNSIGNED_INT_VEC3:
3765
+ case 36295:
3884
3766
  return gl2.uniform3uiv(location, arrayValue, 3);
3885
- case import_constants20.GL.UNSIGNED_INT_VEC4:
3767
+ case 36296:
3886
3768
  return gl2.uniform4uiv(location, arrayValue, 4);
3887
- case import_constants20.GL.FLOAT_MAT2:
3769
+ case 35674:
3888
3770
  return gl.uniformMatrix2fv(location, false, arrayValue);
3889
- case import_constants20.GL.FLOAT_MAT3:
3771
+ case 35675:
3890
3772
  return gl.uniformMatrix3fv(location, false, arrayValue);
3891
- case import_constants20.GL.FLOAT_MAT4:
3773
+ case 35676:
3892
3774
  return gl.uniformMatrix4fv(location, false, arrayValue);
3893
- case import_constants20.GL.FLOAT_MAT2x3:
3775
+ case 35685:
3894
3776
  return gl2.uniformMatrix2x3fv(location, false, arrayValue);
3895
- case import_constants20.GL.FLOAT_MAT2x4:
3777
+ case 35686:
3896
3778
  return gl2.uniformMatrix2x4fv(location, false, arrayValue);
3897
- case import_constants20.GL.FLOAT_MAT3x2:
3779
+ case 35687:
3898
3780
  return gl2.uniformMatrix3x2fv(location, false, arrayValue);
3899
- case import_constants20.GL.FLOAT_MAT3x4:
3781
+ case 35688:
3900
3782
  return gl2.uniformMatrix3x4fv(location, false, arrayValue);
3901
- case import_constants20.GL.FLOAT_MAT4x2:
3783
+ case 35689:
3902
3784
  return gl2.uniformMatrix4x2fv(location, false, arrayValue);
3903
- case import_constants20.GL.FLOAT_MAT4x3:
3785
+ case 35690:
3904
3786
  return gl2.uniformMatrix4x3fv(location, false, arrayValue);
3905
3787
  }
3906
3788
  throw new Error("Illegal uniform");
3907
3789
  }
3908
3790
 
3909
3791
  // dist/adapter/helpers/webgl-topology-utils.js
3910
- var import_constants21 = require("@luma.gl/constants");
3792
+ var import_constants20 = require("@luma.gl/constants");
3911
3793
  function getGLDrawMode(topology) {
3912
3794
  switch (topology) {
3913
3795
  case "point-list":
3914
- return import_constants21.GL.POINTS;
3796
+ return 0;
3915
3797
  case "line-list":
3916
- return import_constants21.GL.LINES;
3798
+ return 1;
3917
3799
  case "line-strip":
3918
- return import_constants21.GL.LINE_STRIP;
3800
+ return 3;
3919
3801
  case "line-loop-webgl":
3920
- return import_constants21.GL.LINE_LOOP;
3802
+ return 2;
3921
3803
  case "triangle-list":
3922
- return import_constants21.GL.TRIANGLES;
3804
+ return 4;
3923
3805
  case "triangle-strip":
3924
- return import_constants21.GL.TRIANGLE_STRIP;
3806
+ return 5;
3925
3807
  case "triangle-fan-webgl":
3926
- return import_constants21.GL.TRIANGLE_FAN;
3808
+ return 6;
3927
3809
  default:
3928
3810
  throw new Error(topology);
3929
3811
  }
@@ -3931,19 +3813,19 @@ function getGLDrawMode(topology) {
3931
3813
  function getGLPrimitive(topology) {
3932
3814
  switch (topology) {
3933
3815
  case "point-list":
3934
- return import_constants21.GL.POINTS;
3816
+ return 0;
3935
3817
  case "line-list":
3936
- return import_constants21.GL.LINES;
3818
+ return 1;
3937
3819
  case "line-strip":
3938
- return import_constants21.GL.LINES;
3820
+ return 1;
3939
3821
  case "line-loop-webgl":
3940
- return import_constants21.GL.LINES;
3822
+ return 1;
3941
3823
  case "triangle-list":
3942
- return import_constants21.GL.TRIANGLES;
3824
+ return 4;
3943
3825
  case "triangle-strip":
3944
- return import_constants21.GL.TRIANGLES;
3826
+ return 4;
3945
3827
  case "triangle-fan-webgl":
3946
- return import_constants21.GL.TRIANGLES;
3828
+ return 4;
3947
3829
  default:
3948
3830
  throw new Error(topology);
3949
3831
  }
@@ -3951,7 +3833,7 @@ function getGLPrimitive(topology) {
3951
3833
 
3952
3834
  // dist/adapter/resources/webgl-render-pipeline.js
3953
3835
  var LOG_PROGRAM_PERF_PRIORITY = 4;
3954
- var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
3836
+ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
3955
3837
  /** The WebGL device that created this render pipeline */
3956
3838
  device;
3957
3839
  /** Handle to underlying WebGL program */
@@ -3976,22 +3858,22 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
3976
3858
  this.device = device;
3977
3859
  this.handle = this.props.handle || this.device.gl.createProgram();
3978
3860
  this.device.setSpectorMetadata(this.handle, { id: this.props.id });
3979
- this.vs = (0, import_core19.cast)(props.vs);
3980
- this.fs = (0, import_core19.cast)(props.fs);
3981
- const { varyings, bufferMode = import_constants22.GL.SEPARATE_ATTRIBS } = props;
3861
+ this.vs = (0, import_core17.cast)(props.vs);
3862
+ this.fs = (0, import_core17.cast)(props.fs);
3863
+ const { varyings, bufferMode = 35981 } = props;
3982
3864
  if (varyings && varyings.length > 0) {
3983
3865
  this.varyings = varyings;
3984
3866
  this.device.gl.transformFeedbackVaryings(this.handle, varyings, bufferMode);
3985
3867
  }
3986
3868
  this._linkShaders();
3987
- import_core19.log.time(0, `RenderPipeline ${this.id} - shaderLayout introspection`)();
3869
+ import_core17.log.time(0, `RenderPipeline ${this.id} - shaderLayout introspection`)();
3988
3870
  this.introspectedLayout = getShaderLayout(this.device.gl, this.handle);
3989
- import_core19.log.timeEnd(0, `RenderPipeline ${this.id} - shaderLayout introspection`)();
3990
- this.shaderLayout = (0, import_core20.mergeShaderLayout)(this.introspectedLayout, props.shaderLayout);
3871
+ import_core17.log.timeEnd(0, `RenderPipeline ${this.id} - shaderLayout introspection`)();
3872
+ this.shaderLayout = (0, import_core18.mergeShaderLayout)(this.introspectedLayout, props.shaderLayout);
3991
3873
  switch (this.props.topology) {
3992
3874
  case "triangle-fan-webgl":
3993
3875
  case "line-loop-webgl":
3994
- import_core19.log.warn(`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`);
3876
+ import_core17.log.warn(`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`);
3995
3877
  break;
3996
3878
  default:
3997
3879
  }
@@ -4011,11 +3893,11 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
4011
3893
  const binding = this.shaderLayout.bindings.find((binding2) => binding2.name === name) || this.shaderLayout.bindings.find((binding2) => binding2.name === `${name}Uniforms`);
4012
3894
  if (!binding) {
4013
3895
  const validBindings = this.shaderLayout.bindings.map((binding2) => `"${binding2.name}"`).join(", ");
4014
- import_core19.log.warn(`Unknown binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`)();
3896
+ import_core17.log.warn(`Unknown binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`)();
4015
3897
  continue;
4016
3898
  }
4017
3899
  if (!value) {
4018
- import_core19.log.warn(`Unsetting binding "${name}" in render pipeline "${this.id}"`)();
3900
+ import_core17.log.warn(`Unsetting binding "${name}" in render pipeline "${this.id}"`)();
4019
3901
  }
4020
3902
  switch (binding.type) {
4021
3903
  case "uniform":
@@ -4029,7 +3911,7 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
4029
3911
  }
4030
3912
  break;
4031
3913
  case "sampler":
4032
- import_core19.log.warn(`Ignoring sampler ${name}`)();
3914
+ import_core17.log.warn(`Ignoring sampler ${name}`)();
4033
3915
  break;
4034
3916
  default:
4035
3917
  throw new Error(binding.type);
@@ -4043,9 +3925,6 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
4043
3925
  */
4044
3926
  draw(options) {
4045
3927
  var _a;
4046
- if (this.linkStatus !== "success") {
4047
- return false;
4048
- }
4049
3928
  const {
4050
3929
  renderPass,
4051
3930
  vertexArray,
@@ -4062,9 +3941,18 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
4062
3941
  const isIndexed = Boolean(vertexArray.indexBuffer);
4063
3942
  const glIndexType = (_a = vertexArray.indexBuffer) == null ? void 0 : _a.glIndexType;
4064
3943
  const isInstanced = Number(instanceCount) > 0;
3944
+ if (this.linkStatus !== "success") {
3945
+ import_core17.log.info(2, `RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)();
3946
+ return false;
3947
+ }
4065
3948
  if (!this._areTexturesRenderable() || vertexCount === 0) {
3949
+ import_core17.log.info(2, `RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)();
4066
3950
  return false;
4067
3951
  }
3952
+ if (vertexCount === 0) {
3953
+ import_core17.log.info(2, `RenderPipeline:${this.id}.draw() aborted - no vertices to draw`)();
3954
+ return true;
3955
+ }
4068
3956
  this.device.gl.useProgram(this.handle);
4069
3957
  vertexArray.bindBeforeRender(renderPass);
4070
3958
  if (transformFeedback) {
@@ -4099,9 +3987,9 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
4099
3987
  }
4100
3988
  // DEPRECATED METHODS
4101
3989
  setUniformsWebGL(uniforms) {
4102
- const { bindings } = (0, import_core19.splitUniformsAndBindings)(uniforms);
3990
+ const { bindings } = (0, import_core17.splitUniformsAndBindings)(uniforms);
4103
3991
  Object.keys(bindings).forEach((name) => {
4104
- import_core19.log.warn(`Unsupported value "${JSON.stringify(bindings[name])}" used in setUniforms() for key ${name}. Use setBindings() instead?`)();
3992
+ import_core17.log.warn(`Unsupported value "${JSON.stringify(bindings[name])}" used in setUniforms() for key ${name}. Use setBindings() instead?`)();
4105
3993
  });
4106
3994
  Object.assign(this.uniforms, uniforms);
4107
3995
  }
@@ -4112,19 +4000,19 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
4112
4000
  const { gl } = this.device;
4113
4001
  gl.attachShader(this.handle, this.vs.handle);
4114
4002
  gl.attachShader(this.handle, this.fs.handle);
4115
- import_core19.log.time(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
4003
+ import_core17.log.time(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
4116
4004
  gl.linkProgram(this.handle);
4117
- import_core19.log.timeEnd(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
4118
- if (import_core19.log.level === 0) {
4005
+ import_core17.log.timeEnd(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
4006
+ if (import_core17.log.level === 0) {
4119
4007
  }
4120
4008
  if (!this.device.features.has("compilation-status-async-webgl")) {
4121
4009
  const status2 = this._getLinkStatus();
4122
4010
  this._reportLinkStatus(status2);
4123
4011
  return;
4124
4012
  }
4125
- import_core19.log.once(1, "RenderPipeline linking is asynchronous")();
4013
+ import_core17.log.once(1, "RenderPipeline linking is asynchronous")();
4126
4014
  await this._waitForLinkComplete();
4127
- import_core19.log.info(2, `RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();
4015
+ import_core17.log.info(2, `RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();
4128
4016
  const status = this._getLinkStatus();
4129
4017
  this._reportLinkStatus(status);
4130
4018
  }
@@ -4153,13 +4041,13 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
4153
4041
  */
4154
4042
  _getLinkStatus() {
4155
4043
  const { gl } = this.device;
4156
- const linked = gl.getProgramParameter(this.handle, gl.LINK_STATUS);
4044
+ const linked = gl.getProgramParameter(this.handle, 35714);
4157
4045
  if (!linked) {
4158
4046
  this.linkStatus = "error";
4159
4047
  return "linking";
4160
4048
  }
4161
4049
  gl.validateProgram(this.handle);
4162
- const validated = gl.getProgramParameter(this.handle, gl.VALIDATE_STATUS);
4050
+ const validated = gl.getProgramParameter(this.handle, 35715);
4163
4051
  if (!validated) {
4164
4052
  this.linkStatus = "error";
4165
4053
  return "validation";
@@ -4177,7 +4065,7 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
4177
4065
  }
4178
4066
  const { gl } = this.device;
4179
4067
  for (; ; ) {
4180
- const complete = gl.getProgramParameter(this.handle, import_constants22.GL.COMPLETION_STATUS_KHR);
4068
+ const complete = gl.getProgramParameter(this.handle, 37297);
4181
4069
  if (complete) {
4182
4070
  return;
4183
4071
  }
@@ -4217,15 +4105,15 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
4217
4105
  case "uniform":
4218
4106
  const { name } = binding;
4219
4107
  const location = gl.getUniformBlockIndex(this.handle, name);
4220
- if (location === import_constants22.GL.INVALID_INDEX) {
4108
+ if (location === 4294967295) {
4221
4109
  throw new Error(`Invalid uniform block name ${name}`);
4222
4110
  }
4223
4111
  gl.uniformBlockBinding(this.handle, uniformBufferIndex, location);
4224
4112
  if (value instanceof WEBGLBuffer) {
4225
- gl.bindBufferBase(import_constants22.GL.UNIFORM_BUFFER, uniformBufferIndex, value.handle);
4113
+ gl.bindBufferBase(35345, uniformBufferIndex, value.handle);
4226
4114
  } else {
4227
4115
  gl.bindBufferRange(
4228
- import_constants22.GL.UNIFORM_BUFFER,
4116
+ 35345,
4229
4117
  uniformBufferIndex,
4230
4118
  // @ts-expect-error
4231
4119
  value.buffer.handle,
@@ -4247,12 +4135,12 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
4247
4135
  } else if (value instanceof WEBGLTexture) {
4248
4136
  texture = value;
4249
4137
  } else if (value instanceof WEBGLFramebuffer && value.colorAttachments[0] instanceof WEBGLTexture) {
4250
- import_core19.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")();
4138
+ import_core17.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")();
4251
4139
  texture = value.colorAttachments[0];
4252
4140
  } else {
4253
4141
  throw new Error("No texture");
4254
4142
  }
4255
- gl.activeTexture(import_constants22.GL.TEXTURE0 + textureUnit);
4143
+ gl.activeTexture(33984 + textureUnit);
4256
4144
  gl.bindTexture(texture.target, texture.handle);
4257
4145
  textureUnit += 1;
4258
4146
  break;
@@ -4280,15 +4168,15 @@ var WEBGLRenderPipeline = class extends import_core19.RenderPipeline {
4280
4168
  };
4281
4169
 
4282
4170
  // dist/adapter/resources/webgl-command-encoder.js
4283
- var import_core22 = require("@luma.gl/core");
4171
+ var import_core20 = require("@luma.gl/core");
4284
4172
 
4285
4173
  // dist/adapter/resources/webgl-command-buffer.js
4286
- var import_core21 = require("@luma.gl/core");
4287
- var import_constants23 = require("@luma.gl/constants");
4174
+ var import_core19 = require("@luma.gl/core");
4175
+ var import_constants22 = require("@luma.gl/constants");
4288
4176
  function cast2(value) {
4289
4177
  return value;
4290
4178
  }
4291
- var WEBGLCommandBuffer = class extends import_core21.CommandBuffer {
4179
+ var WEBGLCommandBuffer = class extends import_core19.CommandBuffer {
4292
4180
  device;
4293
4181
  commands = [];
4294
4182
  constructor(device) {
@@ -4317,11 +4205,11 @@ var WEBGLCommandBuffer = class extends import_core21.CommandBuffer {
4317
4205
  function _copyBufferToBuffer(device, options) {
4318
4206
  const source = cast2(options.source);
4319
4207
  const destination = cast2(options.destination);
4320
- device.gl.bindBuffer(import_constants23.GL.COPY_READ_BUFFER, source.handle);
4321
- device.gl.bindBuffer(import_constants23.GL.COPY_WRITE_BUFFER, destination.handle);
4322
- device.gl.copyBufferSubData(import_constants23.GL.COPY_READ_BUFFER, import_constants23.GL.COPY_WRITE_BUFFER, options.sourceOffset ?? 0, options.destinationOffset ?? 0, options.size);
4323
- device.gl.bindBuffer(import_constants23.GL.COPY_READ_BUFFER, null);
4324
- device.gl.bindBuffer(import_constants23.GL.COPY_WRITE_BUFFER, null);
4208
+ device.gl.bindBuffer(36662, source.handle);
4209
+ device.gl.bindBuffer(36663, destination.handle);
4210
+ device.gl.copyBufferSubData(36662, 36663, options.sourceOffset ?? 0, options.destinationOffset ?? 0, options.size);
4211
+ device.gl.bindBuffer(36662, null);
4212
+ device.gl.bindBuffer(36663, null);
4325
4213
  }
4326
4214
  function _copyBufferToTexture(device, options) {
4327
4215
  throw new Error("Not implemented");
@@ -4371,12 +4259,12 @@ function _copyTextureToBuffer(device, options) {
4371
4259
  const sourceParams = getWebGLTextureParameters(framebuffer.texture.props.format);
4372
4260
  const sourceFormat = sourceParams.dataFormat;
4373
4261
  const sourceType = sourceParams.type;
4374
- device.gl.bindBuffer(import_constants23.GL.PIXEL_PACK_BUFFER, webglBuffer.handle);
4375
- device.gl.bindFramebuffer(import_constants23.GL.FRAMEBUFFER, framebuffer.handle);
4262
+ device.gl.bindBuffer(35051, webglBuffer.handle);
4263
+ device.gl.bindFramebuffer(36160, framebuffer.handle);
4376
4264
  device.gl.readPixels(origin[0], origin[1], sourceWidth, sourceHeight, sourceFormat, sourceType, byteOffset);
4377
4265
  } finally {
4378
- device.gl.bindBuffer(import_constants23.GL.PIXEL_PACK_BUFFER, null);
4379
- device.gl.bindFramebuffer(import_constants23.GL.FRAMEBUFFER, null);
4266
+ device.gl.bindBuffer(35051, null);
4267
+ device.gl.bindFramebuffer(36160, null);
4380
4268
  if (destroyFramebuffer) {
4381
4269
  framebuffer.destroy();
4382
4270
  }
@@ -4407,11 +4295,11 @@ function _copyTextureToTexture(device, options) {
4407
4295
  // depthOrArrayLayers = 0
4408
4296
  } = options;
4409
4297
  const destinationMipmaplevel = 0;
4410
- const destinationInternalFormat = import_constants23.GL.RGBA;
4298
+ const destinationInternalFormat = 6408;
4411
4299
  const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
4412
4300
  const [sourceX, sourceY] = origin;
4413
4301
  const isSubCopy = false;
4414
- device.gl.bindFramebuffer(import_constants23.GL.FRAMEBUFFER, framebuffer.handle);
4302
+ device.gl.bindFramebuffer(36160, framebuffer.handle);
4415
4303
  let texture = null;
4416
4304
  let textureTarget;
4417
4305
  if (destination instanceof WEBGLTexture) {
@@ -4446,7 +4334,7 @@ function _copyTextureToTexture(device, options) {
4446
4334
  return texture;
4447
4335
  }
4448
4336
  function getFramebuffer(source) {
4449
- if (source instanceof import_core21.Texture) {
4337
+ if (source instanceof import_core19.Texture) {
4450
4338
  const { width, height, id } = source;
4451
4339
  const framebuffer = source.device.createFramebuffer({
4452
4340
  id: `framebuffer-for-${id}`,
@@ -4460,7 +4348,7 @@ function getFramebuffer(source) {
4460
4348
  }
4461
4349
 
4462
4350
  // dist/adapter/resources/webgl-command-encoder.js
4463
- var WEBGLCommandEncoder = class extends import_core22.CommandEncoder {
4351
+ var WEBGLCommandEncoder = class extends import_core20.CommandEncoder {
4464
4352
  device;
4465
4353
  commandBuffer;
4466
4354
  constructor(device, props) {
@@ -4499,10 +4387,10 @@ var WEBGLCommandEncoder = class extends import_core22.CommandEncoder {
4499
4387
  };
4500
4388
 
4501
4389
  // dist/adapter/resources/webgl-vertex-array.js
4502
- var import_core23 = require("@luma.gl/core");
4503
- var import_constants24 = require("@luma.gl/constants");
4390
+ var import_core21 = require("@luma.gl/core");
4391
+ var import_constants23 = require("@luma.gl/constants");
4504
4392
  var import_env2 = require("@probe.gl/env");
4505
- var WEBGLVertexArray = class extends import_core23.VertexArray {
4393
+ var WEBGLVertexArray = class extends import_core21.VertexArray {
4506
4394
  get [Symbol.toStringTag]() {
4507
4395
  return "VertexArray";
4508
4396
  }
@@ -4540,22 +4428,22 @@ var WEBGLVertexArray = class extends import_core23.VertexArray {
4540
4428
  */
4541
4429
  setIndexBuffer(indexBuffer) {
4542
4430
  const buffer = indexBuffer;
4543
- if (buffer && buffer.glTarget !== import_constants24.GL.ELEMENT_ARRAY_BUFFER) {
4431
+ if (buffer && buffer.glTarget !== 34963) {
4544
4432
  throw new Error("Use .setBuffer()");
4545
4433
  }
4546
4434
  this.device.gl.bindVertexArray(this.handle);
4547
- this.device.gl.bindBuffer(import_constants24.GL.ELEMENT_ARRAY_BUFFER, buffer ? buffer.handle : null);
4435
+ this.device.gl.bindBuffer(34963, buffer ? buffer.handle : null);
4548
4436
  this.indexBuffer = buffer;
4549
4437
  }
4550
4438
  /** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */
4551
4439
  setBuffer(location, attributeBuffer) {
4552
4440
  const buffer = attributeBuffer;
4553
- if (buffer.glTarget === import_constants24.GL.ELEMENT_ARRAY_BUFFER) {
4441
+ if (buffer.glTarget === 34963) {
4554
4442
  throw new Error("Use .setIndexBuffer()");
4555
4443
  }
4556
4444
  const { size, type, stride, offset, normalized, integer, divisor } = this._getAccessor(location);
4557
4445
  this.device.gl.bindVertexArray(this.handle);
4558
- this.device.gl.bindBuffer(import_constants24.GL.ARRAY_BUFFER, buffer.handle);
4446
+ this.device.gl.bindBuffer(34962, buffer.handle);
4559
4447
  if (integer) {
4560
4448
  this.device.gl.vertexAttribIPointer(location, size, type, stride, offset);
4561
4449
  } else {
@@ -4575,7 +4463,7 @@ var WEBGLVertexArray = class extends import_core23.VertexArray {
4575
4463
  this.device.gl.bindVertexArray(this.handle);
4576
4464
  if (!this.init) {
4577
4465
  const webglBuffer = this.indexBuffer;
4578
- this.device.gl.bindBuffer(import_constants24.GL.ELEMENT_ARRAY_BUFFER, (webglBuffer == null ? void 0 : webglBuffer.handle) || null);
4466
+ this.device.gl.bindBuffer(34963, (webglBuffer == null ? void 0 : webglBuffer.handle) || null);
4579
4467
  this.init = true;
4580
4468
  }
4581
4469
  this._applyConstantAttributes();
@@ -4672,8 +4560,8 @@ var WEBGLVertexArray = class extends import_core23.VertexArray {
4672
4560
  this.buffer = this.buffer || this.device.createBuffer({ byteLength });
4673
4561
  updateNeeded = updateNeeded || !compareConstantArrayValues(constantValue, this.bufferValue);
4674
4562
  if (updateNeeded) {
4675
- const typedArray = (0, import_core23.getScratchArray)(value.constructor, length);
4676
- (0, import_core23.fillArray)({ target: typedArray, source: constantValue, start: 0, count: length });
4563
+ const typedArray = (0, import_core21.getScratchArray)(value.constructor, length);
4564
+ (0, import_core21.fillArray)({ target: typedArray, source: constantValue, start: 0, count: length });
4677
4565
  this.buffer.write(typedArray);
4678
4566
  this.bufferValue = value;
4679
4567
  }
@@ -4699,9 +4587,9 @@ function compareConstantArrayValues(v1, v2) {
4699
4587
  }
4700
4588
 
4701
4589
  // dist/adapter/resources/webgl-transform-feedback.js
4702
- var import_core24 = require("@luma.gl/core");
4703
- var import_constants25 = require("@luma.gl/constants");
4704
- var WEBGLTransformFeedback = class extends import_core24.TransformFeedback {
4590
+ var import_core22 = require("@luma.gl/core");
4591
+ var import_constants24 = require("@luma.gl/constants");
4592
+ var WEBGLTransformFeedback = class extends import_core22.TransformFeedback {
4705
4593
  device;
4706
4594
  gl;
4707
4595
  handle;
@@ -4736,7 +4624,7 @@ var WEBGLTransformFeedback = class extends import_core24.TransformFeedback {
4736
4624
  super.destroy();
4737
4625
  }
4738
4626
  begin(topology = "point-list") {
4739
- this.gl.bindTransformFeedback(import_constants25.GL.TRANSFORM_FEEDBACK, this.handle);
4627
+ this.gl.bindTransformFeedback(36386, this.handle);
4740
4628
  if (this.bindOnUse) {
4741
4629
  this._bindBuffers();
4742
4630
  }
@@ -4747,7 +4635,7 @@ var WEBGLTransformFeedback = class extends import_core24.TransformFeedback {
4747
4635
  if (!this.bindOnUse) {
4748
4636
  this._unbindBuffers();
4749
4637
  }
4750
- this.gl.bindTransformFeedback(import_constants25.GL.TRANSFORM_FEEDBACK, null);
4638
+ this.gl.bindTransformFeedback(36386, null);
4751
4639
  }
4752
4640
  // SUBCLASS
4753
4641
  setBuffers(buffers) {
@@ -4764,7 +4652,7 @@ var WEBGLTransformFeedback = class extends import_core24.TransformFeedback {
4764
4652
  const { buffer, byteLength, byteOffset } = this._getBufferRange(bufferOrRange);
4765
4653
  if (location < 0) {
4766
4654
  this.unusedBuffers[locationOrName] = buffer;
4767
- import_core24.log.warn(`${this.id} unusedBuffers varying buffer ${locationOrName}`)();
4655
+ import_core22.log.warn(`${this.id} unusedBuffers varying buffer ${locationOrName}`)();
4768
4656
  return;
4769
4657
  }
4770
4658
  this.buffers[location] = { buffer, byteLength, byteOffset };
@@ -4781,16 +4669,16 @@ var WEBGLTransformFeedback = class extends import_core24.TransformFeedback {
4781
4669
  }
4782
4670
  bind(funcOrHandle = this.handle) {
4783
4671
  if (typeof funcOrHandle !== "function") {
4784
- this.gl.bindTransformFeedback(import_constants25.GL.TRANSFORM_FEEDBACK, funcOrHandle);
4672
+ this.gl.bindTransformFeedback(36386, funcOrHandle);
4785
4673
  return this;
4786
4674
  }
4787
4675
  let value;
4788
4676
  if (!this._bound) {
4789
- this.gl.bindTransformFeedback(import_constants25.GL.TRANSFORM_FEEDBACK, this.handle);
4677
+ this.gl.bindTransformFeedback(36386, this.handle);
4790
4678
  this._bound = true;
4791
4679
  value = funcOrHandle();
4792
4680
  this._bound = false;
4793
- this.gl.bindTransformFeedback(import_constants25.GL.TRANSFORM_FEEDBACK, null);
4681
+ this.gl.bindTransformFeedback(36386, null);
4794
4682
  } else {
4795
4683
  value = funcOrHandle();
4796
4684
  }
@@ -4831,15 +4719,15 @@ var WEBGLTransformFeedback = class extends import_core24.TransformFeedback {
4831
4719
  }
4832
4720
  _unbindBuffers() {
4833
4721
  for (const bufferIndex in this.buffers) {
4834
- this.gl.bindBufferBase(import_constants25.GL.TRANSFORM_FEEDBACK_BUFFER, Number(bufferIndex), null);
4722
+ this.gl.bindBufferBase(35982, Number(bufferIndex), null);
4835
4723
  }
4836
4724
  }
4837
4725
  _bindBuffer(index, buffer, byteOffset = 0, byteLength) {
4838
4726
  const handle = buffer && buffer.handle;
4839
4727
  if (!handle || byteLength === void 0) {
4840
- this.gl.bindBufferBase(import_constants25.GL.TRANSFORM_FEEDBACK_BUFFER, index, handle);
4728
+ this.gl.bindBufferBase(35982, index, handle);
4841
4729
  } else {
4842
- this.gl.bindBufferRange(import_constants25.GL.TRANSFORM_FEEDBACK_BUFFER, index, handle, byteOffset, byteLength);
4730
+ this.gl.bindBufferRange(35982, index, handle, byteOffset, byteLength);
4843
4731
  }
4844
4732
  }
4845
4733
  };
@@ -4851,9 +4739,9 @@ function isIndex(value) {
4851
4739
  }
4852
4740
 
4853
4741
  // dist/adapter/resources/webgl-query-set.js
4854
- var import_core25 = require("@luma.gl/core");
4855
- var import_constants26 = require("@luma.gl/constants");
4856
- var WEBGLQuerySet = class extends import_core25.QuerySet {
4742
+ var import_core23 = require("@luma.gl/core");
4743
+ var import_constants25 = require("@luma.gl/constants");
4744
+ var WEBGLQuerySet = class extends import_core23.QuerySet {
4857
4745
  device;
4858
4746
  handle;
4859
4747
  target = null;
@@ -4882,21 +4770,21 @@ var WEBGLQuerySet = class extends import_core25.QuerySet {
4882
4770
  * GPU instruction stream.
4883
4771
  */
4884
4772
  beginTimestampQuery() {
4885
- return this._begin(import_constants26.GL.TIME_ELAPSED_EXT);
4773
+ return this._begin(35007);
4886
4774
  }
4887
4775
  endTimestampQuery() {
4888
4776
  this._end();
4889
4777
  }
4890
4778
  // Shortcut for occlusion queries
4891
4779
  beginOcclusionQuery(options) {
4892
- return this._begin((options == null ? void 0 : options.conservative) ? import_constants26.GL.ANY_SAMPLES_PASSED_CONSERVATIVE : import_constants26.GL.ANY_SAMPLES_PASSED);
4780
+ return this._begin((options == null ? void 0 : options.conservative) ? 36202 : 35887);
4893
4781
  }
4894
4782
  endOcclusionQuery() {
4895
4783
  this._end();
4896
4784
  }
4897
4785
  // Shortcut for transformFeedbackQuery
4898
4786
  beginTransformFeedbackQuery() {
4899
- return this._begin(import_constants26.GL.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
4787
+ return this._begin(35976);
4900
4788
  }
4901
4789
  endTransformFeedbackQuery() {
4902
4790
  this._end();
@@ -4938,7 +4826,7 @@ var WEBGLQuerySet = class extends import_core25.QuerySet {
4938
4826
  if (!this._queryPending) {
4939
4827
  return false;
4940
4828
  }
4941
- const resultAvailable = this.device.gl.getQueryParameter(this.handle, import_constants26.GL.QUERY_RESULT_AVAILABLE);
4829
+ const resultAvailable = this.device.gl.getQueryParameter(this.handle, 34919);
4942
4830
  if (resultAvailable) {
4943
4831
  this._queryPending = false;
4944
4832
  }
@@ -4946,11 +4834,11 @@ var WEBGLQuerySet = class extends import_core25.QuerySet {
4946
4834
  }
4947
4835
  // Timing query is disjoint, i.e. results are invalid
4948
4836
  isTimerDisjoint() {
4949
- return this.device.gl.getParameter(import_constants26.GL.GPU_DISJOINT_EXT);
4837
+ return this.device.gl.getParameter(36795);
4950
4838
  }
4951
4839
  // Returns query result.
4952
4840
  getResult() {
4953
- return this.device.gl.getQueryParameter(this.handle, import_constants26.GL.QUERY_RESULT);
4841
+ return this.device.gl.getQueryParameter(this.handle, 34918);
4954
4842
  }
4955
4843
  // Returns the query result, converted to milliseconds to match JavaScript conventions.
4956
4844
  getTimerMilliseconds() {
@@ -4981,44 +4869,44 @@ var WEBGLQuerySet = class extends import_core25.QuerySet {
4981
4869
  };
4982
4870
 
4983
4871
  // dist/classic/copy-and-blit.js
4984
- var import_core27 = require("@luma.gl/core");
4985
- var import_constants28 = require("@luma.gl/constants");
4872
+ var import_core25 = require("@luma.gl/core");
4873
+ var import_constants27 = require("@luma.gl/constants");
4986
4874
 
4987
4875
  // dist/classic/format-utils.js
4988
- var import_core26 = require("@luma.gl/core");
4989
- var import_constants27 = require("@luma.gl/constants");
4876
+ var import_core24 = require("@luma.gl/core");
4877
+ var import_constants26 = require("@luma.gl/constants");
4990
4878
  function glFormatToComponents(format) {
4991
4879
  switch (format) {
4992
- case import_constants27.GL.ALPHA:
4993
- case import_constants27.GL.R32F:
4994
- case import_constants27.GL.RED:
4880
+ case 6406:
4881
+ case 33326:
4882
+ case 6403:
4995
4883
  return 1;
4996
- case import_constants27.GL.RG32F:
4997
- case import_constants27.GL.RG:
4884
+ case 33328:
4885
+ case 33319:
4998
4886
  return 2;
4999
- case import_constants27.GL.RGB:
5000
- case import_constants27.GL.RGB32F:
4887
+ case 6407:
4888
+ case 34837:
5001
4889
  return 3;
5002
- case import_constants27.GL.RGBA:
5003
- case import_constants27.GL.RGBA32F:
4890
+ case 6408:
4891
+ case 34836:
5004
4892
  return 4;
5005
4893
  default:
5006
- (0, import_core26.assert)(false);
4894
+ (0, import_core24.assert)(false);
5007
4895
  return 0;
5008
4896
  }
5009
4897
  }
5010
4898
  function glTypeToBytes(type) {
5011
4899
  switch (type) {
5012
- case import_constants27.GL.UNSIGNED_BYTE:
4900
+ case 5121:
5013
4901
  return 1;
5014
- case import_constants27.GL.UNSIGNED_SHORT_5_6_5:
5015
- case import_constants27.GL.UNSIGNED_SHORT_4_4_4_4:
5016
- case import_constants27.GL.UNSIGNED_SHORT_5_5_5_1:
4902
+ case 33635:
4903
+ case 32819:
4904
+ case 32820:
5017
4905
  return 2;
5018
- case import_constants27.GL.FLOAT:
4906
+ case 5126:
5019
4907
  return 4;
5020
4908
  default:
5021
- (0, import_core26.assert)(false);
4909
+ (0, import_core24.assert)(false);
5022
4910
  return 0;
5023
4911
  }
5024
4912
  }
@@ -5029,8 +4917,8 @@ function readPixelsToArray(source, options) {
5029
4917
  const {
5030
4918
  sourceX = 0,
5031
4919
  sourceY = 0,
5032
- sourceFormat = import_constants28.GL.RGBA,
5033
- sourceAttachment = import_constants28.GL.COLOR_ATTACHMENT0
4920
+ sourceFormat = 6408,
4921
+ sourceAttachment = 36064
5034
4922
  // TODO - support gl.readBuffer
5035
4923
  } = options || {};
5036
4924
  let {
@@ -5041,31 +4929,31 @@ function readPixelsToArray(source, options) {
5041
4929
  sourceType
5042
4930
  } = options || {};
5043
4931
  const { framebuffer, deleteFramebuffer } = getFramebuffer2(source);
5044
- (0, import_core27.assert)(framebuffer);
4932
+ (0, import_core25.assert)(framebuffer);
5045
4933
  const { gl, handle } = framebuffer;
5046
4934
  sourceWidth = sourceWidth || framebuffer.width;
5047
4935
  sourceHeight = sourceHeight || framebuffer.height;
5048
- const attachment = sourceAttachment - import_constants28.GL.COLOR_ATTACHMENT0;
5049
- sourceType = sourceType || ((_b = (_a = framebuffer.colorAttachments[attachment]) == null ? void 0 : _a.texture) == null ? void 0 : _b.type) || import_constants28.GL.UNSIGNED_BYTE;
4936
+ const attachment = sourceAttachment - 36064;
4937
+ sourceType = sourceType || ((_b = (_a = framebuffer.colorAttachments[attachment]) == null ? void 0 : _a.texture) == null ? void 0 : _b.type) || 5121;
5050
4938
  target = getPixelArray(target, sourceType, sourceFormat, sourceWidth, sourceHeight);
5051
4939
  sourceType = sourceType || getGLTypeFromTypedArray(target);
5052
- const prevHandle = gl.bindFramebuffer(import_constants28.GL.FRAMEBUFFER, handle);
4940
+ const prevHandle = gl.bindFramebuffer(36160, handle);
5053
4941
  gl.readPixels(sourceX, sourceY, sourceWidth, sourceHeight, sourceFormat, sourceType, target);
5054
- gl.bindFramebuffer(import_constants28.GL.FRAMEBUFFER, prevHandle || null);
4942
+ gl.bindFramebuffer(36160, prevHandle || null);
5055
4943
  if (deleteFramebuffer) {
5056
4944
  framebuffer.destroy();
5057
4945
  }
5058
4946
  return target;
5059
4947
  }
5060
4948
  function readPixelsToBuffer(source, options) {
5061
- const { target, sourceX = 0, sourceY = 0, sourceFormat = import_constants28.GL.RGBA, targetByteOffset = 0 } = options || {};
4949
+ const { target, sourceX = 0, sourceY = 0, sourceFormat = 6408, targetByteOffset = 0 } = options || {};
5062
4950
  let { sourceWidth, sourceHeight, sourceType } = options || {};
5063
4951
  const { framebuffer, deleteFramebuffer } = getFramebuffer2(source);
5064
- (0, import_core27.assert)(framebuffer);
4952
+ (0, import_core25.assert)(framebuffer);
5065
4953
  sourceWidth = sourceWidth || framebuffer.width;
5066
4954
  sourceHeight = sourceHeight || framebuffer.height;
5067
4955
  const webglFramebuffer = framebuffer;
5068
- sourceType = sourceType || import_constants28.GL.UNSIGNED_BYTE;
4956
+ sourceType = sourceType || 5121;
5069
4957
  let webglBufferTarget = target;
5070
4958
  if (!webglBufferTarget) {
5071
4959
  const components = glFormatToComponents(sourceFormat);
@@ -5089,7 +4977,7 @@ function readPixelsToBuffer(source, options) {
5089
4977
  return webglBufferTarget;
5090
4978
  }
5091
4979
  function getFramebuffer2(source) {
5092
- if (!(source instanceof import_core27.Framebuffer)) {
4980
+ if (!(source instanceof import_core25.Framebuffer)) {
5093
4981
  return { framebuffer: toFramebuffer(source), deleteFramebuffer: true };
5094
4982
  }
5095
4983
  return { framebuffer: source, deleteFramebuffer: false };
@@ -5109,14 +4997,14 @@ function getPixelArray(pixelArray, type, format, width, height) {
5109
4997
  if (pixelArray) {
5110
4998
  return pixelArray;
5111
4999
  }
5112
- type = type || import_constants28.GL.UNSIGNED_BYTE;
5000
+ type = type || 5121;
5113
5001
  const ArrayType = getTypedArrayFromGLType(type, { clamped: false });
5114
5002
  const components = glFormatToComponents(format);
5115
5003
  return new ArrayType(width * height * components);
5116
5004
  }
5117
5005
 
5118
5006
  // dist/classic/clear.js
5119
- var import_core28 = require("@luma.gl/core");
5007
+ var import_core26 = require("@luma.gl/core");
5120
5008
  var GL_DEPTH_BUFFER_BIT2 = 256;
5121
5009
  var GL_STENCIL_BUFFER_BIT2 = 1024;
5122
5010
  var GL_COLOR_BUFFER_BIT2 = 16384;
@@ -5146,19 +5034,18 @@ function clear(device, options) {
5146
5034
  parameters.clearStencil = depth;
5147
5035
  }
5148
5036
  }
5149
- (0, import_core28.assert)(clearFlags !== 0, ERR_ARGUMENTS);
5150
- withGLParameters(device, parameters, () => {
5151
- const gl = device.gl;
5037
+ (0, import_core26.assert)(clearFlags !== 0, ERR_ARGUMENTS);
5038
+ const gl = device.gl;
5039
+ withGLParameters(gl, parameters, () => {
5152
5040
  gl.clear(clearFlags);
5153
5041
  });
5154
5042
  }
5155
5043
 
5156
5044
  // dist/adapter/webgl-device.js
5157
5045
  var LOG_LEVEL2 = 1;
5158
- var _WebGLDevice = class extends import_core29.Device {
5159
- static isSupported() {
5160
- return typeof WebGL2RenderingContext !== "undefined";
5161
- }
5046
+ var _WebGLDevice = class extends import_core27.Device {
5047
+ /** type of this device */
5048
+ type = "webgl";
5162
5049
  /** The underlying WebGL context */
5163
5050
  handle;
5164
5051
  features;
@@ -5170,6 +5057,10 @@ var _WebGLDevice = class extends import_core29.Device {
5170
5057
  //
5171
5058
  // Static methods, expected to be present by `luma.createDevice()`
5172
5059
  //
5060
+ /** Check if WebGL 2 is available */
5061
+ static isSupported() {
5062
+ return typeof WebGL2RenderingContext !== "undefined";
5063
+ }
5173
5064
  /**
5174
5065
  * Get a device instance from a GL context
5175
5066
  * Creates and instruments the device if not already created
@@ -5180,7 +5071,7 @@ var _WebGLDevice = class extends import_core29.Device {
5180
5071
  if (gl instanceof _WebGLDevice) {
5181
5072
  return gl;
5182
5073
  }
5183
- if ((gl == null ? void 0 : gl.device) instanceof import_core29.Device) {
5074
+ if ((gl == null ? void 0 : gl.device) instanceof import_core27.Device) {
5184
5075
  return gl.device;
5185
5076
  }
5186
5077
  if (!isWebGL(gl)) {
@@ -5190,7 +5081,7 @@ var _WebGLDevice = class extends import_core29.Device {
5190
5081
  }
5191
5082
  static async create(props = {}) {
5192
5083
  var _a;
5193
- import_core29.log.groupCollapsed(LOG_LEVEL2, "WebGLDevice created")();
5084
+ import_core27.log.groupCollapsed(LOG_LEVEL2, "WebGLDevice created")();
5194
5085
  const promises = [];
5195
5086
  if (props.debug) {
5196
5087
  promises.push(loadWebGLDeveloperTools());
@@ -5199,18 +5090,24 @@ var _WebGLDevice = class extends import_core29.Device {
5199
5090
  promises.push(loadSpectorJS());
5200
5091
  }
5201
5092
  if (typeof props.canvas === "string") {
5202
- promises.push(import_core29.CanvasContext.pageLoaded);
5093
+ promises.push(import_core27.CanvasContext.pageLoaded);
5203
5094
  }
5204
- await Promise.all(promises);
5205
- import_core29.log.probe(LOG_LEVEL2 + 1, "DOM is loaded")();
5095
+ const results = await Promise.allSettled(promises);
5096
+ for (const result of results) {
5097
+ if (result.status === "rejected") {
5098
+ import_core27.log.error(`Failed to initialize debug libraries ${result.reason}`)();
5099
+ }
5100
+ }
5101
+ import_core27.log.probe(LOG_LEVEL2 + 1, "DOM is loaded")();
5206
5102
  if ((_a = props.gl) == null ? void 0 : _a.device) {
5103
+ import_core27.log.warn("reattaching existing device")();
5207
5104
  return _WebGLDevice.attach(props.gl);
5208
5105
  }
5209
5106
  const device = new _WebGLDevice(props);
5210
- const message2 = `Created ${device.info.type}${device.debug ? " debug" : ""} context: ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContext.id}`;
5211
- import_core29.log.probe(LOG_LEVEL2, message2)();
5212
- import_core29.log.table(LOG_LEVEL2, device.info)();
5213
- import_core29.log.groupEnd(LOG_LEVEL2)();
5107
+ const message2 = `Created ${device.type}${device.debug ? " debug" : ""} context: ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContext.id}`;
5108
+ import_core27.log.probe(LOG_LEVEL2, message2)();
5109
+ import_core27.log.table(LOG_LEVEL2, device.info)();
5110
+ import_core27.log.groupEnd(LOG_LEVEL2)();
5214
5111
  return device;
5215
5112
  }
5216
5113
  //
@@ -5218,7 +5115,7 @@ var _WebGLDevice = class extends import_core29.Device {
5218
5115
  //
5219
5116
  constructor(props) {
5220
5117
  var _a, _b;
5221
- super({ ...props, id: props.id || (0, import_core29.uid)("webgl-device") });
5118
+ super({ ...props, id: props.id || (0, import_core27.uid)("webgl-device") });
5222
5119
  const device = (_a = props.gl) == null ? void 0 : _a.device;
5223
5120
  if (device) {
5224
5121
  throw new Error(`WebGL context already attached to device ${device.id}`);
@@ -5247,20 +5144,23 @@ var _WebGLDevice = class extends import_core29.Device {
5247
5144
  this.gl.device = this;
5248
5145
  this.gl._version = 2;
5249
5146
  this.info = getDeviceInfo(this.gl, this._extensions);
5250
- this.features = new WebGLDeviceFeatures(this.gl, this._extensions);
5251
5147
  this.limits = new WebGLDeviceLimits(this.gl);
5148
+ this.features = new WebGLDeviceFeatures(this.gl, this._extensions, this.props.disabledFeatures);
5149
+ if (this.props.initalizeFeatures) {
5150
+ this.features.initializeFeatures();
5151
+ }
5252
5152
  this.canvasContext.resize();
5253
5153
  const { enable: enable2 = true, copyState = false } = props;
5254
5154
  trackContextState(this.gl, {
5255
5155
  enable: enable2,
5256
5156
  copyState,
5257
- log: (...args) => import_core29.log.log(1, ...args)()
5157
+ log: (...args) => import_core27.log.log(1, ...args)()
5258
5158
  });
5259
5159
  if (props.debug) {
5260
5160
  this.gl = makeDebugContext(this.gl, { ...props, throwOnError: true });
5261
5161
  this.debug = true;
5262
- import_core29.log.level = Math.max(import_core29.log.level, 1);
5263
- import_core29.log.warn("WebGL debug mode activated. Performance reduced.")();
5162
+ import_core27.log.level = Math.max(import_core27.log.level, 1);
5163
+ import_core27.log.warn("WebGL debug mode activated. Performance reduced.")();
5264
5164
  }
5265
5165
  if (props.spector) {
5266
5166
  this.spectorJS = initializeSpectorJS({ ...this.props, canvas: this.handle.canvas });
@@ -5332,12 +5232,6 @@ var _WebGLDevice = class extends import_core29.Device {
5332
5232
  throw new Error("ComputePass not supported in WebGL");
5333
5233
  }
5334
5234
  renderPass = null;
5335
- getDefaultRenderPass() {
5336
- this.renderPass = this.renderPass || this.beginRenderPass({
5337
- framebuffer: this.canvasContext.getCurrentFramebuffer()
5338
- });
5339
- return this.renderPass;
5340
- }
5341
5235
  createCommandEncoder(props) {
5342
5236
  return new WEBGLCommandEncoder(this, props);
5343
5237
  }
@@ -5363,13 +5257,13 @@ var _WebGLDevice = class extends import_core29.Device {
5363
5257
  return readPixelsToBuffer(source, options);
5364
5258
  }
5365
5259
  setParametersWebGL(parameters) {
5366
- setGLParameters(this, parameters);
5260
+ setGLParameters(this.gl, parameters);
5367
5261
  }
5368
5262
  getParametersWebGL(parameters) {
5369
- return getGLParameters(this, parameters);
5263
+ return getGLParameters(this.gl, parameters);
5370
5264
  }
5371
5265
  withParametersWebGL(parameters, func) {
5372
- withGLParameters(this, parameters, func);
5266
+ withGLParameters(this.gl, parameters, func);
5373
5267
  }
5374
5268
  clearWebGL(options) {
5375
5269
  clear(this, options);
@@ -5449,7 +5343,7 @@ var _WebGLDevice = class extends import_core29.Device {
5449
5343
  this._constants = this._constants || new Array(maxVertexAttributes).fill(null);
5450
5344
  const currentConstant = this._constants[location];
5451
5345
  if (currentConstant && compareConstantArrayValues2(currentConstant, constant)) {
5452
- import_core29.log.info(1, `setConstantAttributeWebGL(${location}) could have been skipped, value unchanged`)();
5346
+ import_core27.log.info(1, `setConstantAttributeWebGL(${location}) could have been skipped, value unchanged`)();
5453
5347
  }
5454
5348
  this._constants[location] = constant;
5455
5349
  switch (constant.constructor) {
@@ -5463,7 +5357,7 @@ var _WebGLDevice = class extends import_core29.Device {
5463
5357
  setConstantUintArray(this, location, constant);
5464
5358
  break;
5465
5359
  default:
5466
- (0, import_core29.assert)(false);
5360
+ (0, import_core27.assert)(false);
5467
5361
  }
5468
5362
  }
5469
5363
  /** Ensure extensions are only requested once */
@@ -5476,6 +5370,7 @@ var WebGLDevice = _WebGLDevice;
5476
5370
  //
5477
5371
  // Public `Device` API
5478
5372
  //
5373
+ /** type of this device */
5479
5374
  __publicField(WebGLDevice, "type", "webgl");
5480
5375
  function isWebGL(gl) {
5481
5376
  if (typeof WebGL2RenderingContext !== "undefined" && gl instanceof WebGL2RenderingContext) {
@@ -5498,7 +5393,7 @@ function setConstantFloatArray(device, location, array) {
5498
5393
  device.gl.vertexAttrib4fv(location, array);
5499
5394
  break;
5500
5395
  default:
5501
- (0, import_core29.assert)(false);
5396
+ (0, import_core27.assert)(false);
5502
5397
  }
5503
5398
  }
5504
5399
  function setConstantIntArray(device, location, array) {
@@ -5518,4 +5413,174 @@ function compareConstantArrayValues2(v1, v2) {
5518
5413
  }
5519
5414
  return true;
5520
5415
  }
5416
+
5417
+ // dist/adapter/objects/webgl-resource.js
5418
+ var import_core28 = require("@luma.gl/core");
5419
+ var ERR_RESOURCE_METHOD_UNDEFINED = "Resource subclass must define virtual methods";
5420
+ var WebGLResource = class extends import_core28.Resource {
5421
+ device;
5422
+ gl;
5423
+ gl2;
5424
+ _handle;
5425
+ _bound = false;
5426
+ // Only meaningful for resources that allocate GPU memory
5427
+ byteLength = 0;
5428
+ constructor(device, props, defaultProps) {
5429
+ super(device, props, defaultProps);
5430
+ this.device = device;
5431
+ const gl = this.device.gl;
5432
+ const { id } = props || {};
5433
+ this.gl = gl;
5434
+ this.gl2 = gl;
5435
+ this.id = id || (0, import_core28.uid)(this.constructor.name);
5436
+ this._handle = props == null ? void 0 : props.handle;
5437
+ if (this._handle === void 0) {
5438
+ this._handle = this._createHandle();
5439
+ }
5440
+ this.byteLength = 0;
5441
+ }
5442
+ toString() {
5443
+ return `${this.constructor.name}(${this.id})`;
5444
+ }
5445
+ get handle() {
5446
+ return this._handle;
5447
+ }
5448
+ delete({ deleteChildren = false } = {}) {
5449
+ const children = this._handle && this._deleteHandle(this._handle);
5450
+ if (this._handle) {
5451
+ this.removeStats();
5452
+ }
5453
+ this._handle = null;
5454
+ if (children && deleteChildren) {
5455
+ children.filter(Boolean).forEach((child) => child.destroy());
5456
+ }
5457
+ return this;
5458
+ }
5459
+ bind(funcOrHandle = this.handle) {
5460
+ if (typeof funcOrHandle !== "function") {
5461
+ this._bindHandle(funcOrHandle);
5462
+ return this;
5463
+ }
5464
+ let value;
5465
+ if (!this._bound) {
5466
+ this._bindHandle(this.handle);
5467
+ this._bound = true;
5468
+ value = funcOrHandle();
5469
+ this._bound = false;
5470
+ this._bindHandle(null);
5471
+ } else {
5472
+ value = funcOrHandle();
5473
+ }
5474
+ return value;
5475
+ }
5476
+ unbind() {
5477
+ this.bind(null);
5478
+ }
5479
+ // Install stubs for removed methods
5480
+ stubRemovedMethods(className, version, methodNames) {
5481
+ return (0, import_core28.stubRemovedMethods)(this, className, version, methodNames);
5482
+ }
5483
+ // PUBLIC VIRTUAL METHODS
5484
+ initialize(props) {
5485
+ }
5486
+ // PROTECTED METHODS - These must be overridden by subclass
5487
+ _createHandle() {
5488
+ throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
5489
+ }
5490
+ _deleteHandle() {
5491
+ throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
5492
+ }
5493
+ _bindHandle(handle) {
5494
+ throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
5495
+ }
5496
+ _getOptsFromHandle() {
5497
+ throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
5498
+ }
5499
+ _getParameter(pname, props) {
5500
+ throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
5501
+ }
5502
+ _setParameter(pname, value) {
5503
+ throw new Error(ERR_RESOURCE_METHOD_UNDEFINED);
5504
+ }
5505
+ };
5506
+
5507
+ // dist/adapter/objects/webgl-renderbuffer.js
5508
+ var import_core29 = require("@luma.gl/core");
5509
+ var import_constants28 = require("@luma.gl/constants");
5510
+ var _WEBGLRenderbuffer = class extends WebGLResource {
5511
+ get [Symbol.toStringTag]() {
5512
+ return "Renderbuffer";
5513
+ }
5514
+ get width() {
5515
+ return this.props.width;
5516
+ }
5517
+ get height() {
5518
+ return this.props.height;
5519
+ }
5520
+ get format() {
5521
+ return this.props.format;
5522
+ }
5523
+ get samples() {
5524
+ return this.props.samples;
5525
+ }
5526
+ get attachment() {
5527
+ return;
5528
+ }
5529
+ /** WebGL format constant */
5530
+ glFormat;
5531
+ static isTextureFormatSupported(device, format) {
5532
+ return isRenderbufferFormatSupported(device.gl, format, device._extensions);
5533
+ }
5534
+ constructor(device, props) {
5535
+ if (typeof props.format === "number") {
5536
+ throw new Error("Renderbuffer");
5537
+ }
5538
+ super(device, props, _WEBGLRenderbuffer.defaultProps);
5539
+ this.glFormat = convertTextureFormatToGL(this.props.format);
5540
+ this._initialize(this.props);
5541
+ }
5542
+ resize(size) {
5543
+ if (size.width !== this.width || size.height !== this.height) {
5544
+ Object.assign(this.props, { ...size, format: this.format, samples: this.samples });
5545
+ this._initialize(this.props);
5546
+ }
5547
+ }
5548
+ // PRIVATE METHODS
5549
+ /** Creates and initializes a renderbuffer object's data store */
5550
+ _initialize(props) {
5551
+ const { format, width, height, samples } = props;
5552
+ (0, import_core29.assert)(format, "Needs format");
5553
+ this.trackDeallocatedMemory();
5554
+ this.gl.bindRenderbuffer(36161, this.handle);
5555
+ if (samples !== 0) {
5556
+ this.gl.renderbufferStorageMultisample(36161, samples, this.glFormat, width, height);
5557
+ } else {
5558
+ this.gl.renderbufferStorage(36161, this.glFormat, width, height);
5559
+ }
5560
+ this.gl.bindRenderbuffer(36161, null);
5561
+ this.trackAllocatedMemory(width * height * (samples || 1) * getTextureFormatBytesPerPixel(this.format));
5562
+ }
5563
+ // RESOURCE IMPLEMENTATION
5564
+ _createHandle() {
5565
+ return this.gl.createRenderbuffer();
5566
+ }
5567
+ _deleteHandle() {
5568
+ this.gl.deleteRenderbuffer(this.handle);
5569
+ this.trackDeallocatedMemory();
5570
+ }
5571
+ _bindHandle(handle) {
5572
+ this.gl.bindRenderbuffer(36161, handle);
5573
+ }
5574
+ };
5575
+ var WEBGLRenderbuffer = _WEBGLRenderbuffer;
5576
+ __publicField(WEBGLRenderbuffer, "defaultProps", {
5577
+ id: void 0,
5578
+ handle: void 0,
5579
+ userData: void 0,
5580
+ format: void 0,
5581
+ // 'depth16unorm'
5582
+ width: 1,
5583
+ height: 1,
5584
+ samples: 0
5585
+ });
5521
5586
  //# sourceMappingURL=index.cjs.map