@antv/g-webgpu 1.7.72 → 1.7.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +4 -1
- package/dist/index.js +4 -1
- package/dist/index.umd.js +409 -286
- package/dist/index.umd.min.js +1 -1
- package/dist/pkg/glsl_wgsl_compiler.d.ts +48 -0
- package/dist/pkg/glsl_wgsl_compiler.js +223 -0
- package/dist/pkg/glsl_wgsl_compiler_bg.wasm +0 -0
- package/dist/pkg/package.json +17 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @antv/g-webgpu
|
|
2
|
+
|
|
3
|
+
This is an experimental renderer implemented with WebGPU.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
import { Canvas, CanvasEvent, Circle } from '@antv/g';
|
|
7
|
+
import { Renderer as WebGPURenderer } from '@antv/g-webgpu';
|
|
8
|
+
|
|
9
|
+
const webgpuRenderer = new WebGPURenderer({
|
|
10
|
+
shaderCompilerPath: '/glsl_wgsl_compiler_bg.wasm',
|
|
11
|
+
onContextLost: () => {},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// create a canvas
|
|
15
|
+
const canvas = new Canvas({
|
|
16
|
+
container: 'container',
|
|
17
|
+
width: 600,
|
|
18
|
+
height: 500,
|
|
19
|
+
renderer: webgpuRenderer,
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Options
|
|
24
|
+
|
|
25
|
+
### shaderCompilerPath
|
|
26
|
+
|
|
27
|
+
We translate GLSL to WGSL with [naga]() bundled into WASM which need to be loaded at runtime.
|
|
28
|
+
|
|
29
|
+
### onContextLost
|
|
30
|
+
|
|
31
|
+
https://github.com/gpuweb/gpuweb/blob/main/design/ErrorHandling.md#fatal-errors-requestadapter-requestdevice-and-devicelost
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,10 @@ import * as DomInteraction from '@antv/g-plugin-dom-interaction';
|
|
|
5
5
|
import * as HTMLRenderer from '@antv/g-plugin-html-renderer';
|
|
6
6
|
import * as WebGPUDevice from '@antv/g-plugin-webgpu-device';
|
|
7
7
|
export { DomInteraction, DeviceRenderer, WebGPUDevice, HTMLRenderer };
|
|
8
|
-
|
|
8
|
+
interface WebGPURendererConfig extends RendererConfig {
|
|
9
|
+
shaderCompilerPath: string;
|
|
10
|
+
onContextLost: () => void;
|
|
11
|
+
}
|
|
9
12
|
export declare class Renderer extends AbstractRenderer {
|
|
10
13
|
constructor(config?: Partial<WebGPURendererConfig>);
|
|
11
14
|
}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,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,UAAU,oBAAqB,SAAQ,cAAc;IACnD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,qBAAa,QAAS,SAAQ,gBAAgB;gBAChC,MAAM,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC;CAgBnD"}
|
package/dist/index.esm.js
CHANGED
|
@@ -490,7 +490,10 @@ var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
|
490
490
|
var deviceRendererPlugin = new Plugin();
|
|
491
491
|
_this.registerPlugin(new ContextRegisterPlugin(deviceRendererPlugin));
|
|
492
492
|
_this.registerPlugin(new Plugin$1());
|
|
493
|
-
_this.registerPlugin(new Plugin$2(
|
|
493
|
+
_this.registerPlugin(new Plugin$2({
|
|
494
|
+
shaderCompilerPath: config === null || config === void 0 ? void 0 : config.shaderCompilerPath,
|
|
495
|
+
onContextLost: config === null || config === void 0 ? void 0 : config.onContextLost
|
|
496
|
+
}));
|
|
494
497
|
_this.registerPlugin(deviceRendererPlugin);
|
|
495
498
|
_this.registerPlugin(new Plugin$3());
|
|
496
499
|
_this.registerPlugin(new Plugin$4());
|
package/dist/index.js
CHANGED
|
@@ -511,7 +511,10 @@ var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
|
511
511
|
var deviceRendererPlugin = new DeviceRenderer.Plugin();
|
|
512
512
|
_this.registerPlugin(new ContextRegisterPlugin(deviceRendererPlugin));
|
|
513
513
|
_this.registerPlugin(new ImageLoader.Plugin());
|
|
514
|
-
_this.registerPlugin(new WebGPUDevice.Plugin(
|
|
514
|
+
_this.registerPlugin(new WebGPUDevice.Plugin({
|
|
515
|
+
shaderCompilerPath: config === null || config === void 0 ? void 0 : config.shaderCompilerPath,
|
|
516
|
+
onContextLost: config === null || config === void 0 ? void 0 : config.onContextLost
|
|
517
|
+
}));
|
|
515
518
|
_this.registerPlugin(deviceRendererPlugin);
|
|
516
519
|
_this.registerPlugin(new DomInteraction.Plugin());
|
|
517
520
|
_this.registerPlugin(new HTMLRenderer.Plugin());
|