@antv/g-webgpu 1.2.2 → 1.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.
@@ -1,6 +1,9 @@
1
1
  import type { RendererPlugin, Syringe } from '@antv/g';
2
+ import type * as DeviceRenderer from '@antv/g-plugin-device-renderer';
2
3
  export declare class ContextRegisterPlugin implements RendererPlugin {
4
+ private rendererPlugin;
3
5
  name: string;
6
+ constructor(rendererPlugin: DeviceRenderer.Plugin);
4
7
  init(container: Syringe.Container): void;
5
8
  destroy(container: Syringe.Container): void;
6
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ContextRegisterPlugin.d.ts","sourceRoot":"","sources":["../src/ContextRegisterPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAWvD,qBAAa,qBAAsB,YAAW,cAAc;IAC1D,IAAI,SAA6B;IACjC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,GAAG,IAAI;IAGxC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,GAAG,IAAI;CAG5C"}
1
+ {"version":3,"file":"ContextRegisterPlugin.d.ts","sourceRoot":"","sources":["../src/ContextRegisterPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvD,OAAO,KAAK,KAAK,cAAc,MAAM,gCAAgC,CAAC;AAWtE,qBAAa,qBAAsB,YAAW,cAAc;IAE9C,OAAO,CAAC,cAAc;IADlC,IAAI,SAA6B;gBACb,cAAc,EAAE,cAAc,CAAC,MAAM;IAEzD,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,GAAG,IAAI;IAMxC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,GAAG,IAAI;CAI5C"}
@@ -0,0 +1,20 @@
1
+ /// <reference types="@webgpu/types" />
2
+ import type { CanvasLike, DataURLOptions } from '@antv/g';
3
+ import { ContextService } from '@antv/g';
4
+ export declare class WebGPUContextService implements ContextService<GPUCanvasContext> {
5
+ private $container;
6
+ private $canvas;
7
+ private dpr;
8
+ private canvasConfig;
9
+ private deviceRendererPlugin;
10
+ init(): Promise<void>;
11
+ getDomElement(): CanvasLike;
12
+ getContext(): GPUCanvasContext;
13
+ getBoundingClientRect(): DOMRect;
14
+ destroy(): void;
15
+ resize(width: number, height: number): void;
16
+ getDPR(): number;
17
+ applyCursorStyle(cursor: string): void;
18
+ toDataURL(options: Partial<DataURLOptions>): Promise<string>;
19
+ }
20
+ //# sourceMappingURL=WebGPUContextService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebGPUContextService.d.ts","sourceRoot":"","sources":["../src/WebGPUContextService.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAEL,cAAc,EAMf,MAAM,SAAS,CAAC;AAIjB,qBACa,oBAAqB,YAAW,cAAc,CAAC,gBAAgB,CAAC;IAC3E,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,GAAG,CAAS;IAGpB,OAAO,CAAC,YAAY,CAAe;IAGnC,OAAO,CAAC,oBAAoB,CAAwB;IAE9C,IAAI;IAgCV,aAAa;IAIb,UAAU;IAKV,qBAAqB;IAMrB,OAAO;IAQP,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAapC,MAAM;IAIN,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAMzB,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC;CAGjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,cAAc,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,cAAc,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,YAAY,MAAM,8BAA8B,CAAC;AAE7D,OAAO,KAAK,YAAY,MAAM,8BAA8B,CAAC;AAG7D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;AAEtE,aAAK,oBAAoB,GAAG,cAAc,CAAC;AAE3C,qBAAa,QAAS,SAAQ,gBAAgB;gBAChC,MAAM,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC;CAUnD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,cAAc,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,cAAc,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,YAAY,MAAM,8BAA8B,CAAC;AAE7D,OAAO,KAAK,YAAY,MAAM,8BAA8B,CAAC;AAG7D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;AAEtE,aAAK,oBAAoB,GAAG,cAAc,CAAC;AAE3C,qBAAa,QAAS,SAAQ,gBAAgB;gBAChC,MAAM,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC;CAWnD"}
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
- import { inject, CanvasConfig, singleton, ContextService, setDOMSize, isString, isBrowser, Module, AbstractRenderer } from '@antv/g';
2
- import { Plugin as Plugin$2 } from '@antv/g-plugin-device-renderer';
1
+ import { Syringe, inject, CanvasConfig, singleton, ContextService, setDOMSize, isString, isBrowser, Module, AbstractRenderer } from '@antv/g';
2
+ import { Plugin } from '@antv/g-plugin-device-renderer';
3
3
  import * as DeviceRenderer from '@antv/g-plugin-device-renderer';
4
4
  export { DeviceRenderer };
5
5
  import { Plugin as Plugin$3 } from '@antv/g-plugin-dom-interaction';
@@ -8,8 +8,8 @@ export { DomInteraction };
8
8
  import { Plugin as Plugin$4 } from '@antv/g-plugin-html-renderer';
9
9
  import * as HTMLRenderer from '@antv/g-plugin-html-renderer';
10
10
  export { HTMLRenderer };
11
- import { Plugin } from '@antv/g-plugin-image-loader';
12
- import { Plugin as Plugin$1 } from '@antv/g-plugin-webgpu-device';
11
+ import { Plugin as Plugin$1 } from '@antv/g-plugin-image-loader';
12
+ import { Plugin as Plugin$2 } from '@antv/g-plugin-webgpu-device';
13
13
  import * as WebGPUDevice from '@antv/g-plugin-webgpu-device';
14
14
  export { WebGPUDevice };
15
15
 
@@ -409,6 +409,8 @@ function _setPrototypeOf(o, p) {
409
409
  return _setPrototypeOf(o, p);
410
410
  }
411
411
 
412
+ var DeviceRendererPlugin = Syringe.defineToken('DeviceRendererPlugin');
413
+
412
414
  /******************************************************************************
413
415
  Copyright (c) Microsoft Corporation.
414
416
 
@@ -435,16 +437,16 @@ function __metadata(metadataKey, metadataValue) {
435
437
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
436
438
  }
437
439
 
438
- var WebGLContextService = /*#__PURE__*/function () {
439
- function WebGLContextService() {
440
+ var WebGPUContextService = /*#__PURE__*/function () {
441
+ function WebGPUContextService() {
440
442
  this.$container = void 0;
441
443
  this.$canvas = void 0;
442
444
  this.dpr = void 0;
443
- this.context = void 0;
444
445
  this.canvasConfig = void 0;
446
+ this.deviceRendererPlugin = void 0;
445
447
  }
446
448
 
447
- var _proto = WebGLContextService.prototype;
449
+ var _proto = WebGPUContextService.prototype;
448
450
 
449
451
  _proto.init = /*#__PURE__*/function () {
450
452
  var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -507,7 +509,8 @@ var WebGLContextService = /*#__PURE__*/function () {
507
509
  };
508
510
 
509
511
  _proto.getContext = function getContext() {
510
- return this.context;
512
+ // @ts-ignore
513
+ return this.deviceRendererPlugin.getDevice().canvasContext;
511
514
  };
512
515
 
513
516
  _proto.getBoundingClientRect = function getBoundingClientRect() {
@@ -545,34 +548,65 @@ var WebGLContextService = /*#__PURE__*/function () {
545
548
  }
546
549
  };
547
550
 
548
- return WebGLContextService;
551
+ _proto.toDataURL = /*#__PURE__*/function () {
552
+ var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
553
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
554
+ while (1) {
555
+ switch (_context2.prev = _context2.next) {
556
+ case 0:
557
+ return _context2.abrupt("return", '');
558
+
559
+ case 1:
560
+ case "end":
561
+ return _context2.stop();
562
+ }
563
+ }
564
+ }, _callee2);
565
+ }));
566
+
567
+ function toDataURL(_x) {
568
+ return _toDataURL.apply(this, arguments);
569
+ }
570
+
571
+ return toDataURL;
572
+ }();
573
+
574
+ return WebGPUContextService;
549
575
  }();
550
576
 
551
- __decorate([inject(CanvasConfig), __metadata("design:type", Object)], WebGLContextService.prototype, "canvasConfig", void 0);
577
+ __decorate([inject(CanvasConfig), __metadata("design:type", Object)], WebGPUContextService.prototype, "canvasConfig", void 0);
552
578
 
553
- WebGLContextService = __decorate([singleton({
579
+ __decorate([inject(DeviceRendererPlugin), __metadata("design:type", Plugin)], WebGPUContextService.prototype, "deviceRendererPlugin", void 0);
580
+
581
+ WebGPUContextService = __decorate([singleton({
554
582
  token: ContextService
555
- })], WebGLContextService);
583
+ })], WebGPUContextService);
556
584
 
557
585
  var containerModule = Module(function (register) {
558
586
  /**
559
587
  * implements ContextService
560
588
  */
561
- register(WebGLContextService);
589
+ register(WebGPUContextService);
562
590
  });
563
591
  var ContextRegisterPlugin = /*#__PURE__*/function () {
564
- function ContextRegisterPlugin() {
592
+ function ContextRegisterPlugin(rendererPlugin) {
593
+ this.rendererPlugin = void 0;
565
594
  this.name = 'webgpu-context-register';
595
+ this.rendererPlugin = rendererPlugin;
566
596
  }
567
597
 
568
598
  var _proto = ContextRegisterPlugin.prototype;
569
599
 
570
600
  _proto.init = function init(container) {
601
+ container.register(DeviceRendererPlugin, {
602
+ useValue: this.rendererPlugin
603
+ });
571
604
  container.load(containerModule, true);
572
605
  };
573
606
 
574
607
  _proto.destroy = function destroy(container) {
575
608
  container.unload(containerModule);
609
+ container.remove(DeviceRendererPlugin);
576
610
  };
577
611
 
578
612
  return ContextRegisterPlugin;
@@ -585,15 +619,16 @@ var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
585
619
  var _this;
586
620
 
587
621
  _this = _AbstractRenderer.call(this, config) || this;
622
+ var deviceRendererPlugin = new Plugin();
588
623
 
589
- _this.registerPlugin(new ContextRegisterPlugin());
590
-
591
- _this.registerPlugin(new Plugin());
624
+ _this.registerPlugin(new ContextRegisterPlugin(deviceRendererPlugin));
592
625
 
593
626
  _this.registerPlugin(new Plugin$1());
594
627
 
595
628
  _this.registerPlugin(new Plugin$2());
596
629
 
630
+ _this.registerPlugin(deviceRendererPlugin);
631
+
597
632
  _this.registerPlugin(new Plugin$3());
598
633
 
599
634
  _this.registerPlugin(new Plugin$4());
package/dist/index.js CHANGED
@@ -430,6 +430,8 @@ function _setPrototypeOf(o, p) {
430
430
  return _setPrototypeOf(o, p);
431
431
  }
432
432
 
433
+ var DeviceRendererPlugin = g.Syringe.defineToken('DeviceRendererPlugin');
434
+
433
435
  /******************************************************************************
434
436
  Copyright (c) Microsoft Corporation.
435
437
 
@@ -456,16 +458,16 @@ function __metadata(metadataKey, metadataValue) {
456
458
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
457
459
  }
458
460
 
459
- var WebGLContextService = /*#__PURE__*/function () {
460
- function WebGLContextService() {
461
+ var WebGPUContextService = /*#__PURE__*/function () {
462
+ function WebGPUContextService() {
461
463
  this.$container = void 0;
462
464
  this.$canvas = void 0;
463
465
  this.dpr = void 0;
464
- this.context = void 0;
465
466
  this.canvasConfig = void 0;
467
+ this.deviceRendererPlugin = void 0;
466
468
  }
467
469
 
468
- var _proto = WebGLContextService.prototype;
470
+ var _proto = WebGPUContextService.prototype;
469
471
 
470
472
  _proto.init = /*#__PURE__*/function () {
471
473
  var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -528,7 +530,8 @@ var WebGLContextService = /*#__PURE__*/function () {
528
530
  };
529
531
 
530
532
  _proto.getContext = function getContext() {
531
- return this.context;
533
+ // @ts-ignore
534
+ return this.deviceRendererPlugin.getDevice().canvasContext;
532
535
  };
533
536
 
534
537
  _proto.getBoundingClientRect = function getBoundingClientRect() {
@@ -566,34 +569,65 @@ var WebGLContextService = /*#__PURE__*/function () {
566
569
  }
567
570
  };
568
571
 
569
- return WebGLContextService;
572
+ _proto.toDataURL = /*#__PURE__*/function () {
573
+ var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
574
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
575
+ while (1) {
576
+ switch (_context2.prev = _context2.next) {
577
+ case 0:
578
+ return _context2.abrupt("return", '');
579
+
580
+ case 1:
581
+ case "end":
582
+ return _context2.stop();
583
+ }
584
+ }
585
+ }, _callee2);
586
+ }));
587
+
588
+ function toDataURL(_x) {
589
+ return _toDataURL.apply(this, arguments);
590
+ }
591
+
592
+ return toDataURL;
593
+ }();
594
+
595
+ return WebGPUContextService;
570
596
  }();
571
597
 
572
- __decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], WebGLContextService.prototype, "canvasConfig", void 0);
598
+ __decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], WebGPUContextService.prototype, "canvasConfig", void 0);
573
599
 
574
- WebGLContextService = __decorate([g.singleton({
600
+ __decorate([g.inject(DeviceRendererPlugin), __metadata("design:type", DeviceRenderer.Plugin)], WebGPUContextService.prototype, "deviceRendererPlugin", void 0);
601
+
602
+ WebGPUContextService = __decorate([g.singleton({
575
603
  token: g.ContextService
576
- })], WebGLContextService);
604
+ })], WebGPUContextService);
577
605
 
578
606
  var containerModule = g.Module(function (register) {
579
607
  /**
580
608
  * implements ContextService
581
609
  */
582
- register(WebGLContextService);
610
+ register(WebGPUContextService);
583
611
  });
584
612
  var ContextRegisterPlugin = /*#__PURE__*/function () {
585
- function ContextRegisterPlugin() {
613
+ function ContextRegisterPlugin(rendererPlugin) {
614
+ this.rendererPlugin = void 0;
586
615
  this.name = 'webgpu-context-register';
616
+ this.rendererPlugin = rendererPlugin;
587
617
  }
588
618
 
589
619
  var _proto = ContextRegisterPlugin.prototype;
590
620
 
591
621
  _proto.init = function init(container) {
622
+ container.register(DeviceRendererPlugin, {
623
+ useValue: this.rendererPlugin
624
+ });
592
625
  container.load(containerModule, true);
593
626
  };
594
627
 
595
628
  _proto.destroy = function destroy(container) {
596
629
  container.unload(containerModule);
630
+ container.remove(DeviceRendererPlugin);
597
631
  };
598
632
 
599
633
  return ContextRegisterPlugin;
@@ -606,14 +640,15 @@ var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
606
640
  var _this;
607
641
 
608
642
  _this = _AbstractRenderer.call(this, config) || this;
643
+ var deviceRendererPlugin = new DeviceRenderer.Plugin();
609
644
 
610
- _this.registerPlugin(new ContextRegisterPlugin());
645
+ _this.registerPlugin(new ContextRegisterPlugin(deviceRendererPlugin));
611
646
 
612
647
  _this.registerPlugin(new ImageLoader.Plugin());
613
648
 
614
649
  _this.registerPlugin(new WebGPUDevice.Plugin());
615
650
 
616
- _this.registerPlugin(new DeviceRenderer.Plugin());
651
+ _this.registerPlugin(deviceRendererPlugin);
617
652
 
618
653
  _this.registerPlugin(new DomInteraction.Plugin());
619
654
 
package/dist/index.umd.js CHANGED
@@ -13942,6 +13942,10 @@
13942
13942
  picking: new RenderInstList()
13943
13943
  };
13944
13944
  this.builder = void 0;
13945
+ this.enableCapture = void 0;
13946
+ this.captureOptions = void 0;
13947
+ this.capturePromise = void 0;
13948
+ this.resolveCapturePromise = void 0;
13945
13949
  }
13946
13950
 
13947
13951
  var _proto = RenderGraphPlugin.prototype;
@@ -14184,7 +14188,22 @@
14184
14188
 
14185
14189
  renderInstManager.resetRenderInsts(); // output to screen
14186
14190
 
14187
- _this.swapChain.present();
14191
+ _this.swapChain.present(); // capture here since we don't preserve drawing buffer
14192
+
14193
+
14194
+ if (_this.enableCapture && _this.resolveCapturePromise) {
14195
+ var _this$captureOptions = _this.captureOptions,
14196
+ type = _this$captureOptions.type,
14197
+ encoderOptions = _this$captureOptions.encoderOptions;
14198
+
14199
+ var dataURL = _this.contextService.getDomElement().toDataURL(type, encoderOptions);
14200
+
14201
+ _this.resolveCapturePromise(dataURL);
14202
+
14203
+ _this.enableCapture = false;
14204
+ _this.captureOptions = undefined;
14205
+ _this.resolveCapturePromise = undefined;
14206
+ }
14188
14207
  });
14189
14208
  }
14190
14209
  /**
@@ -14200,6 +14219,39 @@
14200
14219
  });
14201
14220
  };
14202
14221
 
14222
+ _proto.toDataURL = /*#__PURE__*/function () {
14223
+ var _toDataURL = _asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee2(options) {
14224
+ var _this2 = this;
14225
+
14226
+ return _regeneratorRuntime$2().wrap(function _callee2$(_context2) {
14227
+ while (1) {
14228
+ switch (_context2.prev = _context2.next) {
14229
+ case 0:
14230
+ // trigger re-render
14231
+ this.enableCapture = true;
14232
+ this.captureOptions = options;
14233
+ this.capturePromise = new Promise(function (resolve) {
14234
+ _this2.resolveCapturePromise = function (dataURL) {
14235
+ resolve(dataURL);
14236
+ };
14237
+ });
14238
+ return _context2.abrupt("return", this.capturePromise);
14239
+
14240
+ case 4:
14241
+ case "end":
14242
+ return _context2.stop();
14243
+ }
14244
+ }
14245
+ }, _callee2, this);
14246
+ }));
14247
+
14248
+ function toDataURL(_x) {
14249
+ return _toDataURL.apply(this, arguments);
14250
+ }
14251
+
14252
+ return toDataURL;
14253
+ }();
14254
+
14203
14255
  return RenderGraphPlugin;
14204
14256
  }(), _class$1.tag = 'RenderGraph', _class$1);
14205
14257
 
@@ -14835,6 +14887,10 @@
14835
14887
  return this.container.get(RenderGraphPlugin).loadTexture(src, descriptor, successCallback);
14836
14888
  };
14837
14889
 
14890
+ _proto.toDataURL = function toDataURL(options) {
14891
+ return this.container.get(RenderGraphPlugin).toDataURL(options);
14892
+ };
14893
+
14838
14894
  return Plugin;
14839
14895
  }();
14840
14896
 
@@ -19334,16 +19390,18 @@
19334
19390
  Plugin: Plugin$4
19335
19391
  });
19336
19392
 
19337
- var WebGLContextService = /*#__PURE__*/function () {
19338
- function WebGLContextService() {
19393
+ var DeviceRendererPlugin = g.Syringe.defineToken('DeviceRendererPlugin');
19394
+
19395
+ var WebGPUContextService = /*#__PURE__*/function () {
19396
+ function WebGPUContextService() {
19339
19397
  this.$container = void 0;
19340
19398
  this.$canvas = void 0;
19341
19399
  this.dpr = void 0;
19342
- this.context = void 0;
19343
19400
  this.canvasConfig = void 0;
19401
+ this.deviceRendererPlugin = void 0;
19344
19402
  }
19345
19403
 
19346
- var _proto = WebGLContextService.prototype;
19404
+ var _proto = WebGPUContextService.prototype;
19347
19405
 
19348
19406
  _proto.init = /*#__PURE__*/function () {
19349
19407
  var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -19406,7 +19464,8 @@
19406
19464
  };
19407
19465
 
19408
19466
  _proto.getContext = function getContext() {
19409
- return this.context;
19467
+ // @ts-ignore
19468
+ return this.deviceRendererPlugin.getDevice().canvasContext;
19410
19469
  };
19411
19470
 
19412
19471
  _proto.getBoundingClientRect = function getBoundingClientRect() {
@@ -19444,34 +19503,65 @@
19444
19503
  }
19445
19504
  };
19446
19505
 
19447
- return WebGLContextService;
19506
+ _proto.toDataURL = /*#__PURE__*/function () {
19507
+ var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
19508
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
19509
+ while (1) {
19510
+ switch (_context2.prev = _context2.next) {
19511
+ case 0:
19512
+ return _context2.abrupt("return", '');
19513
+
19514
+ case 1:
19515
+ case "end":
19516
+ return _context2.stop();
19517
+ }
19518
+ }
19519
+ }, _callee2);
19520
+ }));
19521
+
19522
+ function toDataURL(_x) {
19523
+ return _toDataURL.apply(this, arguments);
19524
+ }
19525
+
19526
+ return toDataURL;
19527
+ }();
19528
+
19529
+ return WebGPUContextService;
19448
19530
  }();
19449
19531
 
19450
- __decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], WebGLContextService.prototype, "canvasConfig", void 0);
19532
+ __decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], WebGPUContextService.prototype, "canvasConfig", void 0);
19451
19533
 
19452
- WebGLContextService = __decorate([g.singleton({
19534
+ __decorate([g.inject(DeviceRendererPlugin), __metadata("design:type", Plugin$1)], WebGPUContextService.prototype, "deviceRendererPlugin", void 0);
19535
+
19536
+ WebGPUContextService = __decorate([g.singleton({
19453
19537
  token: g.ContextService
19454
- })], WebGLContextService);
19538
+ })], WebGPUContextService);
19455
19539
 
19456
19540
  var containerModule$5 = g.Module(function (register) {
19457
19541
  /**
19458
19542
  * implements ContextService
19459
19543
  */
19460
- register(WebGLContextService);
19544
+ register(WebGPUContextService);
19461
19545
  });
19462
19546
  var ContextRegisterPlugin = /*#__PURE__*/function () {
19463
- function ContextRegisterPlugin() {
19547
+ function ContextRegisterPlugin(rendererPlugin) {
19548
+ this.rendererPlugin = void 0;
19464
19549
  this.name = 'webgpu-context-register';
19550
+ this.rendererPlugin = rendererPlugin;
19465
19551
  }
19466
19552
 
19467
19553
  var _proto = ContextRegisterPlugin.prototype;
19468
19554
 
19469
19555
  _proto.init = function init(container) {
19556
+ container.register(DeviceRendererPlugin, {
19557
+ useValue: this.rendererPlugin
19558
+ });
19470
19559
  container.load(containerModule$5, true);
19471
19560
  };
19472
19561
 
19473
19562
  _proto.destroy = function destroy(container) {
19474
19563
  container.unload(containerModule$5);
19564
+ container.remove(DeviceRendererPlugin);
19475
19565
  };
19476
19566
 
19477
19567
  return ContextRegisterPlugin;
@@ -19484,14 +19574,15 @@
19484
19574
  var _this;
19485
19575
 
19486
19576
  _this = _AbstractRenderer.call(this, config) || this;
19577
+ var deviceRendererPlugin = new Plugin$1();
19487
19578
 
19488
- _this.registerPlugin(new ContextRegisterPlugin());
19579
+ _this.registerPlugin(new ContextRegisterPlugin(deviceRendererPlugin));
19489
19580
 
19490
19581
  _this.registerPlugin(new Plugin());
19491
19582
 
19492
19583
  _this.registerPlugin(new Plugin$4());
19493
19584
 
19494
- _this.registerPlugin(new Plugin$1());
19585
+ _this.registerPlugin(deviceRendererPlugin);
19495
19586
 
19496
19587
  _this.registerPlugin(new Plugin$2());
19497
19588