@deck.gl/arcgis 9.3.0-alpha.3 → 9.3.0-alpha.5

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.
package/dist/dist.dev.js CHANGED
@@ -48,10 +48,10 @@ var __exports__ = (() => {
48
48
  }
49
49
  });
50
50
 
51
- // ../../node_modules/@luma.gl/constants/dist/webgl-constants.js
51
+ // ../../node_modules/@luma.gl/webgl/dist/constants/webgl-constants.js
52
52
  var GLEnum;
53
53
  var init_webgl_constants = __esm({
54
- "../../node_modules/@luma.gl/constants/dist/webgl-constants.js"() {
54
+ "../../node_modules/@luma.gl/webgl/dist/constants/webgl-constants.js"() {
55
55
  (function(GLEnum2) {
56
56
  GLEnum2[GLEnum2["DEPTH_BUFFER_BIT"] = 256] = "DEPTH_BUFFER_BIT";
57
57
  GLEnum2[GLEnum2["STENCIL_BUFFER_BIT"] = 1024] = "STENCIL_BUFFER_BIT";
@@ -703,9 +703,9 @@ var __exports__ = (() => {
703
703
  }
704
704
  });
705
705
 
706
- // ../../node_modules/@luma.gl/constants/dist/index.js
707
- var init_dist = __esm({
708
- "../../node_modules/@luma.gl/constants/dist/index.js"() {
706
+ // ../../node_modules/@luma.gl/webgl/dist/constants/index.js
707
+ var init_constants = __esm({
708
+ "../../node_modules/@luma.gl/webgl/dist/constants/index.js"() {
709
709
  init_webgl_constants();
710
710
  }
711
711
  });
@@ -875,7 +875,7 @@ var __exports__ = (() => {
875
875
  });
876
876
 
877
877
  // ../../node_modules/@probe.gl/env/dist/index.js
878
- var init_dist2 = __esm({
878
+ var init_dist = __esm({
879
879
  "../../node_modules/@probe.gl/env/dist/index.js"() {
880
880
  init_get_browser();
881
881
  }
@@ -952,7 +952,7 @@ var __exports__ = (() => {
952
952
  var init_webgl_developer_tools = __esm({
953
953
  "../../node_modules/@luma.gl/webgl/dist/context/debug/webgl-developer-tools.js"() {
954
954
  import_core3 = __toESM(require_core2(), 1);
955
- init_dist();
955
+ init_constants();
956
956
  }
957
957
  });
958
958
 
@@ -2477,6 +2477,15 @@ var __exports__ = (() => {
2477
2477
  }
2478
2478
  gl.bindTexture(texture.glTarget, null);
2479
2479
  }
2480
+ /** Default framebuffer resize is managed by canvas size and should be a no-op. */
2481
+ resizeAttachments(width, height) {
2482
+ if (this.handle === null) {
2483
+ this.width = width;
2484
+ this.height = height;
2485
+ return;
2486
+ }
2487
+ super.resizeAttachments(width, height);
2488
+ }
2480
2489
  };
2481
2490
  }
2482
2491
  });
@@ -2829,7 +2838,12 @@ var __exports__ = (() => {
2829
2838
  throw new Error(this.props.stage);
2830
2839
  }
2831
2840
  device._setWebGLDebugMetadata(this.handle, this, { spector: this.props });
2832
- this._compile(this.source);
2841
+ const compilationStatus = this._compile(this.source);
2842
+ if (compilationStatus && typeof compilationStatus.catch === "function") {
2843
+ compilationStatus.catch(() => {
2844
+ this.compilationStatus = "error";
2845
+ });
2846
+ }
2833
2847
  }
2834
2848
  destroy() {
2835
2849
  if (this.handle) {
@@ -2860,7 +2874,7 @@ var __exports__ = (() => {
2860
2874
  }
2861
2875
  // PRIVATE METHODS
2862
2876
  /** Compile a shader and get compilation status */
2863
- async _compile(source) {
2877
+ _compile(source) {
2864
2878
  source = source.startsWith("#version ") ? source : `#version 300 es
2865
2879
  ${source}`;
2866
2880
  const { gl } = this.device;
@@ -2879,10 +2893,11 @@ ${source}`;
2879
2893
  return;
2880
2894
  }
2881
2895
  import_core11.log.once(1, "Shader compilation is asynchronous")();
2882
- await this._waitForCompilationComplete();
2883
- import_core11.log.info(2, `Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)();
2884
- this._getCompilationStatus();
2885
- this.debugShader();
2896
+ return this._waitForCompilationComplete().then(() => {
2897
+ import_core11.log.info(2, `Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)();
2898
+ this._getCompilationStatus();
2899
+ this.debugShader();
2900
+ });
2886
2901
  }
2887
2902
  /** Use KHR_parallel_shader_compile extension if available */
2888
2903
  async _waitForCompilationComplete() {
@@ -3022,6 +3037,9 @@ ${source}`;
3022
3037
  parameters.depthCompare !== "always" ? gl.enable(2929) : gl.disable(2929);
3023
3038
  gl.depthFunc(convertCompareFunction("depthCompare", parameters.depthCompare));
3024
3039
  }
3040
+ if (parameters.clearDepth !== void 0) {
3041
+ gl.clearDepth(parameters.clearDepth);
3042
+ }
3025
3043
  if (parameters.stencilWriteMask) {
3026
3044
  const mask = parameters.stencilWriteMask;
3027
3045
  gl.stencilMaskSeparate(1028, mask);
@@ -3395,7 +3413,7 @@ ${source}`;
3395
3413
  function getWebGLCubeFaceTarget(glTarget, dimension, level) {
3396
3414
  return dimension === "cube" ? 34069 + level : glTarget;
3397
3415
  }
3398
- var import_core15, import_core16, WEBGLTexture;
3416
+ var import_core15, WEBGLTexture;
3399
3417
  var init_webgl_texture = __esm({
3400
3418
  "../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-texture.js"() {
3401
3419
  import_core15 = __toESM(require_core2(), 1);
@@ -3404,7 +3422,6 @@ ${source}`;
3404
3422
  init_with_parameters();
3405
3423
  init_webgl_texture_view();
3406
3424
  init_shader_formats();
3407
- import_core16 = __toESM(require_core2(), 1);
3408
3425
  WEBGLTexture = class extends import_core15.Texture {
3409
3426
  // readonly MAX_ATTRIBUTES: number;
3410
3427
  device;
@@ -3536,31 +3553,28 @@ ${source}`;
3536
3553
  * before any WebGL calls are issued.
3537
3554
  */
3538
3555
  readBuffer(options = {}, buffer) {
3556
+ if (!buffer) {
3557
+ throw new Error(`${this} readBuffer requires a destination buffer`);
3558
+ }
3539
3559
  const normalizedOptions = this._getSupportedColorReadOptions(options);
3560
+ const byteOffset = options.byteOffset ?? 0;
3540
3561
  const memoryLayout = this.computeMemoryLayout(normalizedOptions);
3541
- const readBuffer = buffer || this.device.createBuffer({
3542
- byteLength: memoryLayout.byteLength,
3543
- usage: import_core15.Buffer.COPY_DST | import_core15.Buffer.MAP_READ
3544
- });
3545
- if (readBuffer.byteLength < memoryLayout.byteLength) {
3546
- throw new Error(`${this} readBuffer target is too small (${readBuffer.byteLength} < ${memoryLayout.byteLength})`);
3562
+ if (buffer.byteLength < byteOffset + memoryLayout.byteLength) {
3563
+ throw new Error(`${this} readBuffer target is too small (${buffer.byteLength} < ${byteOffset + memoryLayout.byteLength})`);
3547
3564
  }
3548
- const webglBuffer = readBuffer;
3565
+ const webglBuffer = buffer;
3549
3566
  this.gl.bindBuffer(35051, webglBuffer.handle);
3550
3567
  try {
3551
3568
  this._readColorTextureLayers(normalizedOptions, memoryLayout, (destinationByteOffset) => {
3552
- this.gl.readPixels(normalizedOptions.x, normalizedOptions.y, normalizedOptions.width, normalizedOptions.height, this.glFormat, this.glType, destinationByteOffset);
3569
+ this.gl.readPixels(normalizedOptions.x, normalizedOptions.y, normalizedOptions.width, normalizedOptions.height, this.glFormat, this.glType, byteOffset + destinationByteOffset);
3553
3570
  });
3554
3571
  } finally {
3555
3572
  this.gl.bindBuffer(35051, null);
3556
3573
  }
3557
- return readBuffer;
3574
+ return buffer;
3558
3575
  }
3559
3576
  async readDataAsync(options = {}) {
3560
- const buffer = this.readBuffer(options);
3561
- const data = await buffer.readAsync();
3562
- buffer.destroy();
3563
- return data.buffer;
3577
+ throw new Error(`${this} readDataAsync is deprecated; use readBuffer() with an explicit destination buffer or DynamicTexture.readAsync()`);
3564
3578
  }
3565
3579
  writeBuffer(buffer, options_ = {}) {
3566
3580
  const options = this._normalizeTextureWriteOptions(options_);
@@ -3673,7 +3687,7 @@ ${source}`;
3673
3687
  const options = this._getSupportedColorReadOptions(options_);
3674
3688
  const memoryLayout = this.computeMemoryLayout(options);
3675
3689
  const shaderType = convertGLDataTypeToDataType(this.glType);
3676
- const ArrayType = (0, import_core16.getTypedArrayConstructor)(shaderType);
3690
+ const ArrayType = (0, import_core15.getTypedArrayConstructor)(shaderType);
3677
3691
  const targetArray = new ArrayType(memoryLayout.byteLength / ArrayType.BYTES_PER_ELEMENT);
3678
3692
  this._readColorTextureLayers(options, memoryLayout, (destinationByteOffset) => {
3679
3693
  const layerView = new ArrayType(targetArray.buffer, targetArray.byteOffset + destinationByteOffset, memoryLayout.bytesPerImage / ArrayType.BYTES_PER_ELEMENT);
@@ -3952,23 +3966,38 @@ ${source}`;
3952
3966
  function mergeShaderLayout(baseLayout, overrideLayout) {
3953
3967
  const mergedLayout = {
3954
3968
  ...baseLayout,
3955
- attributes: baseLayout.attributes.map((attribute) => ({ ...attribute }))
3969
+ attributes: baseLayout.attributes.map((attribute) => ({ ...attribute })),
3970
+ bindings: baseLayout.bindings.map((binding) => ({ ...binding }))
3956
3971
  };
3957
3972
  for (const attribute of overrideLayout?.attributes || []) {
3958
3973
  const baseAttribute = mergedLayout.attributes.find((attr) => attr.name === attribute.name);
3959
3974
  if (!baseAttribute) {
3960
- import_core17.log.warn(`shader layout attribute ${attribute.name} not present in shader`);
3975
+ import_core16.log.warn(`shader layout attribute ${attribute.name} not present in shader`);
3961
3976
  } else {
3962
3977
  baseAttribute.type = attribute.type || baseAttribute.type;
3963
3978
  baseAttribute.stepMode = attribute.stepMode || baseAttribute.stepMode;
3964
3979
  }
3965
3980
  }
3981
+ for (const binding of overrideLayout?.bindings || []) {
3982
+ const baseBinding = getShaderLayoutBindingByName(mergedLayout, binding.name);
3983
+ if (!baseBinding) {
3984
+ import_core16.log.warn(`shader layout binding ${binding.name} not present in shader`);
3985
+ continue;
3986
+ }
3987
+ Object.assign(baseBinding, binding);
3988
+ }
3966
3989
  return mergedLayout;
3967
3990
  }
3968
- var import_core17, WEBGLRenderPipeline;
3991
+ function getShaderLayoutBindingByName(shaderLayout, bindingName) {
3992
+ return shaderLayout.bindings.find((binding) => binding.name === bindingName || binding.name === `${bindingName}Uniforms` || `${binding.name}Uniforms` === bindingName);
3993
+ }
3994
+ function getBindingValueForLayoutBinding(bindings, bindingName) {
3995
+ return bindings[bindingName] || bindings[`${bindingName}Uniforms`] || bindings[bindingName.replace(/Uniforms$/, "")];
3996
+ }
3997
+ var import_core16, WEBGLRenderPipeline;
3969
3998
  var init_webgl_render_pipeline = __esm({
3970
3999
  "../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-render-pipeline.js"() {
3971
- import_core17 = __toESM(require_core2(), 1);
4000
+ import_core16 = __toESM(require_core2(), 1);
3972
4001
  init_device_parameters();
3973
4002
  init_set_uniform();
3974
4003
  init_webgl_buffer();
@@ -3976,7 +4005,7 @@ ${source}`;
3976
4005
  init_webgl_texture();
3977
4006
  init_webgl_texture_view();
3978
4007
  init_webgl_topology_utils();
3979
- WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
4008
+ WEBGLRenderPipeline = class extends import_core16.RenderPipeline {
3980
4009
  /** The WebGL device that created this render pipeline */
3981
4010
  device;
3982
4011
  /** Handle to underlying WebGL program */
@@ -4026,17 +4055,18 @@ ${source}`;
4026
4055
  * Shared-model draws pass bindings per draw and do not rely on this state.
4027
4056
  */
4028
4057
  setBindings(bindings, options) {
4029
- for (const [name, value] of Object.entries(bindings)) {
4030
- const binding = this.shaderLayout.bindings.find((binding_) => binding_.name === name) || this.shaderLayout.bindings.find((binding_) => binding_.name === `${name}Uniforms`);
4058
+ const flatBindings = (0, import_core16.flattenBindingsByGroup)((0, import_core16.normalizeBindingsByGroup)(this.shaderLayout, bindings));
4059
+ for (const [name, value] of Object.entries(flatBindings)) {
4060
+ const binding = getShaderLayoutBindingByName(this.shaderLayout, name);
4031
4061
  if (!binding) {
4032
4062
  const validBindings = this.shaderLayout.bindings.map((binding_) => `"${binding_.name}"`).join(", ");
4033
4063
  if (!options?.disableWarnings) {
4034
- import_core17.log.warn(`No binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`, value)();
4064
+ import_core16.log.warn(`No binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`, value)();
4035
4065
  }
4036
4066
  continue;
4037
4067
  }
4038
4068
  if (!value) {
4039
- import_core17.log.warn(`Unsetting binding "${name}" in render pipeline "${this.id}"`)();
4069
+ import_core16.log.warn(`Unsetting binding "${name}" in render pipeline "${this.id}"`)();
4040
4070
  }
4041
4071
  switch (binding.type) {
4042
4072
  case "uniform":
@@ -4050,7 +4080,7 @@ ${source}`;
4050
4080
  }
4051
4081
  break;
4052
4082
  case "sampler":
4053
- import_core17.log.warn(`Ignoring sampler ${name}`)();
4083
+ import_core16.log.warn(`Ignoring sampler ${name}`)();
4054
4084
  break;
4055
4085
  default:
4056
4086
  throw new Error(binding.type);
@@ -4064,6 +4094,7 @@ ${source}`;
4064
4094
  */
4065
4095
  draw(options) {
4066
4096
  this._syncLinkStatus();
4097
+ const drawBindings = options.bindGroups ? (0, import_core16.flattenBindingsByGroup)(options.bindGroups) : options.bindings || this.bindings;
4067
4098
  const {
4068
4099
  renderPass,
4069
4100
  parameters = this.props.parameters,
@@ -4078,18 +4109,17 @@ ${source}`;
4078
4109
  // firstInstance,
4079
4110
  // baseVertex,
4080
4111
  transformFeedback,
4081
- bindings = this.bindings,
4082
4112
  uniforms = this.uniforms
4083
4113
  } = options;
4084
4114
  const glDrawMode = getGLDrawMode(topology);
4085
4115
  const isIndexed = Boolean(vertexArray.indexBuffer);
4086
4116
  const glIndexType = vertexArray.indexBuffer?.glIndexType;
4087
4117
  if (this.linkStatus !== "success") {
4088
- import_core17.log.info(2, `RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)();
4118
+ import_core16.log.info(2, `RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)();
4089
4119
  return false;
4090
4120
  }
4091
- if (!this._areTexturesRenderable(bindings)) {
4092
- import_core17.log.info(2, `RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)();
4121
+ if (!this._areTexturesRenderable(drawBindings)) {
4122
+ import_core16.log.info(2, `RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)();
4093
4123
  return false;
4094
4124
  }
4095
4125
  this.device.gl.useProgram(this.handle);
@@ -4097,7 +4127,7 @@ ${source}`;
4097
4127
  if (transformFeedback) {
4098
4128
  transformFeedback.begin(this.props.topology);
4099
4129
  }
4100
- this._applyBindings(bindings, { disableWarnings: this.props.disableWarnings });
4130
+ this._applyBindings(drawBindings, { disableWarnings: this.props.disableWarnings });
4101
4131
  this._applyUniforms(uniforms);
4102
4132
  const webglRenderPass = renderPass;
4103
4133
  withDeviceAndGLParameters(this.device, parameters, webglRenderPass.glParameters, () => {
@@ -4132,8 +4162,8 @@ ${source}`;
4132
4162
  _areTexturesRenderable(bindings) {
4133
4163
  let texturesRenderable = true;
4134
4164
  for (const bindingInfo of this.shaderLayout.bindings) {
4135
- if (!bindings[bindingInfo.name] && !bindings[bindingInfo.name.replace(/Uniforms$/, "")]) {
4136
- import_core17.log.warn(`Binding ${bindingInfo.name} not found in ${this.id}`)();
4165
+ if (!getBindingValueForLayoutBinding(bindings, bindingInfo.name)) {
4166
+ import_core16.log.warn(`Binding ${bindingInfo.name} not found in ${this.id}`)();
4137
4167
  texturesRenderable = false;
4138
4168
  }
4139
4169
  }
@@ -4150,7 +4180,7 @@ ${source}`;
4150
4180
  let textureUnit = 0;
4151
4181
  let uniformBufferIndex = 0;
4152
4182
  for (const binding of this.shaderLayout.bindings) {
4153
- const value = bindings[binding.name] || bindings[binding.name.replace(/Uniforms$/, "")];
4183
+ const value = getBindingValueForLayoutBinding(bindings, binding.name);
4154
4184
  if (!value) {
4155
4185
  throw new Error(`No value for binding ${binding.name} in ${this.id}`);
4156
4186
  }
@@ -4165,16 +4195,8 @@ ${source}`;
4165
4195
  if (value instanceof WEBGLBuffer) {
4166
4196
  gl.bindBufferBase(35345, uniformBufferIndex, value.handle);
4167
4197
  } else {
4168
- gl.bindBufferRange(
4169
- 35345,
4170
- uniformBufferIndex,
4171
- // @ts-expect-error
4172
- value.buffer.handle,
4173
- // @ts-expect-error
4174
- value.offset || 0,
4175
- // @ts-expect-error
4176
- value.size || value.buffer.byteLength - value.offset
4177
- );
4198
+ const bufferBinding = value;
4199
+ gl.bindBufferRange(35345, uniformBufferIndex, bufferBinding.buffer.handle, bufferBinding.offset || 0, bufferBinding.size || bufferBinding.buffer.byteLength - (bufferBinding.offset || 0));
4178
4200
  }
4179
4201
  uniformBufferIndex += 1;
4180
4202
  break;
@@ -4188,7 +4210,7 @@ ${source}`;
4188
4210
  } else if (value instanceof WEBGLTexture) {
4189
4211
  texture = value;
4190
4212
  } else if (value instanceof WEBGLFramebuffer && value.colorAttachments[0] instanceof WEBGLTextureView) {
4191
- import_core17.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")();
4213
+ import_core16.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")();
4192
4214
  texture = value.colorAttachments[0].texture;
4193
4215
  } else {
4194
4216
  throw new Error("No texture");
@@ -4397,7 +4419,7 @@ ${source}`;
4397
4419
  }
4398
4420
  const { name, type: glUniformType, size } = activeInfo;
4399
4421
  const uniformType = convertGLUniformTypeToShaderVariableType(glUniformType);
4400
- const { type, components } = (0, import_core18.getVariableShaderTypeInfo)(uniformType);
4422
+ const { type, components } = (0, import_core17.getVariableShaderTypeInfo)(uniformType);
4401
4423
  varyings.push({ location, name, type, size: size * components });
4402
4424
  }
4403
4425
  varyings.sort((a, b) => a.location - b.location);
@@ -4477,6 +4499,12 @@ ${source}`;
4477
4499
  });
4478
4500
  }
4479
4501
  }
4502
+ const uniformInstancePrefixes = new Set(blockInfo.uniforms.map((uniform) => uniform.name.split(".")[0]).filter((instanceName) => Boolean(instanceName)));
4503
+ const blockAlias = blockInfo.name.replace(/Uniforms$/, "");
4504
+ if (uniformInstancePrefixes.size === 1 && !uniformInstancePrefixes.has(blockInfo.name) && !uniformInstancePrefixes.has(blockAlias)) {
4505
+ const [instanceName] = uniformInstancePrefixes;
4506
+ import_core17.log.warn(`Uniform block "${blockInfo.name}" uses GLSL instance "${instanceName}". luma.gl binds uniform buffers by block name ("${blockInfo.name}") and alias ("${blockAlias}"). Prefer matching the instance name to one of those to avoid confusing silent mismatches.`)();
4507
+ }
4480
4508
  uniformBlocks.push(blockInfo);
4481
4509
  }
4482
4510
  uniformBlocks.sort((a, b) => a.location - b.location);
@@ -4492,7 +4520,7 @@ ${source}`;
4492
4520
  }
4493
4521
  const UNIFORM_NAME_REGEXP = /([^[]*)(\[[0-9]+\])?/;
4494
4522
  const matches = UNIFORM_NAME_REGEXP.exec(name);
4495
- const uniformName = (0, import_core18.assertDefined)(matches?.[1], `Failed to parse GLSL uniform name ${name}`);
4523
+ const uniformName = (0, import_core17.assertDefined)(matches?.[1], `Failed to parse GLSL uniform name ${name}`);
4496
4524
  return {
4497
4525
  name: uniformName,
4498
4526
  // TODO - is this a bug, shouldn't we return the value?
@@ -4500,23 +4528,23 @@ ${source}`;
4500
4528
  isArray: Boolean(matches?.[2])
4501
4529
  };
4502
4530
  }
4503
- var import_core18;
4531
+ var import_core17;
4504
4532
  var init_get_shader_layout_from_glsl = __esm({
4505
4533
  "../../node_modules/@luma.gl/webgl/dist/adapter/helpers/get-shader-layout-from-glsl.js"() {
4506
- import_core18 = __toESM(require_core2(), 1);
4534
+ import_core17 = __toESM(require_core2(), 1);
4507
4535
  init_webgl_shadertypes();
4508
4536
  }
4509
4537
  });
4510
4538
 
4511
4539
  // ../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-shared-render-pipeline.js
4512
- var import_core19, LOG_PROGRAM_PERF_PRIORITY, WEBGLSharedRenderPipeline;
4540
+ var import_core18, LOG_PROGRAM_PERF_PRIORITY, WEBGLSharedRenderPipeline;
4513
4541
  var init_webgl_shared_render_pipeline = __esm({
4514
4542
  "../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-shared-render-pipeline.js"() {
4515
- import_core19 = __toESM(require_core2(), 1);
4543
+ import_core18 = __toESM(require_core2(), 1);
4516
4544
  init_get_shader_layout_from_glsl();
4517
4545
  init_webgl_shadertypes();
4518
4546
  LOG_PROGRAM_PERF_PRIORITY = 4;
4519
- WEBGLSharedRenderPipeline = class extends import_core19.SharedRenderPipeline {
4547
+ WEBGLSharedRenderPipeline = class extends import_core18.SharedRenderPipeline {
4520
4548
  device;
4521
4549
  handle;
4522
4550
  vs;
@@ -4533,9 +4561,9 @@ ${source}`;
4533
4561
  this.device.gl.transformFeedbackVaryings(this.handle, props.varyings, props.bufferMode || 35981);
4534
4562
  }
4535
4563
  this._linkShaders();
4536
- import_core19.log.time(3, `RenderPipeline ${this.id} - shaderLayout introspection`)();
4564
+ import_core18.log.time(3, `RenderPipeline ${this.id} - shaderLayout introspection`)();
4537
4565
  this.introspectedLayout = getShaderLayoutFromGLSL(this.device.gl, this.handle);
4538
- import_core19.log.timeEnd(3, `RenderPipeline ${this.id} - shaderLayout introspection`)();
4566
+ import_core18.log.timeEnd(3, `RenderPipeline ${this.id} - shaderLayout introspection`)();
4539
4567
  }
4540
4568
  destroy() {
4541
4569
  if (this.destroyed) {
@@ -4550,17 +4578,17 @@ ${source}`;
4550
4578
  const { gl } = this.device;
4551
4579
  gl.attachShader(this.handle, this.vs.handle);
4552
4580
  gl.attachShader(this.handle, this.fs.handle);
4553
- import_core19.log.time(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
4581
+ import_core18.log.time(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
4554
4582
  gl.linkProgram(this.handle);
4555
- import_core19.log.timeEnd(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
4583
+ import_core18.log.timeEnd(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();
4556
4584
  if (!this.device.features.has("compilation-status-async-webgl")) {
4557
4585
  const status2 = this._getLinkStatus();
4558
4586
  this._reportLinkStatus(status2);
4559
4587
  return;
4560
4588
  }
4561
- import_core19.log.once(1, "RenderPipeline linking is asynchronous")();
4589
+ import_core18.log.once(1, "RenderPipeline linking is asynchronous")();
4562
4590
  await this._waitForLinkComplete();
4563
- import_core19.log.info(2, `RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();
4591
+ import_core18.log.info(2, `RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();
4564
4592
  const status = this._getLinkStatus();
4565
4593
  this._reportLinkStatus(status);
4566
4594
  }
@@ -4671,44 +4699,29 @@ ${source}`;
4671
4699
  device.gl.bindBuffer(36662, null);
4672
4700
  device.gl.bindBuffer(36663, null);
4673
4701
  }
4674
- function _copyBufferToTexture(device, options) {
4675
- throw new Error("Not implemented");
4702
+ function _copyBufferToTexture(_device, _options) {
4703
+ throw new Error("copyBufferToTexture is not supported in WebGL");
4676
4704
  }
4677
4705
  function _copyTextureToBuffer(device, options) {
4678
- const {
4679
- /** Texture to copy to/from. */
4680
- sourceTexture,
4681
- /** Mip-map level of the texture to copy to/from. (Default 0) */
4682
- mipLevel = 0,
4683
- /** Defines which aspects of the texture to copy to/from. */
4684
- aspect = "all",
4685
- /** Width to copy */
4686
- width = options.sourceTexture.width,
4687
- /** Height to copy */
4688
- height = options.sourceTexture.height,
4689
- depthOrArrayLayers = 0,
4690
- /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */
4691
- origin = [0, 0, 0],
4692
- /** Destination buffer */
4693
- destinationBuffer,
4694
- /** Offset, in bytes, from the beginning of the buffer to the start of the image data (default 0) */
4695
- byteOffset = 0,
4696
- /**
4697
- * The stride, in bytes, between the beginning of each block row and the subsequent block row.
4698
- * Required if there are multiple block rows (i.e. the copy height or depth is more than one block).
4699
- */
4700
- bytesPerRow,
4701
- /**
4702
- * Number of block rows per single image of the texture.
4703
- * rowsPerImage &times; bytesPerRow is the stride, in bytes, between the beginning of each image of data and the subsequent image.
4704
- * Required if there are multiple images (i.e. the copy depth is more than one).
4705
- */
4706
- rowsPerImage
4707
- } = options;
4706
+ const { sourceTexture, mipLevel = 0, aspect = "all", width = options.sourceTexture.width, height = options.sourceTexture.height, depthOrArrayLayers, origin = [0, 0, 0], destinationBuffer, byteOffset = 0, bytesPerRow, rowsPerImage } = options;
4707
+ if (sourceTexture instanceof import_core19.Texture) {
4708
+ sourceTexture.readBuffer({
4709
+ x: origin[0] ?? 0,
4710
+ y: origin[1] ?? 0,
4711
+ z: origin[2] ?? 0,
4712
+ width,
4713
+ height,
4714
+ depthOrArrayLayers,
4715
+ mipLevel,
4716
+ aspect,
4717
+ byteOffset
4718
+ }, destinationBuffer);
4719
+ return;
4720
+ }
4708
4721
  if (aspect !== "all") {
4709
4722
  throw new Error("aspect not supported in WebGL");
4710
4723
  }
4711
- if (mipLevel !== 0 || depthOrArrayLayers !== 0 || bytesPerRow || rowsPerImage) {
4724
+ if (mipLevel !== 0 || depthOrArrayLayers !== void 0 || bytesPerRow || rowsPerImage) {
4712
4725
  throw new Error("not implemented");
4713
4726
  }
4714
4727
  const { framebuffer, destroyFramebuffer } = getFramebuffer(sourceTexture);
@@ -4717,7 +4730,7 @@ ${source}`;
4717
4730
  const webglBuffer = destinationBuffer;
4718
4731
  const sourceWidth = width || framebuffer.width;
4719
4732
  const sourceHeight = height || framebuffer.height;
4720
- const colorAttachment0 = (0, import_core20.assertDefined)(framebuffer.colorAttachments[0]);
4733
+ const colorAttachment0 = (0, import_core19.assertDefined)(framebuffer.colorAttachments[0]);
4721
4734
  const sourceParams = getTextureFormatWebGL(colorAttachment0.texture.props.format);
4722
4735
  const sourceFormat = sourceParams.format;
4723
4736
  const sourceType = sourceParams.type;
@@ -4795,7 +4808,7 @@ ${source}`;
4795
4808
  }
4796
4809
  }
4797
4810
  function getFramebuffer(source) {
4798
- if (source instanceof import_core20.Texture) {
4811
+ if (source instanceof import_core19.Texture) {
4799
4812
  const { width, height, id } = source;
4800
4813
  const framebuffer = source.device.createFramebuffer({
4801
4814
  id: `framebuffer-for-${id}`,
@@ -4807,13 +4820,13 @@ ${source}`;
4807
4820
  }
4808
4821
  return { framebuffer: source, destroyFramebuffer: false };
4809
4822
  }
4810
- var import_core20, WEBGLCommandBuffer;
4823
+ var import_core19, WEBGLCommandBuffer;
4811
4824
  var init_webgl_command_buffer = __esm({
4812
4825
  "../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-command-buffer.js"() {
4813
- import_core20 = __toESM(require_core2(), 1);
4814
- init_webgl_texture();
4826
+ import_core19 = __toESM(require_core2(), 1);
4815
4827
  init_webgl_texture_table();
4816
- WEBGLCommandBuffer = class extends import_core20.CommandBuffer {
4828
+ init_webgl_texture();
4829
+ WEBGLCommandBuffer = class extends import_core19.CommandBuffer {
4817
4830
  device;
4818
4831
  handle = null;
4819
4832
  commands = [];
@@ -4846,14 +4859,14 @@ ${source}`;
4846
4859
  });
4847
4860
 
4848
4861
  // ../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-render-pass.js
4849
- var import_core21, COLOR_CHANNELS, WEBGLRenderPass;
4862
+ var import_core20, COLOR_CHANNELS, WEBGLRenderPass;
4850
4863
  var init_webgl_render_pass = __esm({
4851
4864
  "../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-render-pass.js"() {
4852
- import_core21 = __toESM(require_core2(), 1);
4865
+ import_core20 = __toESM(require_core2(), 1);
4853
4866
  init_with_parameters();
4854
4867
  init_unified_parameter_api();
4855
4868
  COLOR_CHANNELS = [1, 2, 4, 8];
4856
- WEBGLRenderPass = class extends import_core21.RenderPass {
4869
+ WEBGLRenderPass = class extends import_core20.RenderPass {
4857
4870
  device;
4858
4871
  handle = null;
4859
4872
  /** Parameters that should be applied before each draw call */
@@ -4861,13 +4874,15 @@ ${source}`;
4861
4874
  constructor(device, props) {
4862
4875
  super(device, props);
4863
4876
  this.device = device;
4864
- if (!props?.framebuffer) {
4877
+ const webglFramebuffer = this.props.framebuffer;
4878
+ const isDefaultFramebuffer = !webglFramebuffer || webglFramebuffer.handle === null;
4879
+ if (isDefaultFramebuffer) {
4865
4880
  device.getDefaultCanvasContext()._resizeDrawingBufferIfNeeded();
4866
4881
  }
4867
4882
  let viewport;
4868
4883
  if (!props?.parameters?.viewport) {
4869
- if (props?.framebuffer) {
4870
- const { width, height } = props.framebuffer;
4884
+ if (!isDefaultFramebuffer) {
4885
+ const { width, height } = webglFramebuffer;
4871
4886
  viewport = [0, 0, width, height];
4872
4887
  } else {
4873
4888
  const [width, height] = device.getDefaultCanvasContext().getDrawingBufferSize();
@@ -4876,11 +4891,10 @@ ${source}`;
4876
4891
  }
4877
4892
  this.device.pushState();
4878
4893
  this.setParameters({ viewport, ...this.props.parameters });
4879
- const webglFramebuffer = this.props.framebuffer;
4880
- if (this.props.framebuffer && webglFramebuffer?.handle) {
4881
- const drawBuffers = this.props.framebuffer.colorAttachments.map((_, i) => 36064 + i);
4894
+ if (!isDefaultFramebuffer) {
4895
+ const drawBuffers = webglFramebuffer.colorAttachments.map((_, i) => 36064 + i);
4882
4896
  this.device.gl.drawBuffers(drawBuffers);
4883
- } else if (!this.props.framebuffer) {
4897
+ } else {
4884
4898
  this.device.gl.drawBuffers([1029]);
4885
4899
  }
4886
4900
  this.clear();
@@ -5018,13 +5032,13 @@ ${source}`;
5018
5032
  });
5019
5033
 
5020
5034
  // ../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-command-encoder.js
5021
- var import_core22, WEBGLCommandEncoder;
5035
+ var import_core21, WEBGLCommandEncoder;
5022
5036
  var init_webgl_command_encoder = __esm({
5023
5037
  "../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-command-encoder.js"() {
5024
- import_core22 = __toESM(require_core2(), 1);
5038
+ import_core21 = __toESM(require_core2(), 1);
5025
5039
  init_webgl_command_buffer();
5026
5040
  init_webgl_render_pass();
5027
- WEBGLCommandEncoder = class extends import_core22.CommandEncoder {
5041
+ WEBGLCommandEncoder = class extends import_core21.CommandEncoder {
5028
5042
  device;
5029
5043
  handle = null;
5030
5044
  commandBuffer;
@@ -5073,7 +5087,8 @@ ${source}`;
5073
5087
  }
5074
5088
  insertDebugMarker(markerLabel) {
5075
5089
  }
5076
- resolveQuerySet(querySet, destination, options) {
5090
+ resolveQuerySet(_querySet, _destination, _options) {
5091
+ throw new Error("resolveQuerySet is not supported in WebGL");
5077
5092
  }
5078
5093
  writeTimestamp(querySet, queryIndex) {
5079
5094
  const webglQuerySet = querySet;
@@ -5126,14 +5141,14 @@ ${source}`;
5126
5141
  }
5127
5142
  return true;
5128
5143
  }
5129
- var import_core23, WEBGLVertexArray;
5144
+ var import_core22, WEBGLVertexArray;
5130
5145
  var init_webgl_vertex_array = __esm({
5131
5146
  "../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-vertex-array.js"() {
5132
- import_core23 = __toESM(require_core2(), 1);
5133
- init_dist2();
5147
+ import_core22 = __toESM(require_core2(), 1);
5148
+ init_dist();
5134
5149
  init_webgl_vertex_formats();
5135
5150
  init_fill_array();
5136
- WEBGLVertexArray = class extends import_core23.VertexArray {
5151
+ WEBGLVertexArray = class extends import_core22.VertexArray {
5137
5152
  get [Symbol.toStringTag]() {
5138
5153
  return "VertexArray";
5139
5154
  }
@@ -5299,7 +5314,7 @@ ${source}`;
5299
5314
  this.buffer = this.buffer || this.device.createBuffer({ byteLength });
5300
5315
  updateNeeded ||= !compareConstantArrayValues(constantValue, this.bufferValue);
5301
5316
  if (updateNeeded) {
5302
- const typedArray = (0, import_core23.getScratchArray)(value.constructor, length);
5317
+ const typedArray = (0, import_core22.getScratchArray)(value.constructor, length);
5303
5318
  fillArray({ target: typedArray, source: constantValue, start: 0, count: length });
5304
5319
  this.buffer.write(typedArray);
5305
5320
  this.bufferValue = value;
@@ -5317,13 +5332,13 @@ ${source}`;
5317
5332
  }
5318
5333
  return /^\d+$/.test(value);
5319
5334
  }
5320
- var import_core24, WEBGLTransformFeedback;
5335
+ var import_core23, WEBGLTransformFeedback;
5321
5336
  var init_webgl_transform_feedback = __esm({
5322
5337
  "../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-transform-feedback.js"() {
5323
- import_core24 = __toESM(require_core2(), 1);
5324
- init_dist3();
5338
+ import_core23 = __toESM(require_core2(), 1);
5339
+ init_dist2();
5325
5340
  init_webgl_topology_utils();
5326
- WEBGLTransformFeedback = class extends import_core24.TransformFeedback {
5341
+ WEBGLTransformFeedback = class extends import_core23.TransformFeedback {
5327
5342
  device;
5328
5343
  gl;
5329
5344
  handle;
@@ -5386,7 +5401,7 @@ ${source}`;
5386
5401
  const { buffer, byteLength, byteOffset } = this._getBufferRange(bufferOrRange);
5387
5402
  if (location < 0) {
5388
5403
  this.unusedBuffers[locationOrName] = buffer;
5389
- import_core24.log.warn(`${this.id} unusedBuffers varying buffer ${locationOrName}`)();
5404
+ import_core23.log.warn(`${this.id} unusedBuffers varying buffer ${locationOrName}`)();
5390
5405
  return;
5391
5406
  }
5392
5407
  this.buffers[location] = { buffer, byteLength, byteOffset };
@@ -5469,14 +5484,15 @@ ${source}`;
5469
5484
  });
5470
5485
 
5471
5486
  // ../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-query-set.js
5472
- var import_core25, WEBGLQuerySet;
5487
+ var import_core24, WEBGLQuerySet;
5473
5488
  var init_webgl_query_set = __esm({
5474
5489
  "../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-query-set.js"() {
5475
- import_core25 = __toESM(require_core2(), 1);
5476
- WEBGLQuerySet = class extends import_core25.QuerySet {
5490
+ import_core24 = __toESM(require_core2(), 1);
5491
+ WEBGLQuerySet = class extends import_core24.QuerySet {
5477
5492
  device;
5478
5493
  handle;
5479
5494
  _timestampPairs = [];
5495
+ _pendingReads = /* @__PURE__ */ new Set();
5480
5496
  _occlusionQuery = null;
5481
5497
  _occlusionActive = false;
5482
5498
  get [Symbol.toStringTag]() {
@@ -5512,15 +5528,21 @@ ${source}`;
5512
5528
  }
5513
5529
  for (const pair of this._timestampPairs) {
5514
5530
  if (pair.activeQuery) {
5531
+ this._cancelPendingQuery(pair.activeQuery);
5515
5532
  this.device.gl.deleteQuery(pair.activeQuery.handle);
5516
5533
  }
5517
5534
  for (const query of pair.completedQueries) {
5535
+ this._cancelPendingQuery(query);
5518
5536
  this.device.gl.deleteQuery(query.handle);
5519
5537
  }
5520
5538
  }
5521
5539
  if (this._occlusionQuery) {
5540
+ this._cancelPendingQuery(this._occlusionQuery);
5522
5541
  this.device.gl.deleteQuery(this._occlusionQuery.handle);
5523
5542
  }
5543
+ for (const query of Array.from(this._pendingReads)) {
5544
+ this._cancelPendingQuery(query);
5545
+ }
5524
5546
  this.destroyResource();
5525
5547
  }
5526
5548
  isResultAvailable(queryIndex) {
@@ -5589,7 +5611,11 @@ ${source}`;
5589
5611
  handle: this.handle,
5590
5612
  promise: null,
5591
5613
  result: null,
5592
- disjoint: false
5614
+ disjoint: false,
5615
+ cancelled: false,
5616
+ pollRequestId: null,
5617
+ resolve: null,
5618
+ reject: null
5593
5619
  };
5594
5620
  this._occlusionActive = true;
5595
5621
  }
@@ -5618,7 +5644,11 @@ ${source}`;
5618
5644
  handle,
5619
5645
  promise: null,
5620
5646
  result: null,
5621
- disjoint: false
5647
+ disjoint: false,
5648
+ cancelled: false,
5649
+ pollRequestId: null,
5650
+ resolve: null,
5651
+ reject: null
5622
5652
  };
5623
5653
  this.device.gl.beginQuery(35007, handle);
5624
5654
  pair.activeQuery = query;
@@ -5650,6 +5680,10 @@ ${source}`;
5650
5680
  return this._pollQueryAvailability(pair.completedQueries[0]);
5651
5681
  }
5652
5682
  _pollQueryAvailability(query) {
5683
+ if (query.cancelled || this.destroyed) {
5684
+ query.result = 0n;
5685
+ return true;
5686
+ }
5653
5687
  if (query.result !== null || query.disjoint) {
5654
5688
  return true;
5655
5689
  }
@@ -5678,13 +5712,28 @@ ${source}`;
5678
5712
  if (query.promise) {
5679
5713
  return query.promise;
5680
5714
  }
5715
+ this._pendingReads.add(query);
5681
5716
  query.promise = new Promise((resolve, reject) => {
5717
+ query.resolve = resolve;
5718
+ query.reject = reject;
5682
5719
  const poll = () => {
5720
+ query.pollRequestId = null;
5721
+ if (query.cancelled || this.destroyed) {
5722
+ this._pendingReads.delete(query);
5723
+ query.promise = null;
5724
+ query.resolve = null;
5725
+ query.reject = null;
5726
+ resolve(0n);
5727
+ return;
5728
+ }
5683
5729
  if (!this._pollQueryAvailability(query)) {
5684
- requestAnimationFrame(poll);
5730
+ query.pollRequestId = this._requestAnimationFrame(poll);
5685
5731
  return;
5686
5732
  }
5733
+ this._pendingReads.delete(query);
5687
5734
  query.promise = null;
5735
+ query.resolve = null;
5736
+ query.reject = null;
5688
5737
  if (query.disjoint) {
5689
5738
  reject(new Error("GPU timestamp query was invalidated by a disjoint event"));
5690
5739
  } else {
@@ -5695,16 +5744,37 @@ ${source}`;
5695
5744
  });
5696
5745
  return query.promise;
5697
5746
  }
5747
+ _cancelPendingQuery(query) {
5748
+ this._pendingReads.delete(query);
5749
+ query.cancelled = true;
5750
+ if (query.pollRequestId !== null) {
5751
+ this._cancelAnimationFrame(query.pollRequestId);
5752
+ query.pollRequestId = null;
5753
+ }
5754
+ if (query.resolve) {
5755
+ const resolve = query.resolve;
5756
+ query.promise = null;
5757
+ query.resolve = null;
5758
+ query.reject = null;
5759
+ resolve(0n);
5760
+ }
5761
+ }
5762
+ _requestAnimationFrame(callback) {
5763
+ return requestAnimationFrame(callback);
5764
+ }
5765
+ _cancelAnimationFrame(requestId) {
5766
+ cancelAnimationFrame(requestId);
5767
+ }
5698
5768
  };
5699
5769
  }
5700
5770
  });
5701
5771
 
5702
5772
  // ../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-fence.js
5703
- var import_core26, WEBGLFence;
5773
+ var import_core25, WEBGLFence;
5704
5774
  var init_webgl_fence = __esm({
5705
5775
  "../../node_modules/@luma.gl/webgl/dist/adapter/resources/webgl-fence.js"() {
5706
- import_core26 = __toESM(require_core2(), 1);
5707
- WEBGLFence = class extends import_core26.Fence {
5776
+ import_core25 = __toESM(require_core2(), 1);
5777
+ WEBGLFence = class extends import_core25.Fence {
5708
5778
  device;
5709
5779
  gl;
5710
5780
  handle;
@@ -5823,7 +5893,7 @@ ${source}`;
5823
5893
  sourceFormat ||= texture?.glFormat || 6408;
5824
5894
  sourceType ||= texture?.glType || 5121;
5825
5895
  target2 = getPixelArray(target2, sourceType, sourceFormat, sourceWidth, sourceHeight, sourceDepth);
5826
- const signedType = (0, import_core27.getDataType)(target2);
5896
+ const signedType = import_core26.dataTypeDecoder.getDataType(target2);
5827
5897
  sourceType = sourceType || convertDataTypeToGLDataType(signedType);
5828
5898
  const prevHandle = gl.bindFramebuffer(36160, handle);
5829
5899
  gl.readBuffer(36064 + sourceAttachment);
@@ -5866,7 +5936,7 @@ ${source}`;
5866
5936
  return webglBufferTarget;
5867
5937
  }
5868
5938
  function getFramebuffer2(source) {
5869
- if (!(source instanceof import_core27.Framebuffer)) {
5939
+ if (!(source instanceof import_core26.Framebuffer)) {
5870
5940
  return { framebuffer: toFramebuffer(source), deleteFramebuffer: true };
5871
5941
  }
5872
5942
  return { framebuffer: source, deleteFramebuffer: false };
@@ -5888,14 +5958,14 @@ ${source}`;
5888
5958
  }
5889
5959
  glType ||= 5121;
5890
5960
  const shaderType = convertGLDataTypeToDataType(glType);
5891
- const ArrayType = (0, import_core27.getTypedArrayConstructor)(shaderType);
5961
+ const ArrayType = import_core26.dataTypeDecoder.getTypedArrayConstructor(shaderType);
5892
5962
  const components = glFormatToComponents(glFormat);
5893
5963
  return new ArrayType(width * height * components);
5894
5964
  }
5895
- var import_core27;
5965
+ var import_core26;
5896
5966
  var init_webgl_texture_utils = __esm({
5897
5967
  "../../node_modules/@luma.gl/webgl/dist/adapter/helpers/webgl-texture-utils.js"() {
5898
- import_core27 = __toESM(require_core2(), 1);
5968
+ import_core26 = __toESM(require_core2(), 1);
5899
5969
  init_webgl_shadertypes();
5900
5970
  init_format_utils();
5901
5971
  init_shader_formats();
@@ -5937,10 +6007,10 @@ ${source}`;
5937
6007
  }
5938
6008
  return true;
5939
6009
  }
5940
- var import_core28, WebGLDevice;
6010
+ var import_core27, WebGLDevice;
5941
6011
  var init_webgl_device = __esm({
5942
6012
  "../../node_modules/@luma.gl/webgl/dist/adapter/webgl-device.js"() {
5943
- import_core28 = __toESM(require_core2(), 1);
6013
+ import_core27 = __toESM(require_core2(), 1);
5944
6014
  init_webgl_state_tracker();
5945
6015
  init_create_browser_context();
5946
6016
  init_webgl_context_data();
@@ -5969,7 +6039,7 @@ ${source}`;
5969
6039
  init_unified_parameter_api();
5970
6040
  init_with_parameters();
5971
6041
  init_webgl_extensions();
5972
- WebGLDevice = class extends import_core28.Device {
6042
+ WebGLDevice = class extends import_core27.Device {
5973
6043
  static getDeviceFromContext(gl) {
5974
6044
  if (!gl) {
5975
6045
  return null;
@@ -6020,7 +6090,7 @@ ${source}`;
6020
6090
  }
6021
6091
  constructor(props) {
6022
6092
  super({ ...props, id: props.id || uid("webgl-device") });
6023
- const canvasContextProps = import_core28.Device._getCanvasContextProps(props);
6093
+ const canvasContextProps = import_core27.Device._getCanvasContextProps(props);
6024
6094
  if (!canvasContextProps) {
6025
6095
  throw new Error("WebGLDevice requires props.createCanvasContext to be set");
6026
6096
  }
@@ -6058,7 +6128,7 @@ ${source}`;
6058
6128
  device = WebGLDevice.getDeviceFromContext(gl);
6059
6129
  if (device) {
6060
6130
  if (props._reuseDevices) {
6061
- import_core28.log.log(1, `Not creating a new Device, instead returning a reference to Device ${device.id} already attached to WebGL context`, device)();
6131
+ import_core27.log.log(1, `Not creating a new Device, instead returning a reference to Device ${device.id} already attached to WebGL context`, device)();
6062
6132
  this.canvasContext.destroy();
6063
6133
  device._reused = true;
6064
6134
  return device;
@@ -6078,15 +6148,15 @@ ${source}`;
6078
6148
  this.features.initializeFeatures();
6079
6149
  }
6080
6150
  const glState = new WebGLStateTracker(this.gl, {
6081
- log: (...args) => import_core28.log.log(1, ...args)()
6151
+ log: (...args) => import_core27.log.log(1, ...args)()
6082
6152
  });
6083
6153
  glState.trackState(this.gl, { copyState: false });
6084
6154
  if (props.debug || props.debugWebGL) {
6085
6155
  this.gl = makeDebugContext(this.gl, { debugWebGL: true, traceWebGL: props.debugWebGL });
6086
- import_core28.log.warn("WebGL debug mode activated. Performance reduced.")();
6156
+ import_core27.log.warn("WebGL debug mode activated. Performance reduced.")();
6087
6157
  }
6088
6158
  if (props.debugWebGL) {
6089
- import_core28.log.level = Math.max(import_core28.log.level, 1);
6159
+ import_core27.log.level = Math.max(import_core27.log.level, 1);
6090
6160
  }
6091
6161
  this.commandEncoder = new WEBGLCommandEncoder(this, { id: `${this}-command-encoder` });
6092
6162
  this.canvasContext._startObservers();
@@ -6169,13 +6239,7 @@ ${source}`;
6169
6239
  submit(commandBuffer) {
6170
6240
  let submittedCommandEncoder = null;
6171
6241
  if (!commandBuffer) {
6172
- submittedCommandEncoder = this.commandEncoder;
6173
- commandBuffer = submittedCommandEncoder.finish();
6174
- this.commandEncoder.destroy();
6175
- this.commandEncoder = this.createCommandEncoder({
6176
- id: submittedCommandEncoder.props.id,
6177
- timeProfilingQuerySet: submittedCommandEncoder.getTimeProfilingQuerySet()
6178
- });
6242
+ ({ submittedCommandEncoder, commandBuffer } = this._finalizeDefaultCommandEncoderForSubmit());
6179
6243
  }
6180
6244
  try {
6181
6245
  commandBuffer._executeCommands();
@@ -6189,6 +6253,16 @@ ${source}`;
6189
6253
  commandBuffer.destroy();
6190
6254
  }
6191
6255
  }
6256
+ _finalizeDefaultCommandEncoderForSubmit() {
6257
+ const submittedCommandEncoder = this.commandEncoder;
6258
+ const commandBuffer = submittedCommandEncoder.finish();
6259
+ this.commandEncoder.destroy();
6260
+ this.commandEncoder = this.createCommandEncoder({
6261
+ id: submittedCommandEncoder.props.id,
6262
+ timeProfilingQuerySet: submittedCommandEncoder.getTimeProfilingQuerySet()
6263
+ });
6264
+ return { submittedCommandEncoder, commandBuffer };
6265
+ }
6192
6266
  //
6193
6267
  // TEMPORARY HACKS - will be removed in v9.1
6194
6268
  //
@@ -6210,7 +6284,7 @@ ${source}`;
6210
6284
  return withGLParameters(this.gl, parameters, func);
6211
6285
  }
6212
6286
  resetWebGL() {
6213
- import_core28.log.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")();
6287
+ import_core27.log.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")();
6214
6288
  resetGLParameters(this.gl);
6215
6289
  }
6216
6290
  _getDeviceSpecificTextureFormatCapabilities(capabilities) {
@@ -6282,7 +6356,7 @@ ${source}`;
6282
6356
  this._constants = this._constants || new Array(maxVertexAttributes).fill(null);
6283
6357
  const currentConstant = this._constants[location];
6284
6358
  if (currentConstant && compareConstantArrayValues2(currentConstant, constant)) {
6285
- import_core28.log.info(1, `setConstantAttributeWebGL(${location}) could have been skipped, value unchanged`)();
6359
+ import_core27.log.info(1, `setConstantAttributeWebGL(${location}) could have been skipped, value unchanged`)();
6286
6360
  }
6287
6361
  this._constants[location] = constant;
6288
6362
  switch (constant.constructor) {
@@ -6319,7 +6393,7 @@ ${source}`;
6319
6393
  });
6320
6394
 
6321
6395
  // ../../node_modules/@luma.gl/webgl/dist/index.js
6322
- var init_dist3 = __esm({
6396
+ var init_dist2 = __esm({
6323
6397
  "../../node_modules/@luma.gl/webgl/dist/index.js"() {
6324
6398
  init_webgl_device();
6325
6399
  init_webgl_buffer();
@@ -6626,12 +6700,12 @@ ${source}`;
6626
6700
  }
6627
6701
 
6628
6702
  // dist/commons.js
6629
- var import_core29 = __toESM(require_core(), 1);
6703
+ var import_core28 = __toESM(require_core(), 1);
6630
6704
  var import_engine = __toESM(require_engine(), 1);
6631
- init_dist3();
6705
+ init_dist2();
6632
6706
  async function createDeckInstance(gl) {
6633
6707
  return new Promise((resolve) => {
6634
- const deckInstance = new import_core29.Deck({
6708
+ const deckInstance = new import_core28.Deck({
6635
6709
  // Input is handled by the ArcGIS API for JavaScript.
6636
6710
  controller: false,
6637
6711
  // We use the same WebGL context as the ArcGIS API for JavaScript.