JSPM

@antv/g-webgpu

1.6.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 83635
  • Score
    100M100P100Q169759F
  • License MIT

A renderer implemented by WebGPU

Package Exports

  • @antv/g-webgpu
  • @antv/g-webgpu/dist/index.esm.js
  • @antv/g-webgpu/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@antv/g-webgpu) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@antv/g-webgpu

This is an experimental renderer implemented with WebGPU.

import { Canvas, CanvasEvent, Circle } from '@antv/g';
import { Renderer as WebGPURenderer } from '@antv/g-webgpu';

const webgpuRenderer = new WebGPURenderer({
    shaderCompilerPath: '/glsl_wgsl_compiler_bg.wasm',
    onContextLost: () => {},
});

// create a canvas
const canvas = new Canvas({
    container: 'container',
    width: 600,
    height: 500,
    renderer: webgpuRenderer,
});

Options

shaderCompilerPath

We translate GLSL to WGSL with naga bundled into WASM which need to be loaded at runtime.

onContextLost

https://github.com/gpuweb/gpuweb/blob/main/design/ErrorHandling.md#fatal-errors-requestadapter-requestdevice-and-devicelost