@luma.gl/webgpu 9.0.0-beta.6 → 9.0.0-beta.7

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/adapter/helpers/get-bind-group.d.ts +3 -3
  2. package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
  3. package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
  4. package/dist/adapter/resources/webgpu-buffer.js +3 -1
  5. package/dist/adapter/resources/webgpu-compute-pass.d.ts +14 -8
  6. package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
  7. package/dist/adapter/resources/webgpu-compute-pass.js +18 -13
  8. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +13 -3
  9. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
  10. package/dist/adapter/resources/webgpu-compute-pipeline.js +25 -7
  11. package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
  12. package/dist/adapter/resources/webgpu-external-texture.js +2 -0
  13. package/dist/adapter/resources/webgpu-query-set.d.ts.map +1 -1
  14. package/dist/adapter/resources/webgpu-query-set.js +3 -1
  15. package/dist/adapter/resources/webgpu-render-pipeline.d.ts +49 -1
  16. package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
  17. package/dist/adapter/resources/webgpu-render-pipeline.js +69 -51
  18. package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
  19. package/dist/adapter/resources/webgpu-sampler.js +3 -0
  20. package/dist/adapter/resources/webgpu-shader.d.ts +1 -4
  21. package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
  22. package/dist/adapter/resources/webgpu-shader.js +7 -18
  23. package/dist/adapter/resources/webgpu-texture-view.d.ts.map +1 -1
  24. package/dist/adapter/resources/webgpu-texture-view.js +3 -0
  25. package/dist/adapter/resources/webgpu-texture.d.ts +3 -4
  26. package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
  27. package/dist/adapter/resources/webgpu-texture.js +8 -8
  28. package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
  29. package/dist/adapter/webgpu-canvas-context.js +2 -1
  30. package/dist/adapter/webgpu-device.d.ts +2 -7
  31. package/dist/adapter/webgpu-device.d.ts.map +1 -1
  32. package/dist/adapter/webgpu-device.js +9 -19
  33. package/dist/dist.dev.js +132 -175
  34. package/dist/index.cjs +122 -131
  35. package/dist/index.cjs.map +4 -4
  36. package/dist.min.js +1 -1
  37. package/package.json +2 -2
  38. package/src/adapter/helpers/get-bind-group.ts +4 -4
  39. package/src/adapter/resources/webgpu-buffer.ts +3 -1
  40. package/src/adapter/resources/webgpu-compute-pass.ts +19 -14
  41. package/src/adapter/resources/webgpu-compute-pipeline.ts +36 -9
  42. package/src/adapter/resources/webgpu-external-texture.ts +2 -0
  43. package/src/adapter/resources/webgpu-query-set.ts +3 -1
  44. package/src/adapter/resources/webgpu-render-pipeline.ts +63 -92
  45. package/src/adapter/resources/webgpu-sampler.ts +3 -0
  46. package/src/adapter/resources/webgpu-shader.ts +8 -23
  47. package/src/adapter/resources/webgpu-texture-view.ts +3 -0
  48. package/src/adapter/resources/webgpu-texture.ts +11 -10
  49. package/src/adapter/webgpu-canvas-context.ts +2 -1
  50. package/src/adapter/webgpu-device.ts +11 -20
  51. package/dist/adapter/helpers/generate-mipmaps.d.ts +0 -10
  52. package/dist/adapter/helpers/generate-mipmaps.d.ts.map +0 -1
  53. package/dist/adapter/helpers/generate-mipmaps.js +0 -103
  54. package/dist/adapter/resources/webgpu-query.d.ts +0 -1
  55. package/dist/adapter/resources/webgpu-query.d.ts.map +0 -1
  56. package/dist/adapter/resources/webgpu-query.js +0 -43
  57. package/dist/adapter/webgpu-types.d.ts +0 -1
  58. package/dist/adapter/webgpu-types.d.ts.map +0 -1
  59. package/dist/adapter/webgpu-types.js +0 -0
  60. package/dist/glsl/glsllang.d.ts +0 -3
  61. package/dist/glsl/glsllang.d.ts.map +0 -1
  62. package/dist/glsl/glsllang.js +0 -12
  63. package/src/adapter/helpers/generate-mipmaps.ts +0 -118
package/dist/dist.dev.js CHANGED
@@ -91,7 +91,8 @@ var __exports__ = (() => {
91
91
  }
92
92
  }
93
93
  destroy() {
94
- this.handle.destroy();
94
+ this.handle?.destroy();
95
+ this.handle = null;
95
96
  }
96
97
  // WebGPU provides multiple ways to write a buffer...
97
98
  write(data, byteOffset = 0) {
@@ -160,6 +161,7 @@ var __exports__ = (() => {
160
161
  this.handle.label = this.props.id;
161
162
  }
162
163
  destroy() {
164
+ this.handle = null;
163
165
  }
164
166
  };
165
167
 
@@ -188,6 +190,7 @@ var __exports__ = (() => {
188
190
  this.handle.label = this.props.id;
189
191
  }
190
192
  destroy() {
193
+ this.handle = null;
191
194
  }
192
195
  };
193
196
 
@@ -225,6 +228,13 @@ var __exports__ = (() => {
225
228
  }
226
229
  this.initialize(props);
227
230
  }
231
+ destroy() {
232
+ this.handle?.destroy();
233
+ this.handle = null;
234
+ }
235
+ createView(props) {
236
+ return new WebGPUTextureView(this.device, { ...props, texture: this });
237
+ }
228
238
  initialize(props) {
229
239
  this.handle = this.props.handle || this.createHandle();
230
240
  this.handle.label ||= this.id;
@@ -253,9 +263,6 @@ var __exports__ = (() => {
253
263
  sampleCount: this.props.samples
254
264
  });
255
265
  }
256
- destroy() {
257
- this.handle.destroy();
258
- }
259
266
  /**
260
267
  * Set default sampler
261
268
  * Accept a sampler instance or set of props;
@@ -305,10 +312,6 @@ var __exports__ = (() => {
305
312
  return { width, height };
306
313
  }
307
314
  // WebGPU specific
308
- /** TODO - intention is to expose TextureViews in the public API */
309
- createView() {
310
- return this.handle.createView({ label: this.id });
311
- }
312
315
  /*
313
316
  async readPixels() {
314
317
  const readbackBuffer = device.createBuffer({
@@ -408,6 +411,7 @@ var __exports__ = (() => {
408
411
  this.sampler = null;
409
412
  }
410
413
  destroy() {
414
+ this.handle = null;
411
415
  }
412
416
  /** Set default sampler */
413
417
  setSampler(sampler) {
@@ -439,6 +443,7 @@ var __exports__ = (() => {
439
443
  }
440
444
  }
441
445
  destroy() {
446
+ this.handle = null;
442
447
  }
443
448
  /** Returns compilation info for this shader */
444
449
  async getCompilationInfo() {
@@ -447,23 +452,12 @@ var __exports__ = (() => {
447
452
  }
448
453
  // PRIVATE METHODS
449
454
  createHandle() {
450
- const { source, stage } = this.props;
451
- let language = this.props.language;
452
- if (language === "auto") {
453
- language = source.includes("->") ? "wgsl" : "glsl";
454
- }
455
- switch (language) {
456
- case "wgsl":
457
- return this.device.handle.createShaderModule({ code: source });
458
- case "glsl":
459
- return this.device.handle.createShaderModule({
460
- code: source,
461
- // @ts-expect-error
462
- transform: (glsl) => this.device.glslang.compileGLSL(glsl, stage)
463
- });
464
- default:
465
- throw new Error(language);
455
+ const { source } = this.props;
456
+ const isGLSL = source.includes("#version");
457
+ if (this.props.language === "glsl" || isGLSL) {
458
+ throw new Error("GLSL shaders are not supported in WebGPU");
466
459
  }
460
+ return this.device.handle.createShaderModule({ code: source });
467
461
  }
468
462
  };
469
463
 
@@ -788,11 +782,8 @@ var __exports__ = (() => {
788
782
  handle;
789
783
  vs;
790
784
  fs = null;
791
- // private _bufferSlots: Record<string, number>;
792
- // private _buffers: Buffer[];
793
- // private _firstIndex: number;
794
- // private _lastIndex: number;
795
785
  /** For internal use to create BindGroups */
786
+ _bindings;
796
787
  _bindGroupLayout = null;
797
788
  _bindGroup = null;
798
789
  constructor(device, props) {
@@ -809,35 +800,21 @@ var __exports__ = (() => {
809
800
  this.handle.label = this.props.id;
810
801
  this.vs = (0, import_core9.cast)(props.vs);
811
802
  this.fs = (0, import_core9.cast)(props.fs);
803
+ this._bindings = { ...this.props.bindings };
812
804
  }
813
805
  destroy() {
806
+ this.handle = null;
814
807
  }
815
- // setIndexBuffer(indexBuffer: Buffer): void {
816
- // this._indexBuffer = cast<WebGPUBuffer>(indexBuffer);
817
- // }
818
- // setAttributes(attributes: Record<string, Buffer>): void {
819
- // for (const [name, buffer] of Object.entries(attributes)) {
820
- // const bufferIndex = this._bufferSlots[name];
821
- // if (bufferIndex >= 0) {
822
- // this._buffers[bufferIndex] = buffer;
823
- // } else {
824
- // throw new Error(
825
- // `Setting attribute '${name}' not listed in shader layout for program ${this.id}`
826
- // );
827
- // }
828
- // }
829
- // // for (let i = 0; i < this._bufferSlots.length; ++i) {
830
- // // const bufferName = this._bufferSlots[i];
831
- // // if (attributes[bufferName]) {
832
- // // this.handle
833
- // // }
834
- // // }
835
- // }
808
+ /**
809
+ * @todo Use renderpass.setBindings() ?
810
+ * @todo Do we want to expose BindGroups in the API and remove this?
811
+ */
836
812
  setBindings(bindings) {
837
- Object.assign(this.props.bindings, bindings);
813
+ Object.assign(this._bindings, bindings);
838
814
  }
815
+ /** @todo - should this be moved to renderpass? */
839
816
  draw(options) {
840
- const webgpuRenderPass = (0, import_core9.cast)(options.renderPass) || this.device.getDefaultRenderPass();
817
+ const webgpuRenderPass = options.renderPass;
841
818
  webgpuRenderPass.handle.setPipeline(this.handle);
842
819
  const bindGroup = this._getBindGroup();
843
820
  if (bindGroup) {
@@ -861,18 +838,19 @@ var __exports__ = (() => {
861
838
  );
862
839
  }
863
840
  options.vertexArray.unbindAfterRender(options.renderPass);
841
+ return true;
864
842
  }
865
- // _getBuffers() {
866
- // return this._buffers;
867
- // }
868
843
  /** Return a bind group created by setBindings */
869
844
  _getBindGroup() {
845
+ if (this.props.shaderLayout.bindings.length === 0) {
846
+ return null;
847
+ }
870
848
  this._bindGroupLayout = this._bindGroupLayout || this.handle.getBindGroupLayout(0);
871
849
  this._bindGroup = this._bindGroup || getBindGroup(
872
850
  this.device.handle,
873
851
  this._bindGroupLayout,
874
852
  this.props.shaderLayout,
875
- this.props.bindings
853
+ this._bindings
876
854
  );
877
855
  return this._bindGroup;
878
856
  }
@@ -882,22 +860,19 @@ var __exports__ = (() => {
882
860
  _getRenderPipelineDescriptor() {
883
861
  const vertex = {
884
862
  module: (0, import_core9.cast)(this.props.vs).handle,
885
- entryPoint: this.props.vsEntryPoint || "main",
863
+ entryPoint: this.props.vertexEntryPoint || "main",
886
864
  buffers: getVertexBufferLayout(this.props.shaderLayout, this.props.bufferLayout)
887
865
  };
888
- let fragment;
889
- if (this.props.fs) {
890
- fragment = {
891
- module: (0, import_core9.cast)(this.props.fs).handle,
892
- entryPoint: this.props.fsEntryPoint || "main",
893
- targets: [
894
- {
895
- // TODO exclamation mark hack!
896
- format: getWebGPUTextureFormat(this.device?.canvasContext?.format)
897
- }
898
- ]
899
- };
900
- }
866
+ const fragment = {
867
+ module: (0, import_core9.cast)(this.props.fs).handle,
868
+ entryPoint: this.props.fragmentEntryPoint || "main",
869
+ targets: [
870
+ {
871
+ // TODO exclamation mark hack!
872
+ format: getWebGPUTextureFormat(this.device?.canvasContext?.format)
873
+ }
874
+ ]
875
+ };
901
876
  switch (this.props.topology) {
902
877
  case "triangle-fan-webgl":
903
878
  case "line-loop-webgl":
@@ -915,78 +890,66 @@ var __exports__ = (() => {
915
890
  applyParametersToRenderPipelineDescriptor(descriptor, this.props.parameters);
916
891
  return descriptor;
917
892
  }
918
- /**
919
- _setAttributeBuffers(webgpuRenderPass: WebGPURenderPass) {
920
- if (this._indexBuffer) {
921
- webgpuRenderPass.handle.setIndexBuffer(this._indexBuffer.handle, this._indexBuffer.props.indexType);
922
- }
923
-
924
- const buffers = this._getBuffers();
925
- for (let i = 0; i < buffers.length; ++i) {
926
- const buffer = cast<WebGPUBuffer>(buffers[i]);
927
- if (!buffer) {
928
- const attribute = this.props.shaderLayout.attributes.find(
929
- (attribute) => attribute.location === i
930
- );
931
- throw new Error(
932
- `No buffer provided for attribute '${attribute?.name || ''}' in Model '${this.props.id}'`
933
- );
934
- }
935
- webgpuRenderPass.handle.setVertexBuffer(i, buffer.handle);
936
- }
937
-
938
- // TODO - HANDLE buffer maps
939
- /*
940
- for (const [bufferName, attributeMapping] of Object.entries(this.props.bufferLayout)) {
941
- const buffer = cast<WebGPUBuffer>(this.props.attributes[bufferName]);
942
- if (!buffer) {
943
- log.warn(`Missing buffer for buffer map ${bufferName}`)();
944
- continue;
945
- }
946
-
947
- if ('location' in attributeMapping) {
948
- // @ts-expect-error TODO model must not depend on webgpu
949
- renderPass.handle.setVertexBuffer(layout.location, buffer.handle);
950
- } else {
951
- for (const [bufferName, mapping] of Object.entries(attributeMapping)) {
952
- // @ts-expect-error TODO model must not depend on webgpu
953
- renderPass.handle.setVertexBuffer(field.location, buffer.handle);
954
- }
955
- }
956
- }
957
- *
958
- }
959
- */
960
893
  };
961
894
 
962
- // src/adapter/resources/webgpu-compute-pipeline.ts
895
+ // src/adapter/resources/webgpu-framebuffer.ts
963
896
  var import_core10 = __toESM(require_core(), 1);
964
- var WebGPUComputePipeline = class extends import_core10.ComputePipeline {
897
+ var WebGPUFramebuffer = class extends import_core10.Framebuffer {
898
+ device;
899
+ constructor(device, props) {
900
+ super(device, props);
901
+ this.device = device;
902
+ this.autoCreateAttachmentTextures();
903
+ }
904
+ };
905
+
906
+ // src/adapter/resources/webgpu-compute-pipeline.ts
907
+ var import_core11 = __toESM(require_core(), 1);
908
+ var WebGPUComputePipeline = class extends import_core11.ComputePipeline {
965
909
  device;
966
910
  handle;
911
+ /** For internal use to create BindGroups */
912
+ _bindGroupLayout = null;
913
+ _bindGroup = null;
914
+ /** For internal use to create BindGroups */
915
+ _bindings = {};
967
916
  constructor(device, props) {
968
917
  super(device, props);
969
918
  this.device = device;
970
- const webgpuShader = this.props.cs;
919
+ const webgpuShader = this.props.shader;
971
920
  this.handle = this.props.handle || this.device.handle.createComputePipeline({
972
921
  label: this.props.id,
973
922
  compute: {
974
923
  module: webgpuShader.handle,
975
- entryPoint: this.props.csEntryPoint
976
- // constants: this.props.csConstants
924
+ entryPoint: this.props.entryPoint,
925
+ constants: this.props.constants
977
926
  },
978
927
  layout: "auto"
979
928
  });
980
929
  }
981
- /** For internal use in render passes */
982
- _getBindGroupLayout() {
983
- return this.handle.getBindGroupLayout(0);
930
+ /**
931
+ * @todo Use renderpass.setBindings() ?
932
+ * @todo Do we want to expose BindGroups in the API and remove this?
933
+ */
934
+ setBindings(bindings) {
935
+ Object.assign(this._bindings, bindings);
936
+ }
937
+ /** Return a bind group created by setBindings */
938
+ _getBindGroup() {
939
+ this._bindGroupLayout = this._bindGroupLayout || this.handle.getBindGroupLayout(0);
940
+ this._bindGroup = this._bindGroup || getBindGroup(
941
+ this.device.handle,
942
+ this._bindGroupLayout,
943
+ this.props.shaderLayout,
944
+ this._bindings
945
+ );
946
+ return this._bindGroup;
984
947
  }
985
948
  };
986
949
 
987
950
  // src/adapter/resources/webgpu-render-pass.ts
988
- var import_core11 = __toESM(require_core(), 1);
989
- var WebGPURenderPass = class extends import_core11.RenderPass {
951
+ var import_core12 = __toESM(require_core(), 1);
952
+ var WebGPURenderPass = class extends import_core12.RenderPass {
990
953
  device;
991
954
  handle;
992
955
  /** Active pipeline */
@@ -1010,9 +973,9 @@ var __exports__ = (() => {
1010
973
  }
1011
974
  this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor);
1012
975
  this.handle.label = this.props.id;
1013
- import_core11.log.groupCollapsed(3, `new WebGPURenderPass(${this.id})`)();
1014
- import_core11.log.probe(3, JSON.stringify(renderPassDescriptor, null, 2))();
1015
- import_core11.log.groupEnd(3)();
976
+ import_core12.log.groupCollapsed(3, `new WebGPURenderPass(${this.id})`)();
977
+ import_core12.log.probe(3, JSON.stringify(renderPassDescriptor, null, 2))();
978
+ import_core12.log.groupEnd(3)();
1016
979
  }
1017
980
  destroy() {
1018
981
  }
@@ -1020,7 +983,7 @@ var __exports__ = (() => {
1020
983
  this.handle.end();
1021
984
  }
1022
985
  setPipeline(pipeline) {
1023
- this.pipeline = (0, import_core11.cast)(pipeline);
986
+ this.pipeline = (0, import_core12.cast)(pipeline);
1024
987
  this.handle.setPipeline(this.pipeline.handle);
1025
988
  }
1026
989
  /** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
@@ -1032,10 +995,10 @@ var __exports__ = (() => {
1032
995
  }
1033
996
  }
1034
997
  setIndexBuffer(buffer, indexFormat, offset = 0, size) {
1035
- this.handle.setIndexBuffer((0, import_core11.cast)(buffer).handle, indexFormat, offset, size);
998
+ this.handle.setIndexBuffer((0, import_core12.cast)(buffer).handle, indexFormat, offset, size);
1036
999
  }
1037
1000
  setVertexBuffer(slot, buffer, offset = 0) {
1038
- this.handle.setVertexBuffer(slot, (0, import_core11.cast)(buffer).handle, offset);
1001
+ this.handle.setVertexBuffer(slot, (0, import_core12.cast)(buffer).handle, offset);
1039
1002
  }
1040
1003
  draw(options) {
1041
1004
  if (options.indexCount) {
@@ -1137,11 +1100,11 @@ var __exports__ = (() => {
1137
1100
  };
1138
1101
 
1139
1102
  // src/adapter/resources/webgpu-compute-pass.ts
1140
- var import_core12 = __toESM(require_core(), 1);
1141
- var WebGPUComputePass = class extends import_core12.ComputePass {
1103
+ var import_core13 = __toESM(require_core(), 1);
1104
+ var WebGPUComputePass = class extends import_core13.ComputePass {
1142
1105
  device;
1143
1106
  handle;
1144
- _bindGroupLayout = null;
1107
+ _webgpuPipeline = null;
1145
1108
  constructor(device, props) {
1146
1109
  super(device, props);
1147
1110
  this.device = device;
@@ -1170,29 +1133,36 @@ var __exports__ = (() => {
1170
1133
  setPipeline(pipeline) {
1171
1134
  const wgpuPipeline = pipeline;
1172
1135
  this.handle.setPipeline(wgpuPipeline.handle);
1173
- this._bindGroupLayout = wgpuPipeline._getBindGroupLayout();
1136
+ this._webgpuPipeline = wgpuPipeline;
1137
+ this.setBindings([]);
1174
1138
  }
1175
- /** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
1139
+ /**
1140
+ * Sets an array of bindings (uniform buffers, samplers, textures, ...)
1141
+ * TODO - still some API confusion - does this method go here or on the pipeline?
1142
+ */
1176
1143
  setBindings(bindings) {
1177
- throw new Error("fix me");
1144
+ const bindGroup = this._webgpuPipeline._getBindGroup();
1145
+ this.handle.setBindGroup(0, bindGroup);
1178
1146
  }
1179
1147
  /**
1180
1148
  * Dispatch work to be performed with the current ComputePipeline.
1181
- * @param x X dimension of the grid of workgroups to dispatch.
1182
- * @param y Y dimension of the grid of workgroups to dispatch.
1183
- * @param z Z dimension of the grid of workgroups to dispatch.
1149
+ * @param x X dimension of the grid of work groups to dispatch.
1150
+ * @param y Y dimension of the grid of work groups to dispatch.
1151
+ * @param z Z dimension of the grid of work groups to dispatch.
1184
1152
  */
1185
1153
  dispatch(x, y, z) {
1186
1154
  this.handle.dispatchWorkgroups(x, y, z);
1187
1155
  }
1188
1156
  /**
1189
1157
  * Dispatch work to be performed with the current ComputePipeline.
1190
- * @param indirectBuffer buffer must be a tightly packed block of three 32-bit unsigned integer values (12 bytes total), given in the same order as the arguments for dispatch()
1191
- * @param indirectOffset
1158
+ *
1159
+ * Buffer must be a tightly packed block of three 32-bit unsigned integer values (12 bytes total), given in the same order as the arguments for dispatch()
1160
+ * @param indirectBuffer
1161
+ * @param indirectOffset offset in buffer to the beginning of the dispatch data.
1192
1162
  */
1193
- dispatchIndirect(indirectBuffer, indirectOffset = 0) {
1163
+ dispatchIndirect(indirectBuffer, indirectByteOffset = 0) {
1194
1164
  const webgpuBuffer = indirectBuffer;
1195
- this.handle.dispatchWorkgroupsIndirect(webgpuBuffer.handle, indirectOffset);
1165
+ this.handle.dispatchWorkgroupsIndirect(webgpuBuffer.handle, indirectByteOffset);
1196
1166
  }
1197
1167
  pushDebugGroup(groupLabel) {
1198
1168
  this.handle.pushDebugGroup(groupLabel);
@@ -1206,14 +1176,16 @@ var __exports__ = (() => {
1206
1176
  };
1207
1177
 
1208
1178
  // src/adapter/resources/webgpu-vertex-array.ts
1209
- var import_core13 = __toESM(require_core(), 1);
1179
+ var import_core14 = __toESM(require_core(), 1);
1210
1180
 
1211
1181
  // ../../node_modules/@probe.gl/env/dist/lib/is-electron.js
1212
1182
  function isElectron(mockUserAgent) {
1213
- if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
1183
+ if (typeof window !== "undefined" && typeof window.process === "object" && // @ts-expect-error
1184
+ window.process.type === "renderer") {
1214
1185
  return true;
1215
1186
  }
1216
- if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions["electron"])) {
1187
+ if (typeof process !== "undefined" && typeof process.versions === "object" && // eslint-disable-next-line
1188
+ Boolean(process.versions["electron"])) {
1217
1189
  return true;
1218
1190
  }
1219
1191
  const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
@@ -1226,7 +1198,10 @@ var __exports__ = (() => {
1226
1198
 
1227
1199
  // ../../node_modules/@probe.gl/env/dist/lib/is-browser.js
1228
1200
  function isBrowser() {
1229
- const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
1201
+ const isNode = (
1202
+ // @ts-expect-error
1203
+ typeof process === "object" && String(process) === "[object process]" && !process.browser
1204
+ );
1230
1205
  return !isNode || isElectron();
1231
1206
  }
1232
1207
 
@@ -1269,7 +1244,7 @@ var __exports__ = (() => {
1269
1244
  }
1270
1245
 
1271
1246
  // src/adapter/resources/webgpu-vertex-array.ts
1272
- var WebGPUVertexArray = class extends import_core13.VertexArray {
1247
+ var WebGPUVertexArray = class extends import_core14.VertexArray {
1273
1248
  get [Symbol.toStringTag]() {
1274
1249
  return "WebGPUVertexArray";
1275
1250
  }
@@ -1298,7 +1273,7 @@ var __exports__ = (() => {
1298
1273
  const webgpuRenderPass = renderPass;
1299
1274
  const webgpuIndexBuffer = this.indexBuffer;
1300
1275
  if (webgpuIndexBuffer?.handle) {
1301
- import_core13.log.warn("setting index buffer", webgpuIndexBuffer?.handle, webgpuIndexBuffer?.indexType)();
1276
+ import_core14.log.warn("setting index buffer", webgpuIndexBuffer?.handle, webgpuIndexBuffer?.indexType)();
1302
1277
  webgpuRenderPass.handle.setIndexBuffer(
1303
1278
  webgpuIndexBuffer?.handle,
1304
1279
  webgpuIndexBuffer?.indexType
@@ -1307,7 +1282,7 @@ var __exports__ = (() => {
1307
1282
  for (let location = 0; location < this.maxVertexAttributes; location++) {
1308
1283
  const webgpuBuffer = this.attributes[location];
1309
1284
  if (webgpuBuffer?.handle) {
1310
- import_core13.log.warn(`setting vertex buffer ${location}`, webgpuBuffer?.handle)();
1285
+ import_core14.log.warn(`setting vertex buffer ${location}`, webgpuBuffer?.handle)();
1311
1286
  webgpuRenderPass.handle.setVertexBuffer(location, webgpuBuffer?.handle);
1312
1287
  }
1313
1288
  }
@@ -1326,19 +1301,6 @@ var __exports__ = (() => {
1326
1301
 
1327
1302
  // src/adapter/webgpu-canvas-context.ts
1328
1303
  var import_core15 = __toESM(require_core(), 1);
1329
-
1330
- // src/adapter/resources/webgpu-framebuffer.ts
1331
- var import_core14 = __toESM(require_core(), 1);
1332
- var WebGPUFramebuffer = class extends import_core14.Framebuffer {
1333
- device;
1334
- constructor(device, props) {
1335
- super(device, props);
1336
- this.device = device;
1337
- this.autoCreateAttachmentTextures();
1338
- }
1339
- };
1340
-
1341
- // src/adapter/webgpu-canvas-context.ts
1342
1304
  var WebGPUCanvasContext = class extends import_core15.CanvasContext {
1343
1305
  device;
1344
1306
  gpuCanvasContext;
@@ -1401,7 +1363,8 @@ var __exports__ = (() => {
1401
1363
  getCurrentTexture() {
1402
1364
  return this.device._createTexture({
1403
1365
  id: `${this.id}#color-texture`,
1404
- handle: this.gpuCanvasContext.getCurrentTexture()
1366
+ handle: this.gpuCanvasContext.getCurrentTexture(),
1367
+ format: this.format
1405
1368
  });
1406
1369
  }
1407
1370
  /** We build render targets on demand (i.e. not when size changes but when about to render) */
@@ -1434,12 +1397,15 @@ var __exports__ = (() => {
1434
1397
  this.handle.label = this.props.id;
1435
1398
  }
1436
1399
  destroy() {
1437
- this.handle.destroy();
1400
+ this.handle?.destroy();
1401
+ this.handle = null;
1438
1402
  }
1439
1403
  };
1440
1404
 
1441
1405
  // src/adapter/webgpu-device.ts
1442
1406
  var _WebGPUDevice = class extends import_core17.Device {
1407
+ /** type of this device */
1408
+ type = "webgpu";
1443
1409
  /** The underlying WebGPU device */
1444
1410
  handle;
1445
1411
  /* The underlying WebGPU adapter */
@@ -1476,7 +1442,7 @@ var __exports__ = (() => {
1476
1442
  import_core17.log.probe(2, "Adapter available", adapterInfo)();
1477
1443
  const requiredFeatures = [];
1478
1444
  const requiredLimits = {};
1479
- if (props.requestMaximalLimits) {
1445
+ if (props.requestMaxLimits) {
1480
1446
  requiredFeatures.push(...Array.from(adapter.features));
1481
1447
  for (const key in adapter.limits) {
1482
1448
  requiredLimits[key] = adapter.limits[key];
@@ -1534,7 +1500,7 @@ var __exports__ = (() => {
1534
1500
  }
1535
1501
  /** @todo implement proper check? */
1536
1502
  isTextureFormatFilterable(format) {
1537
- return this.isTextureFormatSupported(format);
1503
+ return this.isTextureFormatSupported(format) && !format.startsWith("depth") && !format.startsWith("stencil");
1538
1504
  }
1539
1505
  /** @todo implement proper check? */
1540
1506
  isTextureFormatRenderable(format) {
@@ -1563,7 +1529,7 @@ var __exports__ = (() => {
1563
1529
  return new WebGPURenderPipeline(this, props);
1564
1530
  }
1565
1531
  createFramebuffer(props) {
1566
- throw new Error("Not implemented");
1532
+ return new WebGPUFramebuffer(this, props);
1567
1533
  }
1568
1534
  createComputePipeline(props) {
1569
1535
  return new WebGPUComputePipeline(this, props);
@@ -1596,15 +1562,6 @@ var __exports__ = (() => {
1596
1562
  createCanvasContext(props) {
1597
1563
  return new WebGPUCanvasContext(this, this.adapter, props);
1598
1564
  }
1599
- /**
1600
- * Gets default renderpass encoder.
1601
- * Creates a new encoder against default canvasContext if not already created
1602
- * @note Called internally by Model.
1603
- * @deprecated Create explicit pass with device.beginRenderPass
1604
- */
1605
- getDefaultRenderPass() {
1606
- throw new Error("a");
1607
- }
1608
1565
  submit() {
1609
1566
  const commandBuffer = this.commandEncoder?.finish();
1610
1567
  if (commandBuffer) {
@@ -1656,7 +1613,7 @@ var __exports__ = (() => {
1656
1613
  for (const feature of WEBGPU_ALWAYS_FEATURES) {
1657
1614
  features.add(feature);
1658
1615
  }
1659
- return new import_core17.DeviceFeatures(Array.from(features));
1616
+ return new import_core17.DeviceFeatures(Array.from(features), this.props.disabledFeatures);
1660
1617
  }
1661
1618
  copyExternalImageToTexture(options) {
1662
1619
  const {