@simulatte/webgpu 0.2.4 → 0.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.
- package/CHANGELOG.md +33 -0
- package/README.md +263 -71
- package/api-contract.md +70 -139
- package/assets/package-layers.svg +63 -0
- package/examples/direct-webgpu/compute-dispatch.js +66 -0
- package/examples/direct-webgpu/explicit-bind-group.js +85 -0
- package/examples/direct-webgpu/request-device.js +10 -0
- package/examples/doe-api/buffers-readback.js +9 -0
- package/examples/doe-api/compile-and-dispatch.js +30 -0
- package/examples/doe-api/compute-dispatch.js +25 -0
- package/examples/doe-routines/compute-once-like-input.js +36 -0
- package/examples/doe-routines/compute-once-matmul.js +53 -0
- package/examples/doe-routines/compute-once-multiple-inputs.js +27 -0
- package/examples/doe-routines/compute-once.js +23 -0
- package/headless-webgpu-comparison.md +2 -2
- package/layering-plan.md +1 -1
- package/native/doe_napi.c +102 -12
- package/package.json +2 -1
- package/prebuilds/darwin-arm64/doe_napi.node +0 -0
- package/prebuilds/darwin-arm64/libwebgpu_doe.dylib +0 -0
- package/prebuilds/darwin-arm64/metadata.json +6 -6
- package/prebuilds/linux-x64/doe_napi.node +0 -0
- package/prebuilds/linux-x64/libwebgpu_doe.so +0 -0
- package/prebuilds/linux-x64/metadata.json +5 -5
- package/scripts/generate-readme-assets.js +79 -6
- package/scripts/prebuild.js +23 -19
- package/src/auto_bind_group_layout.js +32 -0
- package/src/bun-ffi.js +93 -12
- package/src/bun.js +23 -2
- package/src/compute.d.ts +2 -1
- package/src/compute.js +671 -33
- package/src/doe.d.ts +127 -27
- package/src/doe.js +480 -114
- package/src/full.d.ts +8 -1
- package/src/full.js +28 -3
- package/src/index.js +1013 -38
package/src/full.d.ts
CHANGED
|
@@ -78,7 +78,14 @@ export interface FullBoundDoeNamespace
|
|
|
78
78
|
extends BoundDoeNamespace<GPUDevice, GPUBuffer, FullDoeKernel, FullDoeRunComputeOptions> {}
|
|
79
79
|
|
|
80
80
|
export interface FullDoeNamespace
|
|
81
|
-
extends DoeNamespace<
|
|
81
|
+
extends DoeNamespace<
|
|
82
|
+
GPUDevice,
|
|
83
|
+
GPUBuffer,
|
|
84
|
+
FullDoeKernel,
|
|
85
|
+
FullBoundDoeNamespace,
|
|
86
|
+
FullDoeRunComputeOptions,
|
|
87
|
+
RequestDeviceOptions
|
|
88
|
+
> {}
|
|
82
89
|
|
|
83
90
|
export const globals: Record<string, unknown>;
|
|
84
91
|
export function create(createArgs?: string[] | null): GPU;
|
package/src/full.js
CHANGED
|
@@ -1,8 +1,33 @@
|
|
|
1
|
-
import full from './index.js';
|
|
2
|
-
import {
|
|
1
|
+
import * as full from './index.js';
|
|
2
|
+
import { createDoeNamespace } from './doe.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Shared Doe API / Doe routines namespace for the full package surface.
|
|
6
|
+
*
|
|
7
|
+
* This exposes `await doe.requestDevice()` for the one-line Doe API entry,
|
|
8
|
+
* `doe.bind(device)` when you already have a full device, `doe.buffers.*` and
|
|
9
|
+
* `doe.compute.run(...)` / `doe.compute.compile(...)` for the `Doe API`
|
|
10
|
+
* surface, and `doe.compute.once(...)` for `Doe routines`.
|
|
11
|
+
*
|
|
12
|
+
* The exported `doe` object here is the JS convenience surface over the Doe
|
|
13
|
+
* runtime, not a separate runtime.
|
|
14
|
+
*
|
|
15
|
+
* This example shows the API in its basic form.
|
|
16
|
+
*
|
|
17
|
+
* ```js
|
|
18
|
+
* import { doe } from "@simulatte/webgpu";
|
|
19
|
+
*
|
|
20
|
+
* const gpu = await doe.requestDevice();
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* - The Doe API and Doe routines shape is the same as `@simulatte/webgpu/compute`; the difference is that the underlying device here stays full-surface rather than compute-only.
|
|
24
|
+
* - If you need explicit render, sampler, or surface APIs, keep the raw device from `requestDevice()` or access `gpu.device` after `doe.requestDevice()`.
|
|
25
|
+
*/
|
|
26
|
+
export const doe = createDoeNamespace({
|
|
27
|
+
requestDevice: full.requestDevice,
|
|
28
|
+
});
|
|
3
29
|
|
|
4
30
|
export * from './index.js';
|
|
5
|
-
export { doe };
|
|
6
31
|
|
|
7
32
|
export default {
|
|
8
33
|
...full,
|