@luma.gl/webgpu 9.0.0-alpha.2 → 9.0.0-alpha.21

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 (114) hide show
  1. package/LICENSE +32 -0
  2. package/dist/adapter/helpers/accessor-to-format.js.map +1 -1
  3. package/dist/adapter/helpers/convert-texture-format.d.ts +1 -1
  4. package/dist/adapter/helpers/convert-texture-format.js +0 -1
  5. package/dist/adapter/helpers/convert-texture-format.js.map +1 -1
  6. package/dist/adapter/helpers/generate-mipmaps.d.ts +1 -1
  7. package/dist/adapter/helpers/generate-mipmaps.js +1 -8
  8. package/dist/adapter/helpers/generate-mipmaps.js.map +1 -1
  9. package/dist/adapter/helpers/get-bind-group.d.ts +1 -1
  10. package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
  11. package/dist/adapter/helpers/get-bind-group.js +0 -9
  12. package/dist/adapter/helpers/get-bind-group.js.map +1 -1
  13. package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts +1 -1
  14. package/dist/adapter/helpers/get-vertex-buffer-layout.js +3 -17
  15. package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +1 -1
  16. package/dist/adapter/helpers/webgpu-parameters.d.ts +1 -1
  17. package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
  18. package/dist/adapter/helpers/webgpu-parameters.js +50 -47
  19. package/dist/adapter/helpers/webgpu-parameters.js.map +1 -1
  20. package/dist/adapter/resources/webgpu-buffer.d.ts +3 -4
  21. package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
  22. package/dist/adapter/resources/webgpu-buffer.js +12 -26
  23. package/dist/adapter/resources/webgpu-buffer.js.map +1 -1
  24. package/dist/adapter/resources/webgpu-command-encoder.d.ts +3 -4
  25. package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
  26. package/dist/adapter/resources/webgpu-command-encoder.js +7 -24
  27. package/dist/adapter/resources/webgpu-command-encoder.js.map +1 -1
  28. package/dist/adapter/resources/webgpu-compute-pass.d.ts +5 -5
  29. package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
  30. package/dist/adapter/resources/webgpu-compute-pass.js +11 -23
  31. package/dist/adapter/resources/webgpu-compute-pass.js.map +1 -1
  32. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +3 -3
  33. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
  34. package/dist/adapter/resources/webgpu-compute-pipeline.js +3 -7
  35. package/dist/adapter/resources/webgpu-compute-pipeline.js.map +1 -1
  36. package/dist/adapter/resources/webgpu-external-texture.d.ts +4 -4
  37. package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
  38. package/dist/adapter/resources/webgpu-external-texture.js +2 -9
  39. package/dist/adapter/resources/webgpu-external-texture.js.map +1 -1
  40. package/dist/adapter/resources/webgpu-framebuffer.d.ts +5 -5
  41. package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
  42. package/dist/adapter/resources/webgpu-framebuffer.js +12 -30
  43. package/dist/adapter/resources/webgpu-framebuffer.js.map +1 -1
  44. package/dist/adapter/resources/webgpu-query.js.map +1 -1
  45. package/dist/adapter/resources/webgpu-render-pass.d.ts +5 -5
  46. package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
  47. package/dist/adapter/resources/webgpu-render-pass.js +17 -30
  48. package/dist/adapter/resources/webgpu-render-pass.js.map +1 -1
  49. package/dist/adapter/resources/webgpu-render-pipeline.d.ts +7 -4
  50. package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
  51. package/dist/adapter/resources/webgpu-render-pipeline.js +25 -43
  52. package/dist/adapter/resources/webgpu-render-pipeline.js.map +1 -1
  53. package/dist/adapter/resources/webgpu-sampler.d.ts +3 -3
  54. package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
  55. package/dist/adapter/resources/webgpu-sampler.js +8 -7
  56. package/dist/adapter/resources/webgpu-sampler.js.map +1 -1
  57. package/dist/adapter/resources/webgpu-shader.d.ts +4 -4
  58. package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
  59. package/dist/adapter/resources/webgpu-shader.js +2 -16
  60. package/dist/adapter/resources/webgpu-shader.js.map +1 -1
  61. package/dist/adapter/resources/webgpu-texture.d.ts +4 -4
  62. package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
  63. package/dist/adapter/resources/webgpu-texture.js +4 -20
  64. package/dist/adapter/resources/webgpu-texture.js.map +1 -1
  65. package/dist/adapter/webgpu-canvas-context.d.ts +5 -7
  66. package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
  67. package/dist/adapter/webgpu-canvas-context.js +10 -31
  68. package/dist/adapter/webgpu-canvas-context.js.map +1 -1
  69. package/dist/adapter/webgpu-device.d.ts +19 -19
  70. package/dist/adapter/webgpu-device.d.ts.map +1 -1
  71. package/dist/adapter/webgpu-device.js +42 -71
  72. package/dist/adapter/webgpu-device.js.map +1 -1
  73. package/dist/adapter/webgpu-types.js.map +1 -1
  74. package/dist/dist.dev.js +3060 -0
  75. package/dist/glsl/glsllang.js +0 -1
  76. package/dist/glsl/glsllang.js.map +1 -1
  77. package/dist/index.cjs +1442 -0
  78. package/dist/index.d.ts +5 -7
  79. package/dist/index.d.ts.map +1 -1
  80. package/dist/index.js +5 -7
  81. package/dist/index.js.map +1 -1
  82. package/dist.min.js +17 -0
  83. package/package.json +18 -9
  84. package/src/.DS_Store +0 -0
  85. package/src/adapter/.DS_Store +0 -0
  86. package/src/adapter/helpers/generate-mipmaps.ts +1 -1
  87. package/src/adapter/helpers/get-bind-group.ts +4 -4
  88. package/src/adapter/helpers/get-vertex-buffer-layout.ts +3 -3
  89. package/src/adapter/helpers/webgpu-parameters.ts +55 -46
  90. package/src/adapter/resources/webgpu-buffer.ts +6 -10
  91. package/src/adapter/resources/webgpu-command-encoder.ts +22 -20
  92. package/src/adapter/resources/webgpu-compute-pass.ts +12 -12
  93. package/src/adapter/resources/webgpu-compute-pipeline.ts +5 -4
  94. package/src/adapter/resources/webgpu-external-texture.ts +4 -4
  95. package/src/adapter/resources/webgpu-framebuffer.ts +18 -18
  96. package/src/adapter/resources/webgpu-query.ts +2 -2
  97. package/src/adapter/resources/webgpu-render-pass.ts +15 -12
  98. package/src/adapter/resources/webgpu-render-pipeline.ts +32 -15
  99. package/src/adapter/resources/webgpu-sampler.ts +11 -4
  100. package/src/adapter/resources/webgpu-shader.ts +7 -5
  101. package/src/adapter/resources/webgpu-texture.ts +7 -6
  102. package/src/adapter/webgpu-canvas-context.ts +16 -12
  103. package/src/adapter/webgpu-device.ts +63 -50
  104. package/src/index.ts +6 -9
  105. package/dist/bundle.d.ts +0 -2
  106. package/dist/bundle.d.ts.map +0 -1
  107. package/dist/bundle.js +0 -5
  108. package/dist/bundle.js.map +0 -1
  109. package/dist/init.d.ts +0 -2
  110. package/dist/init.d.ts.map +0 -1
  111. package/dist/init.js +0 -4
  112. package/dist/init.js.map +0 -1
  113. package/src/bundle.ts +0 -4
  114. package/src/init.ts +0 -4
@@ -1,28 +1,28 @@
1
- /// <reference types="@webgpu/types" />
1
+ /// <reference types="dist" />
2
2
  import type { DeviceProps, DeviceInfo, DeviceLimits, DeviceFeature, CanvasContextProps, BufferProps, SamplerProps, ShaderProps, TextureProps, TextureFormat, ExternalTextureProps, FramebufferProps, RenderPipelineProps, ComputePipelineProps, RenderPassProps, ComputePassProps } from '@luma.gl/api';
3
3
  import { Device } from '@luma.gl/api';
4
- import WebGPUBuffer from './resources/webgpu-buffer';
5
- import WebGPUTexture from './resources/webgpu-texture';
6
- import WebGPUExternalTexture from './resources/webgpu-external-texture';
7
- import WebGPUSampler from './resources/webgpu-sampler';
8
- import WebGPUShader from './resources/webgpu-shader';
9
- import WebGPURenderPipeline from './resources/webgpu-render-pipeline';
10
- import WebGPUFramebuffer from './resources/webgpu-framebuffer';
11
- import WebGPUComputePipeline from './resources/webgpu-compute-pipeline';
12
- import WebGPURenderPass from './resources/webgpu-render-pass';
13
- import WebGPUComputePass from './resources/webgpu-compute-pass';
14
- import WebGPUCanvasContext from './webgpu-canvas-context';
4
+ import { WebGPUBuffer } from './resources/webgpu-buffer';
5
+ import { WebGPUTexture } from './resources/webgpu-texture';
6
+ import { WebGPUExternalTexture } from './resources/webgpu-external-texture';
7
+ import { WebGPUSampler } from './resources/webgpu-sampler';
8
+ import { WebGPUShader } from './resources/webgpu-shader';
9
+ import { WebGPURenderPipeline } from './resources/webgpu-render-pipeline';
10
+ import { WebGPUFramebuffer } from './resources/webgpu-framebuffer';
11
+ import { WebGPUComputePipeline } from './resources/webgpu-compute-pipeline';
12
+ import { WebGPURenderPass } from './resources/webgpu-render-pass';
13
+ import { WebGPUComputePass } from './resources/webgpu-compute-pass';
14
+ import { WebGPUCanvasContext } from './webgpu-canvas-context';
15
15
  /** WebGPU Device implementation */
16
- export default class WebGPUDevice extends Device {
16
+ export declare class WebGPUDevice extends Device {
17
17
  readonly handle: GPUDevice;
18
18
  readonly adapter: GPUAdapter;
19
19
  readonly lost: Promise<{
20
20
  reason: 'destroyed';
21
21
  message: string;
22
22
  }>;
23
- canvasContext: WebGPUCanvasContext | undefined;
24
- commandEncoder: GPUCommandEncoder;
25
- renderPass: WebGPURenderPass;
23
+ canvasContext: WebGPUCanvasContext | null;
24
+ commandEncoder: GPUCommandEncoder | null;
25
+ renderPass: WebGPURenderPass | null;
26
26
  private _info;
27
27
  private _isLost;
28
28
  static type: string;
@@ -52,9 +52,9 @@ export default class WebGPUDevice extends Device {
52
52
  * Allows a render pass to begin against a canvas context
53
53
  * @todo need to support a "Framebuffer" equivalent (aka preconfigured RenderPassDescriptors?).
54
54
  */
55
- beginRenderPass(props?: RenderPassProps): WebGPURenderPass;
56
- beginComputePass(props?: ComputePassProps): WebGPUComputePass;
57
- createCanvasContext(props?: CanvasContextProps): WebGPUCanvasContext;
55
+ beginRenderPass(props: RenderPassProps): WebGPURenderPass;
56
+ beginComputePass(props: ComputePassProps): WebGPUComputePass;
57
+ createCanvasContext(props: CanvasContextProps): WebGPUCanvasContext;
58
58
  /**
59
59
  * Gets default renderpass encoder.
60
60
  * Creates a new encoder against default canvasContext if not already created
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-device.d.ts","sourceRoot":"","sources":["../../src/adapter/webgpu-device.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,MAAM,EAA2B,MAAM,cAAc,CAAC;AAC9D,OAAO,YAAY,MAAM,2BAA2B,CAAC;AACrD,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,qBAAqB,MAAM,qCAAqC,CAAC;AACxE,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,YAAY,MAAM,2BAA2B,CAAC;AACrD,OAAO,oBAAoB,MAAM,oCAAoC,CAAC;AACtE,OAAO,iBAAiB,MAAM,gCAAgC,CAAC;AAC/D,OAAO,qBAAqB,MAAM,qCAAqC,CAAC;AACxE,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAC9D,OAAO,iBAAiB,MAAM,iCAAiC,CAAC;AAEhE,OAAO,mBAAmB,MAAM,yBAAyB,CAAC;AAG1D,mCAAmC;AACnC,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,MAAM;IAC9C,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,WAAW,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;IAC/D,aAAa,EAAE,mBAAmB,GAAG,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AAY,GAAG,aAAa;IAIjD,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,GAAG,oBAAoB;IAItE,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,iBAAiB;IAI7D,qBAAqB,CAAC,KAAK,EAAE,oBAAoB,GAAG,qBAAqB;IAMzE;;;OAGG;IACH,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB;IAKzD,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,GAAG,iBAAiB;IAK5D,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,GAAG,mBAAmB;IAInE;;;;OAIG;IACH,oBAAoB,IAAI,gBAAgB;IASxC,MAAM,IAAI,IAAI;IAUd,YAAY;CAsDb"}
@@ -1,73 +1,64 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { Device, CanvasContext, log } from '@luma.gl/api';
3
- import WebGPUBuffer from './resources/webgpu-buffer';
4
- import WebGPUTexture from './resources/webgpu-texture';
5
- import WebGPUExternalTexture from './resources/webgpu-external-texture';
6
- import WebGPUSampler from './resources/webgpu-sampler';
7
- import WebGPUShader from './resources/webgpu-shader';
8
- import WebGPURenderPipeline from './resources/webgpu-render-pipeline';
9
- import WebGPUComputePipeline from './resources/webgpu-compute-pipeline';
10
- import WebGPURenderPass from './resources/webgpu-render-pass';
11
- import WebGPUComputePass from './resources/webgpu-compute-pass';
12
- import WebGPUCanvasContext from './webgpu-canvas-context';
13
- export default class WebGPUDevice extends Device {
2
+ import { Device, CanvasContext, log, uid } from '@luma.gl/api';
3
+ import { WebGPUBuffer } from "./resources/webgpu-buffer.js";
4
+ import { WebGPUTexture } from "./resources/webgpu-texture.js";
5
+ import { WebGPUExternalTexture } from "./resources/webgpu-external-texture.js";
6
+ import { WebGPUSampler } from "./resources/webgpu-sampler.js";
7
+ import { WebGPUShader } from "./resources/webgpu-shader.js";
8
+ import { WebGPURenderPipeline } from "./resources/webgpu-render-pipeline.js";
9
+ import { WebGPUComputePipeline } from "./resources/webgpu-compute-pipeline.js";
10
+ import { WebGPURenderPass } from "./resources/webgpu-render-pass.js";
11
+ import { WebGPUComputePass } from "./resources/webgpu-compute-pass.js";
12
+ import { WebGPUCanvasContext } from "./webgpu-canvas-context.js";
13
+ export class WebGPUDevice extends Device {
14
14
  static isSupported() {
15
15
  return Boolean(typeof navigator !== 'undefined' && navigator.gpu);
16
16
  }
17
-
18
17
  static async create(props) {
19
18
  if (!navigator.gpu) {
20
19
  throw new Error('WebGPU not available. Open in Chrome Canary and turn on chrome://flags/#enable-unsafe-webgpu');
21
20
  }
22
-
23
21
  log.groupCollapsed(1, 'WebGPUDevice created')();
24
22
  const adapter = await navigator.gpu.requestAdapter({
25
- powerPreference: "high-performance"
23
+ powerPreference: 'high-performance'
26
24
  });
27
- log.probe(1, "Adapter available")();
25
+ if (!adapter) {
26
+ throw new Error('Failed to request WebGPU adapter');
27
+ }
28
+ log.probe(1, 'Adapter available')();
28
29
  const gpuDevice = await adapter.requestDevice({
29
30
  requiredFeatures: adapter.features
30
31
  });
31
- log.probe(1, "GPUDevice available")();
32
-
32
+ log.probe(1, 'GPUDevice available')();
33
33
  if (typeof props.canvas === 'string') {
34
34
  await CanvasContext.pageLoaded;
35
- log.probe(1, "DOM is loaded")();
35
+ log.probe(1, 'DOM is loaded')();
36
36
  }
37
-
38
37
  const device = new WebGPUDevice(gpuDevice, adapter, props);
39
- log.probe(1, "Device created", device.info)();
38
+ log.probe(1, 'Device created', device.info)();
40
39
  log.table(1, device.info)();
41
40
  log.groupEnd(1)();
42
41
  return device;
43
42
  }
44
-
45
43
  constructor(device, adapter, props) {
46
- super(props);
47
-
44
+ super({
45
+ ...props,
46
+ id: props.id || uid('webgpu-device')
47
+ });
48
48
  _defineProperty(this, "handle", void 0);
49
-
50
49
  _defineProperty(this, "adapter", void 0);
51
-
52
50
  _defineProperty(this, "lost", void 0);
53
-
54
- _defineProperty(this, "canvasContext", void 0);
55
-
56
- _defineProperty(this, "commandEncoder", void 0);
57
-
58
- _defineProperty(this, "renderPass", void 0);
59
-
51
+ _defineProperty(this, "canvasContext", null);
52
+ _defineProperty(this, "commandEncoder", null);
53
+ _defineProperty(this, "renderPass", null);
60
54
  _defineProperty(this, "_info", void 0);
61
-
62
55
  _defineProperty(this, "_isLost", false);
63
-
64
56
  _defineProperty(this, "features", void 0);
65
-
66
57
  this.handle = device;
67
58
  this.adapter = adapter;
68
59
  this._info = {
69
60
  type: 'webgpu',
70
- vendor: this.adapter.name,
61
+ vendor: this.adapter.__brand,
71
62
  renderer: '',
72
63
  version: '',
73
64
  gpu: 'unknown',
@@ -79,121 +70,103 @@ export default class WebGPUDevice extends Device {
79
70
  vendorMasked: '',
80
71
  rendererMasked: ''
81
72
  };
82
- this.lost = this.handle.lost;
83
- this.lost.then(_ => {
73
+ this.lost = new Promise(async resolve => {
74
+ const lostInfo = await this.handle.lost;
84
75
  this._isLost = true;
76
+ resolve({
77
+ reason: 'destroyed',
78
+ message: lostInfo.message
79
+ });
85
80
  });
86
-
87
81
  if (props.canvas) {
88
82
  this.canvasContext = new WebGPUCanvasContext(this, this.adapter, {
89
83
  canvas: props.canvas
90
84
  });
91
85
  }
92
-
93
86
  this.features = this._getFeatures();
94
87
  }
95
-
96
88
  destroy() {
97
89
  this.handle.destroy();
98
90
  }
99
-
100
91
  get info() {
101
92
  return this._info;
102
93
  }
103
-
104
94
  get limits() {
105
95
  return this.handle.limits;
106
96
  }
107
-
108
97
  isTextureFormatSupported(format) {
109
98
  return !format.includes('webgl');
110
99
  }
111
-
112
100
  isTextureFormatFilterable(format) {
113
101
  return this.isTextureFormatSupported(format);
114
102
  }
115
-
116
103
  isTextureFormatRenderable(format) {
117
104
  return this.isTextureFormatSupported(format);
118
105
  }
119
-
120
106
  get isLost() {
121
107
  return this._isLost;
122
108
  }
123
-
124
109
  _createBuffer(props) {
125
110
  return new WebGPUBuffer(this, props);
126
111
  }
127
-
128
112
  _createTexture(props) {
129
113
  return new WebGPUTexture(this, props);
130
114
  }
131
-
132
115
  createExternalTexture(props) {
133
116
  return new WebGPUExternalTexture(this, props);
134
117
  }
135
-
136
118
  createShader(props) {
137
119
  return new WebGPUShader(this, props);
138
120
  }
139
-
140
121
  createSampler(props) {
141
122
  return new WebGPUSampler(this, props);
142
123
  }
143
-
144
124
  createRenderPipeline(props) {
145
125
  return new WebGPURenderPipeline(this, props);
146
126
  }
147
-
148
127
  createFramebuffer(props) {
149
128
  throw new Error('Not implemented');
150
129
  }
151
-
152
130
  createComputePipeline(props) {
153
131
  return new WebGPUComputePipeline(this, props);
154
132
  }
155
-
156
133
  beginRenderPass(props) {
157
134
  this.commandEncoder = this.commandEncoder || this.handle.createCommandEncoder();
158
135
  return new WebGPURenderPass(this, props);
159
136
  }
160
-
161
137
  beginComputePass(props) {
162
138
  this.commandEncoder = this.commandEncoder || this.handle.createCommandEncoder();
163
139
  return new WebGPUComputePass(this, props);
164
140
  }
165
-
166
141
  createCanvasContext(props) {
167
142
  return new WebGPUCanvasContext(this, this.adapter, props);
168
143
  }
169
-
170
144
  getDefaultRenderPass() {
145
+ var _this$canvasContext;
171
146
  this.renderPass = this.renderPass || this.beginRenderPass({
172
- framebuffer: this.canvasContext.getCurrentFramebuffer()
147
+ framebuffer: (_this$canvasContext = this.canvasContext) === null || _this$canvasContext === void 0 ? void 0 : _this$canvasContext.getCurrentFramebuffer()
173
148
  });
174
149
  return this.renderPass;
175
150
  }
176
-
177
151
  submit() {
178
- this.renderPass.endPass();
179
- const commandBuffer = this.commandEncoder.finish();
180
- this.handle.queue.submit([commandBuffer]);
152
+ var _this$renderPass, _this$commandEncoder;
153
+ (_this$renderPass = this.renderPass) === null || _this$renderPass === void 0 ? void 0 : _this$renderPass.end();
154
+ const commandBuffer = (_this$commandEncoder = this.commandEncoder) === null || _this$commandEncoder === void 0 ? void 0 : _this$commandEncoder.finish();
155
+ if (commandBuffer) {
156
+ this.handle.queue.submit([commandBuffer]);
157
+ }
181
158
  this.commandEncoder = null;
182
159
  this.renderPass = null;
183
160
  }
184
-
185
161
  _getFeatures() {
186
162
  const features = new Set(this.handle.features);
187
-
188
163
  if (features.has('depth-clamping')) {
189
164
  features.delete('depth-clamping');
190
165
  features.add('depth-clip-control');
191
166
  }
192
-
193
167
  if (features.has('texture-compression-bc')) {
194
168
  features.add('texture-compression-bc5-webgl');
195
169
  }
196
-
197
170
  features.add('webgpu');
198
171
  features.add('timer-query-webgl');
199
172
  features.add('vertex-array-object-webgl1');
@@ -218,8 +191,6 @@ export default class WebGPUDevice extends Device {
218
191
  features.add('glsl-texture-lod');
219
192
  return features;
220
193
  }
221
-
222
194
  }
223
-
224
195
  _defineProperty(WebGPUDevice, "type", 'webgpu');
225
196
  //# sourceMappingURL=webgpu-device.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/adapter/webgpu-device.ts"],"names":["Device","CanvasContext","log","WebGPUBuffer","WebGPUTexture","WebGPUExternalTexture","WebGPUSampler","WebGPUShader","WebGPURenderPipeline","WebGPUComputePipeline","WebGPURenderPass","WebGPUComputePass","WebGPUCanvasContext","WebGPUDevice","isSupported","Boolean","navigator","gpu","create","props","Error","groupCollapsed","adapter","requestAdapter","powerPreference","probe","gpuDevice","requestDevice","requiredFeatures","features","canvas","pageLoaded","device","info","table","groupEnd","constructor","handle","_info","type","vendor","name","renderer","version","shadingLanguages","shadingLanguageVersions","glsl","wgsl","vendorMasked","rendererMasked","lost","then","_","_isLost","canvasContext","_getFeatures","destroy","limits","isTextureFormatSupported","format","includes","isTextureFormatFilterable","isTextureFormatRenderable","isLost","_createBuffer","_createTexture","createExternalTexture","createShader","createSampler","createRenderPipeline","createFramebuffer","createComputePipeline","beginRenderPass","commandEncoder","createCommandEncoder","beginComputePass","createCanvasContext","getDefaultRenderPass","renderPass","framebuffer","getCurrentFramebuffer","submit","endPass","commandBuffer","finish","queue","Set","has","delete","add"],"mappings":";AAoBA,SAAQA,MAAR,EAAgBC,aAAhB,EAA+BC,GAA/B,QAA+C,cAA/C;AACA,OAAOC,YAA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,CAAa,qCAAb;AACA5D,IAAAA,QAAQ,CAAC4D,GAAT,CAAa,kCAAb;AAGA5D,IAAAA,QAAQ,CAAC4D,GAAT,CAAa,sCAAb;AACA5D,IAAAA,QAAQ,CAAC4D,GAAT,CAAa,kCAAb;AACA5D,IAAAA,QAAQ,CAAC4D,GAAT,CAAa,kCAAb;AAGA5D,IAAAA,QAAQ,CAAC4D,GAAT,CAAa,gBAAb;AACA5D,IAAAA,QAAQ,CAAC4D,GAAT,CAAa,iBAAb;AACA5D,IAAAA,QAAQ,CAAC4D,GAAT,CAAa,kBAAb;AACA5D,IAAAA,QAAQ,CAAC4D,GAAT,CAAa,kBAAb;AAEA,WAAO5D,QAAP;AACD;;AApP8C;;gBAA5BhB,Y,UAYG,Q","sourcesContent":["/// <reference types=\"@webgpu/types\" />\n\nimport type {\n DeviceProps,\n DeviceInfo,\n DeviceLimits,\n DeviceFeature,\n CanvasContextProps,\n BufferProps,\n SamplerProps,\n ShaderProps,\n TextureProps,\n TextureFormat,\n ExternalTextureProps,\n FramebufferProps,\n RenderPipelineProps,\n ComputePipelineProps,\n RenderPassProps,\n ComputePassProps\n} from '@luma.gl/api';\nimport {Device, CanvasContext, log, cast} from '@luma.gl/api';\nimport WebGPUBuffer from './resources/webgpu-buffer';\nimport WebGPUTexture from './resources/webgpu-texture';\nimport WebGPUExternalTexture from './resources/webgpu-external-texture';\nimport WebGPUSampler from './resources/webgpu-sampler';\nimport WebGPUShader from './resources/webgpu-shader';\nimport WebGPURenderPipeline from './resources/webgpu-render-pipeline';\nimport WebGPUFramebuffer from './resources/webgpu-framebuffer';\nimport WebGPUComputePipeline from './resources/webgpu-compute-pipeline';\nimport WebGPURenderPass from './resources/webgpu-render-pass';\nimport WebGPUComputePass from './resources/webgpu-compute-pass';\n\nimport WebGPUCanvasContext from './webgpu-canvas-context';\n// import {loadGlslangModule} from '../glsl/glslang';\n\n/** WebGPU Device implementation */\nexport default class WebGPUDevice extends Device {\n readonly handle: GPUDevice;\n readonly adapter: GPUAdapter;\n readonly lost: Promise<{reason: 'destroyed', message: string}>;\n canvasContext: WebGPUCanvasContext | undefined;\n\n commandEncoder: GPUCommandEncoder;\n renderPass: WebGPURenderPass;\n\n private _info: DeviceInfo;\n private _isLost: boolean = false;\n\n static type: string = 'webgpu';\n\n /** Check if WebGPU is available */\n static isSupported(): boolean {\n return Boolean(typeof navigator !== 'undefined' && navigator.gpu);\n }\n\n static async create(props: DeviceProps): Promise<WebGPUDevice> {\n if (!navigator.gpu) {\n throw new Error('WebGPU not available. Open in Chrome Canary and turn on chrome://flags/#enable-unsafe-webgpu');\n }\n log.groupCollapsed(1, 'WebGPUDevice created')();\n const adapter = await navigator.gpu.requestAdapter({\n powerPreference: \"high-performance\"\n // forceSoftware: false\n });\n log.probe(1, \"Adapter available\")();\n\n const gpuDevice = await adapter.requestDevice({\n requiredFeatures: adapter.features as ReadonlySet<GPUFeatureName>,\n // TODO ensure we obtain best limits\n // requiredLimits: adapter.limits\n });\n log.probe(1, \"GPUDevice available\")();\n\n if (typeof props.canvas === 'string') {\n await CanvasContext.pageLoaded;\n log.probe(1, \"DOM is loaded\")();\n }\n\n const device = new WebGPUDevice(gpuDevice, adapter, props);\n log.probe(1, \"Device created\", device.info)();\n log.table(1, device.info)();\n log.groupEnd(1)();\n return device;\n }\n\n constructor(device: GPUDevice, adapter: GPUAdapter, props: DeviceProps) {\n super(props);\n this.handle = device;\n this.adapter = adapter;\n\n this._info = {\n type: 'webgpu',\n vendor: this.adapter.name,\n renderer: '',\n version: '',\n gpu: 'unknown', // 'nvidia' | 'amd' | 'intel' | 'apple' | 'unknown',\n shadingLanguages: ['glsl', 'wgsl'],\n shadingLanguageVersions: {\n glsl: '450',\n wgsl: '100'\n },\n vendorMasked: '',\n rendererMasked: ''\n };\n\n this.lost = this.handle.lost;\n this.lost.then(_ => {\n this._isLost = true;\n });\n\n // Note: WebGPU devices can be created without a canvas, for compute shader purposes\n if (props.canvas) {\n this.canvasContext = new WebGPUCanvasContext(this, this.adapter, {canvas: props.canvas});\n }\n\n this.features = this._getFeatures();\n }\n\n // TODO\n // Load the glslang module now so that it is available synchronously when compiling shaders\n // const {glsl = true} = props;\n // this.glslang = glsl && await loadGlslangModule();\n\n destroy() {\n this.handle.destroy();\n }\n\n get info(): DeviceInfo {\n return this._info;\n }\n\n features: Set<DeviceFeature>;\n\n get limits(): DeviceLimits {\n return this.handle.limits;\n }\n\n isTextureFormatSupported(format: TextureFormat): boolean {\n return !format.includes('webgl');\n }\n\n /** @todo implement proper check? */\n isTextureFormatFilterable(format: TextureFormat): boolean {\n return this.isTextureFormatSupported(format); \n }\n\n /** @todo implement proper check? */\n isTextureFormatRenderable(format: TextureFormat): boolean {\n return this.isTextureFormatSupported(format); \n }\n\n get isLost(): boolean {\n return this._isLost;\n }\n\n _createBuffer(props: BufferProps): WebGPUBuffer {\n return new WebGPUBuffer(this, props);\n }\n\n _createTexture(props: TextureProps): WebGPUTexture {\n return new WebGPUTexture(this, props);\n }\n\n createExternalTexture(props: ExternalTextureProps): WebGPUExternalTexture {\n return new WebGPUExternalTexture(this, props);\n }\n\n createShader(props: ShaderProps): WebGPUShader {\n return new WebGPUShader(this, props);\n }\n\n createSampler(props: SamplerProps): WebGPUSampler {\n return new WebGPUSampler(this, props);\n }\n\n createRenderPipeline(props: RenderPipelineProps): WebGPURenderPipeline {\n return new WebGPURenderPipeline(this, props);\n }\n\n createFramebuffer(props: FramebufferProps): WebGPUFramebuffer {\n throw new Error('Not implemented');\n }\n\n createComputePipeline(props: ComputePipelineProps): WebGPUComputePipeline {\n return new WebGPUComputePipeline(this, props);\n }\n\n // WebGPU specifics\n\n /** \n * Allows a render pass to begin against a canvas context\n * @todo need to support a \"Framebuffer\" equivalent (aka preconfigured RenderPassDescriptors?).\n */\n beginRenderPass(props?: RenderPassProps): WebGPURenderPass {\n this.commandEncoder = this.commandEncoder || this.handle.createCommandEncoder();\n return new WebGPURenderPass(this, props);\n }\n\n beginComputePass(props?: ComputePassProps): WebGPUComputePass {\n this.commandEncoder = this.commandEncoder || this.handle.createCommandEncoder();\n return new WebGPUComputePass(this, props);\n }\n\n createCanvasContext(props?: CanvasContextProps): WebGPUCanvasContext {\n return new WebGPUCanvasContext(this, this.adapter, props);\n }\n\n /** \n * Gets default renderpass encoder.\n * Creates a new encoder against default canvasContext if not already created \n * @note Called internally by Model.\n */\n getDefaultRenderPass(): WebGPURenderPass {\n this.renderPass = this.renderPass || this.beginRenderPass({\n framebuffer: this.canvasContext.getCurrentFramebuffer()\n });\n return this.renderPass;\n }\n\n submit(): void {\n this.renderPass.endPass();\n const commandBuffer = this.commandEncoder.finish();\n this.handle.queue.submit([commandBuffer]);\n this.commandEncoder = null;\n this.renderPass = null;\n }\n\n _getFeatures() {\n // WebGPU Features\n const features = new Set<DeviceFeature>(this.handle.features as Set<DeviceFeature>);\n\n // Fixups for pre-standard names: https://github.com/webgpu-native/webgpu-headers/issues/133\n // @ts-expect-error Chrome Canary v99\n if (features.has('depth-clamping')) {\n // @ts-expect-error Chrome Canary v99\n features.delete('depth-clamping');\n features.add('depth-clip-control');\n }\n\n // Add subsets\n if (features.has('texture-compression-bc')) {\n features.add('texture-compression-bc5-webgl');\n }\n\n features.add('webgpu');\n\n features.add('timer-query-webgl');\n\n // WEBGL1 SUPPORT\n features.add('vertex-array-object-webgl1');\n features.add('instanced-rendering-webgl1');\n features.add('multiple-render-targets-webgl1');\n features.add('index-uint32-webgl1');\n features.add('blend-minmax-webgl1');\n features.add('texture-blend-float-webgl1');\n \n // TEXTURES, RENDERBUFFERS\n features.add('texture-formats-srgb-webgl1');\n \n // TEXTURES\n features.add('texture-formats-depth-webgl1');\n features.add('texture-formats-float32-webgl1');\n features.add('texture-formats-float16-webgl1');\n \n features.add('texture-filter-linear-float32-webgl');\n features.add('texture-filter-linear-float16-webgl');\n features.add('texture-filter-anisotropic-webgl');\n \n // FRAMEBUFFERS, TEXTURES AND RENDERBUFFERS\n features.add('texture-renderable-rgba32float-webgl');\n features.add('texture-renderable-float32-webgl');\n features.add('texture-renderable-float16-webgl');\n \n // GLSL extensions\n features.add('glsl-frag-data');\n features.add('glsl-frag-depth');\n features.add('glsl-derivatives');\n features.add('glsl-texture-lod');\n\n return features;\n }\n}\n"],"file":"webgpu-device.js"}
1
+ {"version":3,"file":"webgpu-device.js","names":["Device","CanvasContext","log","uid","WebGPUBuffer","WebGPUTexture","WebGPUExternalTexture","WebGPUSampler","WebGPUShader","WebGPURenderPipeline","WebGPUComputePipeline","WebGPURenderPass","WebGPUComputePass","WebGPUCanvasContext","WebGPUDevice","isSupported","Boolean","navigator","gpu","create","props","Error","groupCollapsed","adapter","requestAdapter","powerPreference","probe","gpuDevice","requestDevice","requiredFeatures","features","canvas","pageLoaded","device","info","table","groupEnd","constructor","id","_defineProperty","handle","_info","type","vendor","__brand","renderer","version","shadingLanguages","shadingLanguageVersions","glsl","wgsl","vendorMasked","rendererMasked","lost","Promise","resolve","lostInfo","_isLost","reason","message","canvasContext","_getFeatures","destroy","limits","isTextureFormatSupported","format","includes","isTextureFormatFilterable","isTextureFormatRenderable","isLost","_createBuffer","_createTexture","createExternalTexture","createShader","createSampler","createRenderPipeline","createFramebuffer","createComputePipeline","beginRenderPass","commandEncoder","createCommandEncoder","beginComputePass","createCanvasContext","getDefaultRenderPass","_this$canvasContext","renderPass","framebuffer","getCurrentFramebuffer","submit","_this$renderPass","_this$commandEncoder","end","commandBuffer","finish","queue","Set","has","delete","add"],"sources":["../../src/adapter/webgpu-device.ts"],"sourcesContent":["// prettier-ignore\n// / <reference types=\"@webgpu/types\" />\n\nimport type {\n DeviceProps,\n DeviceInfo,\n DeviceLimits,\n DeviceFeature,\n CanvasContextProps,\n BufferProps,\n SamplerProps,\n ShaderProps,\n TextureProps,\n TextureFormat,\n ExternalTextureProps,\n FramebufferProps,\n RenderPipelineProps,\n ComputePipelineProps,\n RenderPassProps,\n ComputePassProps\n} from '@luma.gl/api';\nimport {Device, CanvasContext, log, uid} from '@luma.gl/api';\nimport {WebGPUBuffer} from './resources/webgpu-buffer';\nimport {WebGPUTexture} from './resources/webgpu-texture';\nimport {WebGPUExternalTexture} from './resources/webgpu-external-texture';\nimport {WebGPUSampler} from './resources/webgpu-sampler';\nimport {WebGPUShader} from './resources/webgpu-shader';\nimport {WebGPURenderPipeline} from './resources/webgpu-render-pipeline';\nimport {WebGPUFramebuffer} from './resources/webgpu-framebuffer';\nimport {WebGPUComputePipeline} from './resources/webgpu-compute-pipeline';\nimport {WebGPURenderPass} from './resources/webgpu-render-pass';\nimport {WebGPUComputePass} from './resources/webgpu-compute-pass';\n\nimport {WebGPUCanvasContext} from './webgpu-canvas-context';\n// import {loadGlslangModule} from '../glsl/glslang';\n\n/** WebGPU Device implementation */\nexport class WebGPUDevice extends Device {\n readonly handle: GPUDevice;\n readonly adapter: GPUAdapter;\n readonly lost: Promise<{reason: 'destroyed'; message: string}>;\n canvasContext: WebGPUCanvasContext | null = null;\n\n commandEncoder: GPUCommandEncoder | null = null;\n renderPass: WebGPURenderPass | null = null;\n\n private _info: DeviceInfo;\n private _isLost: boolean = false;\n\n static type: string = 'webgpu';\n\n /** Check if WebGPU is available */\n static isSupported(): boolean {\n return Boolean(typeof navigator !== 'undefined' && navigator.gpu);\n }\n\n static async create(props: DeviceProps): Promise<WebGPUDevice> {\n if (!navigator.gpu) {\n throw new Error(\n 'WebGPU not available. Open in Chrome Canary and turn on chrome://flags/#enable-unsafe-webgpu'\n );\n }\n log.groupCollapsed(1, 'WebGPUDevice created')();\n const adapter = await navigator.gpu.requestAdapter({\n powerPreference: 'high-performance'\n // forceSoftware: false\n });\n if (!adapter) {\n throw new Error('Failed to request WebGPU adapter');\n }\n\n log.probe(1, 'Adapter available')();\n\n const gpuDevice = await adapter.requestDevice({\n requiredFeatures: adapter.features as ReadonlySet<GPUFeatureName>\n // TODO ensure we obtain best limits\n // requiredLimits: adapter.limits\n });\n log.probe(1, 'GPUDevice available')();\n\n if (typeof props.canvas === 'string') {\n await CanvasContext.pageLoaded;\n log.probe(1, 'DOM is loaded')();\n }\n\n const device = new WebGPUDevice(gpuDevice, adapter, props);\n log.probe(1, 'Device created', device.info)();\n log.table(1, device.info)();\n log.groupEnd(1)();\n return device;\n }\n\n constructor(device: GPUDevice, adapter: GPUAdapter, props: DeviceProps) {\n super({...props, id: props.id || uid('webgpu-device')});\n this.handle = device;\n this.adapter = adapter;\n\n this._info = {\n type: 'webgpu',\n vendor: this.adapter.__brand,\n renderer: '',\n version: '',\n gpu: 'unknown', // 'nvidia' | 'amd' | 'intel' | 'apple' | 'unknown',\n shadingLanguages: ['glsl', 'wgsl'],\n shadingLanguageVersions: {\n glsl: '450',\n wgsl: '100'\n },\n vendorMasked: '',\n rendererMasked: ''\n };\n\n // \"Context\" loss handling\n this.lost = new Promise<{reason: 'destroyed'; message: string}>(async (resolve) => {\n const lostInfo = await this.handle.lost;\n this._isLost = true;\n resolve({reason: 'destroyed', message: lostInfo.message});\n });\n\n // Note: WebGPU devices can be created without a canvas, for compute shader purposes\n if (props.canvas) {\n this.canvasContext = new WebGPUCanvasContext(this, this.adapter, {canvas: props.canvas});\n }\n\n this.features = this._getFeatures();\n }\n\n // TODO\n // Load the glslang module now so that it is available synchronously when compiling shaders\n // const {glsl = true} = props;\n // this.glslang = glsl && await loadGlslangModule();\n\n destroy(): void {\n this.handle.destroy();\n }\n\n get info(): DeviceInfo {\n return this._info;\n }\n\n features: Set<DeviceFeature>;\n\n get limits(): DeviceLimits {\n return this.handle.limits;\n }\n\n isTextureFormatSupported(format: TextureFormat): boolean {\n return !format.includes('webgl');\n }\n\n /** @todo implement proper check? */\n isTextureFormatFilterable(format: TextureFormat): boolean {\n return this.isTextureFormatSupported(format);\n }\n\n /** @todo implement proper check? */\n isTextureFormatRenderable(format: TextureFormat): boolean {\n return this.isTextureFormatSupported(format);\n }\n\n get isLost(): boolean {\n return this._isLost;\n }\n\n _createBuffer(props: BufferProps): WebGPUBuffer {\n return new WebGPUBuffer(this, props);\n }\n\n _createTexture(props: TextureProps): WebGPUTexture {\n return new WebGPUTexture(this, props);\n }\n\n createExternalTexture(props: ExternalTextureProps): WebGPUExternalTexture {\n return new WebGPUExternalTexture(this, props);\n }\n\n createShader(props: ShaderProps): WebGPUShader {\n return new WebGPUShader(this, props);\n }\n\n createSampler(props: SamplerProps): WebGPUSampler {\n return new WebGPUSampler(this, props);\n }\n\n createRenderPipeline(props: RenderPipelineProps): WebGPURenderPipeline {\n return new WebGPURenderPipeline(this, props);\n }\n\n createFramebuffer(props: FramebufferProps): WebGPUFramebuffer {\n throw new Error('Not implemented');\n }\n\n createComputePipeline(props: ComputePipelineProps): WebGPUComputePipeline {\n return new WebGPUComputePipeline(this, props);\n }\n\n // WebGPU specifics\n\n /**\n * Allows a render pass to begin against a canvas context\n * @todo need to support a \"Framebuffer\" equivalent (aka preconfigured RenderPassDescriptors?).\n */\n beginRenderPass(props: RenderPassProps): WebGPURenderPass {\n this.commandEncoder = this.commandEncoder || this.handle.createCommandEncoder();\n return new WebGPURenderPass(this, props);\n }\n\n beginComputePass(props: ComputePassProps): WebGPUComputePass {\n this.commandEncoder = this.commandEncoder || this.handle.createCommandEncoder();\n return new WebGPUComputePass(this, props);\n }\n\n createCanvasContext(props: CanvasContextProps): WebGPUCanvasContext {\n return new WebGPUCanvasContext(this, this.adapter, props);\n }\n\n /**\n * Gets default renderpass encoder.\n * Creates a new encoder against default canvasContext if not already created\n * @note Called internally by Model.\n */\n getDefaultRenderPass(): WebGPURenderPass {\n this.renderPass =\n this.renderPass ||\n this.beginRenderPass({\n framebuffer: this.canvasContext?.getCurrentFramebuffer()\n });\n return this.renderPass;\n }\n\n submit(): void {\n this.renderPass?.end();\n const commandBuffer = this.commandEncoder?.finish();\n if (commandBuffer) {\n this.handle.queue.submit([commandBuffer]);\n }\n this.commandEncoder = null;\n this.renderPass = null;\n }\n\n _getFeatures() {\n // WebGPU Features\n const features = new Set<DeviceFeature>(this.handle.features as Set<DeviceFeature>);\n\n // Fixups for pre-standard names: https://github.com/webgpu-native/webgpu-headers/issues/133\n // @ts-expect-error Chrome Canary v99\n if (features.has('depth-clamping')) {\n // @ts-expect-error Chrome Canary v99\n features.delete('depth-clamping');\n features.add('depth-clip-control');\n }\n\n // Add subsets\n if (features.has('texture-compression-bc')) {\n features.add('texture-compression-bc5-webgl');\n }\n\n features.add('webgpu');\n\n features.add('timer-query-webgl');\n\n // WEBGL1 SUPPORT\n features.add('vertex-array-object-webgl1');\n features.add('instanced-rendering-webgl1');\n features.add('multiple-render-targets-webgl1');\n features.add('index-uint32-webgl1');\n features.add('blend-minmax-webgl1');\n features.add('texture-blend-float-webgl1');\n\n // TEXTURES, RENDERBUFFERS\n features.add('texture-formats-srgb-webgl1');\n\n // TEXTURES\n features.add('texture-formats-depth-webgl1');\n features.add('texture-formats-float32-webgl1');\n features.add('texture-formats-float16-webgl1');\n\n features.add('texture-filter-linear-float32-webgl');\n features.add('texture-filter-linear-float16-webgl');\n features.add('texture-filter-anisotropic-webgl');\n\n // FRAMEBUFFERS, TEXTURES AND RENDERBUFFERS\n features.add('texture-renderable-rgba32float-webgl');\n features.add('texture-renderable-float32-webgl');\n features.add('texture-renderable-float16-webgl');\n\n // GLSL extensions\n features.add('glsl-frag-data');\n features.add('glsl-frag-depth');\n features.add('glsl-derivatives');\n features.add('glsl-texture-lod');\n\n return features;\n }\n}\n"],"mappings":";AAqBA,SAAQA,MAAM,EAAEC,aAAa,EAAEC,GAAG,EAAEC,GAAG,QAAO,cAAc;AAAC,SACrDC,YAAY;AAAA,SACZC,aAAa;AAAA,SACbC,qBAAqB;AAAA,SACrBC,aAAa;AAAA,SACbC,YAAY;AAAA,SACZC,oBAAoB;AAAA,SAEpBC,qBAAqB;AAAA,SACrBC,gBAAgB;AAAA,SAChBC,iBAAiB;AAAA,SAEjBC,mBAAmB;AAI3B,OAAO,MAAMC,YAAY,SAASd,MAAM,CAAC;EAevC,OAAOe,WAAWA,CAAA,EAAY;IAC5B,OAAOC,OAAO,CAAC,OAAOC,SAAS,KAAK,WAAW,IA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AC,gCAAgC,CAAC;IAE9CpE,QAAQ,CAACoE,GAAG,CAAC,qCAAqC,CAAC;IACnDpE,QAAQ,CAACoE,GAAG,CAAC,qCAAqC,CAAC;IACnDpE,QAAQ,CAACoE,GAAG,CAAC,kCAAkC,CAAC;IAGhDpE,QAAQ,CAACoE,GAAG,CAAC,sCAAsC,CAAC;IACpDpE,QAAQ,CAACoE,GAAG,CAAC,kCAAkC,CAAC;IAChDpE,QAAQ,CAACoE,GAAG,CAAC,kCAAkC,CAAC;IAGhDpE,QAAQ,CAACoE,GAAG,CAAC,gBAAgB,CAAC;IAC9BpE,QAAQ,CAACoE,GAAG,CAAC,iBAAiB,CAAC;IAC/BpE,QAAQ,CAACoE,GAAG,CAAC,kBAAkB,CAAC;IAChCpE,QAAQ,CAACoE,GAAG,CAAC,kBAAkB,CAAC;IAEhC,OAAOpE,QAAQ;EACjB;AACF;AAACS,eAAA,CAjQYzB,YAAY,UAYD,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"webgpu-types.js"}
1
+ {"version":3,"file":"webgpu-types.js","names":[],"sources":["../../src/adapter/webgpu-types.ts"],"sourcesContent":[""],"mappings":""}