@luma.gl/engine 9.3.0-alpha.9 → 9.3.1

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 (63) hide show
  1. package/dist/animation-loop/make-animation-loop.d.ts.map +1 -1
  2. package/dist/animation-loop/make-animation-loop.js +1 -0
  3. package/dist/animation-loop/make-animation-loop.js.map +1 -1
  4. package/dist/compute/computation.js +2 -2
  5. package/dist/compute/computation.js.map +1 -1
  6. package/dist/debug/debug-framebuffer.d.ts +9 -4
  7. package/dist/debug/debug-framebuffer.d.ts.map +1 -1
  8. package/dist/debug/debug-framebuffer.js +91 -45
  9. package/dist/debug/debug-framebuffer.js.map +1 -1
  10. package/dist/dist.dev.js +200 -126
  11. package/dist/dist.min.js +33 -33
  12. package/dist/dynamic-texture/dynamic-texture.d.ts.map +1 -1
  13. package/dist/dynamic-texture/dynamic-texture.js +3 -1
  14. package/dist/dynamic-texture/dynamic-texture.js.map +1 -1
  15. package/dist/dynamic-texture/texture-data.js +2 -2
  16. package/dist/dynamic-texture/texture-data.js.map +1 -1
  17. package/dist/geometries/cube-geometry.js +7 -7
  18. package/dist/geometries/cube-geometry.js.map +1 -1
  19. package/dist/geometries/ico-sphere-geometry.js +3 -1
  20. package/dist/geometries/ico-sphere-geometry.js.map +1 -1
  21. package/dist/geometry/gpu-geometry.d.ts.map +1 -1
  22. package/dist/geometry/gpu-geometry.js +3 -0
  23. package/dist/geometry/gpu-geometry.js.map +1 -1
  24. package/dist/index.cjs +176 -108
  25. package/dist/index.cjs.map +3 -3
  26. package/dist/material/material.js +2 -2
  27. package/dist/material/material.js.map +1 -1
  28. package/dist/model/model.d.ts.map +1 -1
  29. package/dist/model/model.js +45 -34
  30. package/dist/model/model.js.map +1 -1
  31. package/dist/models/billboard-texture-model.js +4 -4
  32. package/dist/models/billboard-texture-module.d.ts +1 -1
  33. package/dist/models/billboard-texture-module.js +1 -1
  34. package/dist/models/light-model-utils.js +2 -2
  35. package/dist/modules/picking/color-picking.d.ts +2 -2
  36. package/dist/modules/picking/index-picking.d.ts +2 -2
  37. package/dist/modules/picking/legacy-color-picking.d.ts +4 -4
  38. package/dist/modules/picking/picking-uniforms.d.ts +1 -1
  39. package/dist/modules/picking/picking-uniforms.d.ts.map +1 -1
  40. package/dist/modules/picking/picking-uniforms.js +1 -1
  41. package/dist/modules/picking/picking.d.ts +2 -2
  42. package/dist/passes/get-fragment-shader.js +4 -4
  43. package/dist/shader-inputs.d.ts.map +1 -1
  44. package/dist/shader-inputs.js +20 -23
  45. package/dist/shader-inputs.js.map +1 -1
  46. package/package.json +4 -4
  47. package/src/animation-loop/make-animation-loop.ts +1 -0
  48. package/src/compute/computation.ts +2 -2
  49. package/src/debug/debug-framebuffer.ts +139 -61
  50. package/src/dynamic-texture/dynamic-texture.ts +3 -5
  51. package/src/dynamic-texture/texture-data.ts +2 -2
  52. package/src/dynamic-texture/texture-data.ts.disabled +1 -1
  53. package/src/geometries/cube-geometry.ts +7 -7
  54. package/src/geometries/ico-sphere-geometry.ts +3 -1
  55. package/src/geometry/gpu-geometry.ts +3 -0
  56. package/src/material/material.ts +2 -2
  57. package/src/model/model.ts +48 -36
  58. package/src/models/billboard-texture-model.ts +4 -4
  59. package/src/models/billboard-texture-module.ts +1 -1
  60. package/src/models/light-model-utils.ts +2 -2
  61. package/src/modules/picking/picking-uniforms.ts +1 -1
  62. package/src/passes/get-fragment-shader.ts +4 -4
  63. package/src/shader-inputs.ts +32 -41
package/dist/index.cjs CHANGED
@@ -501,13 +501,13 @@ var _AnimationLoop = class {
501
501
  if (!this.device || !canvasContext) {
502
502
  throw new Error("loop");
503
503
  }
504
- const canvas2 = canvasContext == null ? void 0 : canvasContext.canvas;
504
+ const canvas = canvasContext == null ? void 0 : canvasContext.canvas;
505
505
  const useDevicePixels = canvasContext.props.useDevicePixels;
506
506
  this.animationProps = {
507
507
  animationLoop: this,
508
508
  device: this.device,
509
509
  canvasContext,
510
- canvas: canvas2,
510
+ canvas,
511
511
  // @ts-expect-error Deprecated
512
512
  useDevicePixels,
513
513
  timeline: this.timeline,
@@ -711,6 +711,7 @@ function makeAnimationLoop(AnimationLoopTemplateCtor, props) {
711
711
  renderLoop = new AnimationLoopTemplateCtor(animationProps);
712
712
  return await (renderLoop == null ? void 0 : renderLoop.onInitialize(animationProps));
713
713
  } catch (error) {
714
+ console.error(error);
714
715
  setError(animationProps.animationLoop.device, error);
715
716
  return null;
716
717
  }
@@ -728,9 +729,9 @@ function setError(device, error) {
728
729
  if (!device) {
729
730
  return;
730
731
  }
731
- const canvas2 = device.getDefaultCanvasContext().canvas;
732
- if (canvas2 instanceof HTMLCanvasElement) {
733
- canvas2.style.overflow = "visible";
732
+ const canvas = device.getDefaultCanvasContext().canvas;
733
+ if (canvas instanceof HTMLCanvasElement) {
734
+ canvas.style.overflow = "visible";
734
735
  let errorDiv = document.getElementById("animation-loop-error");
735
736
  errorDiv == null ? void 0 : errorDiv.remove();
736
737
  errorDiv = document.createElement("h1");
@@ -741,7 +742,7 @@ function setError(device, error) {
741
742
  errorDiv.style.left = "10px";
742
743
  errorDiv.style.color = "black";
743
744
  errorDiv.style.backgroundColor = "red";
744
- (_a = canvas2.parentElement) == null ? void 0 : _a.appendChild(errorDiv);
745
+ (_a = canvas.parentElement) == null ? void 0 : _a.appendChild(errorDiv);
745
746
  }
746
747
  }
747
748
  function clearError(device) {
@@ -849,6 +850,9 @@ function getAttributeBuffersFromGeometry(device, geometry) {
849
850
  case "TEXCOORD_0":
850
851
  name = "texCoords";
851
852
  break;
853
+ case "TEXCOORD_1":
854
+ name = "texCoords1";
855
+ break;
852
856
  case "COLOR_0":
853
857
  name = "colors";
854
858
  break;
@@ -894,40 +898,92 @@ function getDebugTableForShaderLayout(layout, name) {
894
898
  }
895
899
 
896
900
  // dist/debug/debug-framebuffer.js
897
- var canvas = null;
898
- var ctx = null;
899
- function debugFramebuffer(fbo, { id, minimap, opaque, top = "0", left = "0", rgbaScale = 1 }) {
900
- if (!canvas) {
901
- canvas = document.createElement("canvas");
902
- canvas.id = id;
903
- canvas.title = id;
904
- canvas.style.zIndex = "100";
905
- canvas.style.position = "absolute";
906
- canvas.style.top = top;
907
- canvas.style.left = left;
908
- canvas.style.border = "blue 5px solid";
909
- canvas.style.transform = "scaleY(-1)";
910
- document.body.appendChild(canvas);
911
- ctx = canvas.getContext("2d");
912
- }
913
- if (canvas.width !== fbo.width || canvas.height !== fbo.height) {
914
- canvas.width = fbo.width / 2;
915
- canvas.height = fbo.height / 2;
916
- canvas.style.width = "400px";
917
- canvas.style.height = "400px";
918
- }
919
- const color = fbo.device.readPixelsToArrayWebGL(fbo);
920
- const imageData = ctx == null ? void 0 : ctx.createImageData(fbo.width, fbo.height);
921
- if (imageData) {
922
- const offset = 0;
923
- for (let i = 0; i < color.length; i += 4) {
924
- imageData.data[offset + i + 0] = color[i + 0] * rgbaScale;
925
- imageData.data[offset + i + 1] = color[i + 1] * rgbaScale;
926
- imageData.data[offset + i + 2] = color[i + 2] * rgbaScale;
927
- imageData.data[offset + i + 3] = opaque ? 255 : color[i + 3] * rgbaScale;
928
- }
929
- ctx == null ? void 0 : ctx.putImageData(imageData, 0, 0);
901
+ var DEBUG_FRAMEBUFFER_STATE_KEY = "__debugFramebufferState";
902
+ var DEFAULT_MARGIN_PX = 8;
903
+ function debugFramebuffer(renderPass, source3, options) {
904
+ if (renderPass.device.type !== "webgl") {
905
+ return;
906
+ }
907
+ const state = getDebugFramebufferState(renderPass.device);
908
+ if (state.flushing) {
909
+ return;
910
+ }
911
+ if (isDefaultRenderPass(renderPass)) {
912
+ flushDebugFramebuffers(renderPass, options, state);
913
+ return;
914
+ }
915
+ if (source3 && isFramebuffer(source3) && source3.handle !== null) {
916
+ if (!state.queuedFramebuffers.includes(source3)) {
917
+ state.queuedFramebuffers.push(source3);
918
+ }
919
+ }
920
+ }
921
+ function flushDebugFramebuffers(renderPass, options, state) {
922
+ if (state.queuedFramebuffers.length === 0) {
923
+ return;
930
924
  }
925
+ const webglDevice = renderPass.device;
926
+ const { gl } = webglDevice;
927
+ const previousReadFramebuffer = gl.getParameter(36010);
928
+ const previousDrawFramebuffer = gl.getParameter(36006);
929
+ const [targetWidth, targetHeight] = renderPass.device.getDefaultCanvasContext().getDrawingBufferSize();
930
+ let topPx = parseCssPixel(options.top, DEFAULT_MARGIN_PX);
931
+ const leftPx = parseCssPixel(options.left, DEFAULT_MARGIN_PX);
932
+ state.flushing = true;
933
+ try {
934
+ for (const framebuffer of state.queuedFramebuffers) {
935
+ const [targetX0, targetY0, targetX1, targetY1, previewHeight] = getOverlayRect({
936
+ framebuffer,
937
+ targetWidth,
938
+ targetHeight,
939
+ topPx,
940
+ leftPx,
941
+ minimap: options.minimap
942
+ });
943
+ gl.bindFramebuffer(36008, framebuffer.handle);
944
+ gl.bindFramebuffer(36009, null);
945
+ gl.blitFramebuffer(0, 0, framebuffer.width, framebuffer.height, targetX0, targetY0, targetX1, targetY1, 16384, 9728);
946
+ topPx += previewHeight + DEFAULT_MARGIN_PX;
947
+ }
948
+ } finally {
949
+ gl.bindFramebuffer(36008, previousReadFramebuffer);
950
+ gl.bindFramebuffer(36009, previousDrawFramebuffer);
951
+ state.flushing = false;
952
+ }
953
+ }
954
+ function getOverlayRect(options) {
955
+ const { framebuffer, targetWidth, targetHeight, topPx, leftPx, minimap } = options;
956
+ const maxWidth = minimap ? Math.max(Math.floor(targetWidth / 4), 1) : targetWidth;
957
+ const maxHeight = minimap ? Math.max(Math.floor(targetHeight / 4), 1) : targetHeight;
958
+ const scale = Math.min(maxWidth / framebuffer.width, maxHeight / framebuffer.height);
959
+ const previewWidth = Math.max(Math.floor(framebuffer.width * scale), 1);
960
+ const previewHeight = Math.max(Math.floor(framebuffer.height * scale), 1);
961
+ const targetX0 = leftPx;
962
+ const targetY0 = Math.max(targetHeight - topPx - previewHeight, 0);
963
+ const targetX1 = targetX0 + previewWidth;
964
+ const targetY1 = targetY0 + previewHeight;
965
+ return [targetX0, targetY0, targetX1, targetY1, previewHeight];
966
+ }
967
+ function getDebugFramebufferState(device) {
968
+ device.userData[DEBUG_FRAMEBUFFER_STATE_KEY] ||= {
969
+ flushing: false,
970
+ queuedFramebuffers: []
971
+ };
972
+ return device.userData[DEBUG_FRAMEBUFFER_STATE_KEY];
973
+ }
974
+ function isFramebuffer(value) {
975
+ return "colorAttachments" in value;
976
+ }
977
+ function isDefaultRenderPass(renderPass) {
978
+ const framebuffer = renderPass.props.framebuffer;
979
+ return !framebuffer || framebuffer.handle === null;
980
+ }
981
+ function parseCssPixel(value, defaultValue) {
982
+ if (!value) {
983
+ return defaultValue;
984
+ }
985
+ const parsedValue = Number.parseInt(value, 10);
986
+ return Number.isFinite(parsedValue) ? parsedValue : defaultValue;
931
987
  }
932
988
 
933
989
  // dist/utils/deep-equal.js
@@ -1129,12 +1185,11 @@ var ShaderInputs = class {
1129
1185
  this.moduleUniforms = {};
1130
1186
  this.moduleBindings = {};
1131
1187
  for (const [name, module2] of Object.entries(modules)) {
1132
- if (!module2) {
1133
- continue;
1134
- }
1135
- this._addModule(module2);
1136
- if (module2.name && name !== module2.name && !this.options.disableWarnings) {
1137
- import_core5.log.warn(`Module name: ${name} vs ${module2.name}`)();
1188
+ if (module2) {
1189
+ this._addModule(module2);
1190
+ if (module2.name && name !== module2.name && !this.options.disableWarnings) {
1191
+ import_core5.log.warn(`Module name: ${name} vs ${module2.name}`)();
1192
+ }
1138
1193
  }
1139
1194
  }
1140
1195
  }
@@ -1154,14 +1209,14 @@ var ShaderInputs = class {
1154
1209
  if (!this.options.disableWarnings) {
1155
1210
  import_core5.log.warn(`Module ${name} not found`)();
1156
1211
  }
1157
- continue;
1212
+ } else {
1213
+ const oldUniforms = this.moduleUniforms[moduleName];
1214
+ const oldBindings = this.moduleBindings[moduleName];
1215
+ const uniformsAndBindings = ((_a = module2.getUniforms) == null ? void 0 : _a.call(module2, moduleProps, oldUniforms)) || moduleProps;
1216
+ const { uniforms, bindings } = splitUniformsAndBindings(uniformsAndBindings, module2.uniformTypes);
1217
+ this.moduleUniforms[moduleName] = mergeModuleUniforms(oldUniforms, uniforms, module2.uniformTypes);
1218
+ this.moduleBindings[moduleName] = { ...oldBindings, ...bindings };
1158
1219
  }
1159
- const oldUniforms = this.moduleUniforms[moduleName];
1160
- const oldBindings = this.moduleBindings[moduleName];
1161
- const uniformsAndBindings = ((_a = module2.getUniforms) == null ? void 0 : _a.call(module2, moduleProps, oldUniforms)) || moduleProps;
1162
- const { uniforms, bindings } = splitUniformsAndBindings(uniformsAndBindings, module2.uniformTypes);
1163
- this.moduleUniforms[moduleName] = mergeModuleUniforms(oldUniforms, uniforms, module2.uniformTypes);
1164
- this.moduleBindings[moduleName] = { ...oldBindings, ...bindings };
1165
1220
  }
1166
1221
  }
1167
1222
  /**
@@ -1207,10 +1262,9 @@ var ShaderInputs = class {
1207
1262
  function mergeModuleUniforms(currentUniforms = {}, nextUniforms = {}, uniformTypes2 = {}) {
1208
1263
  const mergedUniforms = { ...currentUniforms };
1209
1264
  for (const [key, value] of Object.entries(nextUniforms)) {
1210
- if (value === void 0) {
1211
- continue;
1265
+ if (value !== void 0) {
1266
+ mergedUniforms[key] = mergeModuleUniformValue(currentUniforms[key], value, uniformTypes2[key]);
1212
1267
  }
1213
- mergedUniforms[key] = mergeModuleUniformValue(currentUniforms[key], value, uniformTypes2[key]);
1214
1268
  }
1215
1269
  return mergedUniforms;
1216
1270
  }
@@ -1226,10 +1280,9 @@ function mergeModuleUniformValue(currentValue, nextValue, uniformType) {
1226
1280
  const mergedArray = currentArray.slice();
1227
1281
  for (let index = 0; index < nextValue.length; index++) {
1228
1282
  const elementValue = nextValue[index];
1229
- if (elementValue === void 0) {
1230
- continue;
1283
+ if (elementValue !== void 0) {
1284
+ mergedArray[index] = mergeModuleUniformValue(currentArray[index], elementValue, uniformType[0]);
1231
1285
  }
1232
- mergedArray[index] = mergeModuleUniformValue(currentArray[index], elementValue, uniformType[0]);
1233
1286
  }
1234
1287
  return mergedArray;
1235
1288
  }
@@ -1240,10 +1293,9 @@ function mergeModuleUniformValue(currentValue, nextValue, uniformType) {
1240
1293
  const currentObject = isPlainUniformObject(currentValue) ? currentValue : {};
1241
1294
  const mergedObject = { ...currentObject };
1242
1295
  for (const [key, value] of Object.entries(nextValue)) {
1243
- if (value === void 0) {
1244
- continue;
1296
+ if (value !== void 0) {
1297
+ mergedObject[key] = mergeModuleUniformValue(currentObject[key], value, uniformStruct[key]);
1245
1298
  }
1246
- mergedObject[key] = mergeModuleUniformValue(currentObject[key], value, uniformStruct[key]);
1247
1299
  }
1248
1300
  return mergedObject;
1249
1301
  }
@@ -1480,7 +1532,10 @@ var _DynamicTexture = class {
1480
1532
  return "DynamicTexture";
1481
1533
  }
1482
1534
  toString() {
1483
- return `DynamicTexture:"${this.id}":${this.texture.width}x${this.texture.height}px:(${this.isReady ? "ready" : "loading..."})`;
1535
+ var _a, _b;
1536
+ const width = ((_a = this._texture) == null ? void 0 : _a.width) ?? this.props.width ?? "?";
1537
+ const height = ((_b = this._texture) == null ? void 0 : _b.height) ?? this.props.height ?? "?";
1538
+ return `DynamicTexture:"${this.id}":${width}x${height}px:(${this.isReady ? "ready" : "loading..."})`;
1484
1539
  }
1485
1540
  constructor(device, props) {
1486
1541
  this.device = device;
@@ -1913,6 +1968,7 @@ async function awaitAllPromises(x) {
1913
1968
  // dist/model/model.js
1914
1969
  var LOG_DRAW_PRIORITY = 2;
1915
1970
  var LOG_DRAW_TIMEOUT = 1e4;
1971
+ var PIPELINE_INITIALIZATION_FAILED = "render pipeline initialization failed";
1916
1972
  var _Model = class {
1917
1973
  /** Device that created this model */
1918
1974
  device;
@@ -2123,35 +2179,42 @@ var _Model = class {
2123
2179
  renderPass.popDebugGroup();
2124
2180
  }
2125
2181
  let drawSuccess;
2182
+ let pipelineErrored = this.pipeline.isErrored;
2126
2183
  try {
2127
2184
  renderPass.pushDebugGroup(`${this}.draw(${renderPass})`);
2128
2185
  this._logDrawCallStart();
2129
2186
  this.pipeline = this._updatePipeline();
2130
- const syncBindings = this._getBindings();
2131
- const syncBindGroups = this._getBindGroups();
2132
- const { indexBuffer } = this.vertexArray;
2133
- const indexCount = indexBuffer ? indexBuffer.byteLength / (indexBuffer.indexType === "uint32" ? 4 : 2) : void 0;
2134
- drawSuccess = this.pipeline.draw({
2135
- renderPass,
2136
- vertexArray: this.vertexArray,
2137
- isInstanced: this.isInstanced,
2138
- vertexCount: this.vertexCount,
2139
- instanceCount: this.instanceCount,
2140
- indexCount,
2141
- transformFeedback: this.transformFeedback || void 0,
2142
- // Pipelines may be shared across models when caching is enabled, so bindings
2143
- // and WebGL uniforms must be supplied on every draw instead of being stored
2144
- // on the pipeline instance.
2145
- bindings: syncBindings,
2146
- bindGroups: syncBindGroups,
2147
- _bindGroupCacheKeys: this._getBindGroupCacheKeys(),
2148
- uniforms: this.props.uniforms,
2149
- // WebGL shares underlying cached pipelines even for models that have different parameters and topology,
2150
- // so we must provide our unique parameters to each draw
2151
- // (In WebGPU most parameters are encoded in the pipeline and cannot be changed per draw call)
2152
- parameters: this.parameters,
2153
- topology: this.topology
2154
- });
2187
+ pipelineErrored = this.pipeline.isErrored;
2188
+ if (pipelineErrored) {
2189
+ import_core8.log.info(LOG_DRAW_PRIORITY, `>>> DRAWING ABORTED ${this.id}: ${PIPELINE_INITIALIZATION_FAILED}`)();
2190
+ drawSuccess = false;
2191
+ } else {
2192
+ const syncBindings = this._getBindings();
2193
+ const syncBindGroups = this._getBindGroups();
2194
+ const { indexBuffer } = this.vertexArray;
2195
+ const indexCount = indexBuffer ? indexBuffer.byteLength / (indexBuffer.indexType === "uint32" ? 4 : 2) : void 0;
2196
+ drawSuccess = this.pipeline.draw({
2197
+ renderPass,
2198
+ vertexArray: this.vertexArray,
2199
+ isInstanced: this.isInstanced,
2200
+ vertexCount: this.vertexCount,
2201
+ instanceCount: this.instanceCount,
2202
+ indexCount,
2203
+ transformFeedback: this.transformFeedback || void 0,
2204
+ // Pipelines may be shared across models when caching is enabled, so bindings
2205
+ // and WebGL uniforms must be supplied on every draw instead of being stored
2206
+ // on the pipeline instance.
2207
+ bindings: syncBindings,
2208
+ bindGroups: syncBindGroups,
2209
+ _bindGroupCacheKeys: this._getBindGroupCacheKeys(),
2210
+ uniforms: this.props.uniforms,
2211
+ // WebGL shares underlying cached pipelines even for models that have different parameters and topology,
2212
+ // so we must provide our unique parameters to each draw
2213
+ // (In WebGPU most parameters are encoded in the pipeline and cannot be changed per draw call)
2214
+ parameters: this.parameters,
2215
+ topology: this.topology
2216
+ });
2217
+ }
2155
2218
  } finally {
2156
2219
  renderPass.popDebugGroup();
2157
2220
  this._logDrawCallEnd();
@@ -2160,6 +2223,8 @@ var _Model = class {
2160
2223
  if (drawSuccess) {
2161
2224
  this._lastDrawTimestamp = this.device.timestamp;
2162
2225
  this._needsRedraw = false;
2226
+ } else if (pipelineErrored) {
2227
+ this._needsRedraw = PIPELINE_INITIALIZATION_FAILED;
2163
2228
  } else {
2164
2229
  this._needsRedraw = "waiting for resource initialization";
2165
2230
  }
@@ -2247,10 +2312,10 @@ var _Model = class {
2247
2312
  setShaderInputs(shaderInputs) {
2248
2313
  var _a;
2249
2314
  this.shaderInputs = shaderInputs;
2250
- this._uniformStore = new import_core8.UniformStore(this.shaderInputs.modules);
2315
+ this._uniformStore = new import_core8.UniformStore(this.device, this.shaderInputs.modules);
2251
2316
  for (const [moduleName, module2] of Object.entries(this.shaderInputs.modules)) {
2252
2317
  if (shaderModuleHasUniforms(module2) && !((_a = this.material) == null ? void 0 : _a.ownsModule(moduleName))) {
2253
- const uniformBuffer = this._uniformStore.getManagedUniformBuffer(this.device, moduleName);
2318
+ const uniformBuffer = this._uniformStore.getManagedUniformBuffer(moduleName);
2254
2319
  this.bindings[`${moduleName}Uniforms`] = uniformBuffer;
2255
2320
  }
2256
2321
  }
@@ -2516,9 +2581,10 @@ var _Model = class {
2516
2581
  return;
2517
2582
  }
2518
2583
  const framebuffer = renderPass.props.framebuffer;
2519
- if (framebuffer) {
2520
- debugFramebuffer(framebuffer, { id: framebuffer.id, minimap: true });
2521
- }
2584
+ debugFramebuffer(renderPass, framebuffer, {
2585
+ id: (framebuffer == null ? void 0 : framebuffer.id) || `${this.id}-framebuffer`,
2586
+ minimap: true
2587
+ });
2522
2588
  }
2523
2589
  _getAttributeDebugTable() {
2524
2590
  const table = {};
@@ -2699,10 +2765,10 @@ var Material = class {
2699
2765
  module2
2700
2766
  ]));
2701
2767
  this.shaderInputs = props.shaderInputs || new ShaderInputs(moduleMap);
2702
- this._uniformStore = new import_core9.UniformStore(this.shaderInputs.modules);
2768
+ this._uniformStore = new import_core9.UniformStore(this.device, this.shaderInputs.modules);
2703
2769
  for (const [moduleName, module2] of Object.entries(this.shaderInputs.modules)) {
2704
2770
  if (this.ownsModule(moduleName) && shaderModuleHasUniforms(module2)) {
2705
- const uniformBuffer = this._uniformStore.getManagedUniformBuffer(this.device, moduleName);
2771
+ const uniformBuffer = this._uniformStore.getManagedUniformBuffer(moduleName);
2706
2772
  this.bindings[`${moduleName}Uniforms`] = uniformBuffer;
2707
2773
  }
2708
2774
  }
@@ -3177,12 +3243,12 @@ var backgroundModule = {
3177
3243
  };
3178
3244
  var BACKGROUND_FS_WGSL = (
3179
3245
  /* wgsl */
3180
- `@group(0) @binding(0) var backgroundTexture: texture_2d<f32>;
3181
- @group(0) @binding(1) var backgroundTextureSampler: sampler;
3246
+ `@group(0) @binding(auto) var backgroundTexture: texture_2d<f32>;
3247
+ @group(0) @binding(auto) var backgroundTextureSampler: sampler;
3182
3248
  struct backgroundUniforms {
3183
3249
  scale: vec2<f32>,
3184
3250
  };
3185
- @group(0) @binding(2) var<uniform> background: backgroundUniforms;
3251
+ @group(0) @binding(auto) var<uniform> background: backgroundUniforms;
3186
3252
 
3187
3253
  fn billboardTexture_getTextureUV(uv: vec2<f32>) -> vec2<f32> {
3188
3254
  let scale: vec2<f32> = background.scale;
@@ -3204,7 +3270,7 @@ precision highp float;
3204
3270
 
3205
3271
  uniform sampler2D backgroundTexture;
3206
3272
 
3207
- uniform backgroundUniforms {
3273
+ layout(std140) uniform backgroundUniforms {
3208
3274
  vec2 scale;
3209
3275
  } background;
3210
3276
 
@@ -3664,7 +3730,7 @@ function getLightMarkerShaders(anchorMode) {
3664
3730
  viewProjectionMatrix: mat4x4<f32>,
3665
3731
  };
3666
3732
 
3667
- @binding(0) @group(0) var<uniform> lightMarker : lightMarkerUniforms;
3733
+ @group(0) @binding(auto) var<uniform> lightMarker : lightMarkerUniforms;
3668
3734
 
3669
3735
  struct VertexInputs {
3670
3736
  @location(0) positions : vec3<f32>,
@@ -3714,7 +3780,7 @@ in vec3 instanceDirection;
3714
3780
  in vec3 instanceScale;
3715
3781
  in vec4 instanceColor;
3716
3782
 
3717
- uniform lightMarkerUniforms {
3783
+ layout(std140) uniform lightMarkerUniforms {
3718
3784
  mat4 viewProjectionMatrix;
3719
3785
  } lightMarker;
3720
3786
 
@@ -4872,7 +4938,9 @@ function tesselateIcosaHedron(props) {
4872
4938
  ym /= len;
4873
4939
  zm /= len;
4874
4940
  positions.push(xm, ym, zm);
4875
- return pointMemo[key] = positions.length / 3 - 1;
4941
+ const pointIndex = positions.length / 3 - 1;
4942
+ pointMemo[key] = pointIndex;
4943
+ return pointIndex;
4876
4944
  };
4877
4945
  })();
4878
4946
  for (let i = 0; i < iterations; i++) {
@@ -5237,8 +5305,8 @@ function getFragmentShaderForRenderPass(options) {
5237
5305
  function getFilterShaderWGSL(func) {
5238
5306
  return (
5239
5307
  /* wgsl */
5240
- `@group(0) @binding(0) var sourceTexture: texture_2d<f32>;
5241
- @group(0) @binding(2) var sourceTextureSampler: sampler;
5308
+ `@group(0) @binding(auto) var sourceTexture: texture_2d<f32>;
5309
+ @group(0) @binding(auto) var sourceTextureSampler: sampler;
5242
5310
 
5243
5311
  @fragment
5244
5312
  fn fragmentMain(inputs: FragmentInputs) -> @location(0) vec4f {
@@ -5255,8 +5323,8 @@ fn fragmentMain(inputs: FragmentInputs) -> @location(0) vec4f {
5255
5323
  function getSamplerShaderWGSL(func) {
5256
5324
  return (
5257
5325
  /* wgsl */
5258
- `@group(0) @binding(0) var sourceTexture: texture_2d<f32>;
5259
- @group(0) @binding(2) var sourceTextureSampler: sampler;
5326
+ `@group(0) @binding(auto) var sourceTexture: texture_2d<f32>;
5327
+ @group(0) @binding(auto) var sourceTextureSampler: sampler;
5260
5328
 
5261
5329
  @fragment
5262
5330
  fn fragmentMain(inputs: FragmentInputs) -> @location(0) vec4f {
@@ -5570,10 +5638,10 @@ var _Computation = class {
5570
5638
  }
5571
5639
  setShaderInputs(shaderInputs) {
5572
5640
  this.shaderInputs = shaderInputs;
5573
- this._uniformStore = new import_core17.UniformStore(this.shaderInputs.modules);
5641
+ this._uniformStore = new import_core17.UniformStore(this.device, this.shaderInputs.modules);
5574
5642
  for (const [moduleName, module2] of Object.entries(this.shaderInputs.modules)) {
5575
5643
  if (shaderModuleHasUniforms(module2)) {
5576
- const uniformBuffer = this._uniformStore.getManagedUniformBuffer(this.device, moduleName);
5644
+ const uniformBuffer = this._uniformStore.getManagedUniformBuffer(moduleName);
5577
5645
  this.bindings[`${moduleName}Uniforms`] = uniformBuffer;
5578
5646
  }
5579
5647
  }
@@ -5704,7 +5772,7 @@ var GLSL_UNIFORMS = (
5704
5772
  `precision highp float;
5705
5773
  precision highp int;
5706
5774
 
5707
- uniform pickingUniforms {
5775
+ layout(std140) uniform pickingUniforms {
5708
5776
  int isActive;
5709
5777
  int indexMode;
5710
5778
  int batchIndex;