@antv/g-webgpu 1.7.72 → 1.8.0-alpha.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.
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
@@ -1,10 +1,9 @@
1
- import { AbstractRendererPlugin } from '@antv/g-lite';
2
- import type * as DeviceRenderer from '@antv/g-plugin-device-renderer';
3
- export declare class ContextRegisterPlugin extends AbstractRendererPlugin {
4
- private rendererPlugin;
5
- name: string;
6
- constructor(rendererPlugin: DeviceRenderer.Plugin);
7
- init(): void;
8
- destroy(): void;
9
- }
10
- //# sourceMappingURL=ContextRegisterPlugin.d.ts.map
1
+ import { AbstractRendererPlugin } from '@antv/g-lite';
2
+ import type * as DeviceRenderer from '@antv/g-plugin-device-renderer';
3
+ export declare class ContextRegisterPlugin extends AbstractRendererPlugin {
4
+ private rendererPlugin;
5
+ name: string;
6
+ constructor(rendererPlugin: DeviceRenderer.Plugin);
7
+ init(): void;
8
+ destroy(): void;
9
+ }
@@ -1,20 +1,19 @@
1
- /// <reference types="@webgpu/types" />
2
- import type { CanvasContext, CanvasLike, DataURLOptions, GlobalRuntime, ContextService } from '@antv/g-lite';
3
- export declare class WebGPUContextService implements ContextService<GPUCanvasContext> {
4
- private $container;
5
- private $canvas;
6
- private dpr;
7
- private canvasConfig;
8
- private deviceRendererPlugin;
9
- constructor(context: GlobalRuntime & CanvasContext);
10
- init(): 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
1
+ /// <reference types="@webgpu/types" />
2
+ import type { CanvasContext, CanvasLike, DataURLOptions, GlobalRuntime, ContextService } from '@antv/g-lite';
3
+ export declare class WebGPUContextService implements ContextService<GPUCanvasContext> {
4
+ private $container;
5
+ private $canvas;
6
+ private dpr;
7
+ private canvasConfig;
8
+ private deviceRendererPlugin;
9
+ constructor(context: GlobalRuntime & CanvasContext);
10
+ init(): 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
+ }
package/dist/index.d.ts CHANGED
@@ -1,12 +1,14 @@
1
- import type { RendererConfig } from '@antv/g-lite';
2
- import { AbstractRenderer } from '@antv/g-lite';
3
- import * as DeviceRenderer from '@antv/g-plugin-device-renderer';
4
- import * as DomInteraction from '@antv/g-plugin-dom-interaction';
5
- import * as HTMLRenderer from '@antv/g-plugin-html-renderer';
6
- import * as WebGPUDevice from '@antv/g-plugin-webgpu-device';
7
- export { DomInteraction, DeviceRenderer, WebGPUDevice, HTMLRenderer };
8
- type WebGPURendererConfig = RendererConfig;
9
- export declare class Renderer extends AbstractRenderer {
10
- constructor(config?: Partial<WebGPURendererConfig>);
11
- }
12
- //# sourceMappingURL=index.d.ts.map
1
+ import type { RendererConfig } from '@antv/g-lite';
2
+ import { AbstractRenderer } from '@antv/g-lite';
3
+ import * as DeviceRenderer from '@antv/g-plugin-device-renderer';
4
+ import * as DomInteraction from '@antv/g-plugin-dom-interaction';
5
+ import * as HTMLRenderer from '@antv/g-plugin-html-renderer';
6
+ import * as WebGPUDevice from '@antv/g-plugin-webgpu-device';
7
+ export { DomInteraction, DeviceRenderer, WebGPUDevice, HTMLRenderer };
8
+ interface WebGPURendererConfig extends RendererConfig {
9
+ shaderCompilerPath: string;
10
+ onContextLost: () => void;
11
+ }
12
+ export declare class Renderer extends AbstractRenderer {
13
+ constructor(config?: Partial<WebGPURendererConfig>);
14
+ }