summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2023-03-16 19:29:32 -0400
committerGitHub <noreply@github.com>2023-03-17 00:29:32 +0100
commit35196eab279340376929dd75ed717ef4830e2fa9 (patch)
tree5aefff339ef50d3e89ff36422c90e929dea3897f /tools
parent3f031ad9af2d61671f8408632f31592ac4186926 (diff)
BREAKING(unstable): remove WebGPU (#18094)
This PR _**temporarily**_ removes WebGPU (which has behind the `--unstable` flag in Deno), due to performance complications due to its presence. It will be brought back in the future; as a point of reference, Chrome will ship WebGPU to stable on 26/04/2023. --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/README.md13
-rwxr-xr-xtools/wgpu_sync.js115
2 files changed, 0 insertions, 128 deletions
diff --git a/tools/README.md b/tools/README.md
index e88f8d892..0c9607380 100644
--- a/tools/README.md
+++ b/tools/README.md
@@ -60,19 +60,6 @@ Tip: the `[bench_filter]` argument doesn't have to be an exact bench name, you
can use a shorthand or a partial match to profile a group of benches, e.g:
`./tools/flamebench.js de v8`
-## wgpu_sync.js
-
-`wgpu_sync.js` streamlines updating `deno_webgpu` from
-[gfx-rs/wgpu](https://github.com/gfx-rs/wgpu/).
-
-It essentially vendors the `deno_webgpu` tree with a few minor patches applied
-on top, somewhat similar to `git subtree`.
-
-1. Update `COMMIT` or `V_WGPU` in `./tools/wgpu_sync.js`
-2. Run `./tools/wgpu_sync.js`
-3. Double check changes, possibly patch
-4. Commit & send a PR with the updates
-
## copyright_checker.js
`copyright_checker.js` is used to check copyright headers in the codebase.
diff --git a/tools/wgpu_sync.js b/tools/wgpu_sync.js
deleted file mode 100755
index 31475bb37..000000000
--- a/tools/wgpu_sync.js
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/usr/bin/env -S deno run --unstable --allow-read --allow-write --allow-run
-// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-
-import { join, ROOT_PATH } from "./util.js";
-
-const COMMIT = "659f6977051345e4e06ab4832c6f7d268f25a1ad";
-const REPO = "gfx-rs/wgpu";
-const V_WGPU = "0.15";
-const TARGET_DIR = join(ROOT_PATH, "ext", "webgpu");
-
-async function bash(subcmd, opts = {}) {
- const { success, code } = await new Deno.Command("bash", {
- ...opts,
- args: ["-c", subcmd],
- stdout: "inherit",
- sdterr: "inherit",
- }).output();
-
- // Exit process on failure
- if (!success) {
- Deno.exit(code);
- }
-}
-
-async function clearTargetDir() {
- await bash(`rm -r ${TARGET_DIR}/*`);
-}
-
-async function checkoutUpstream() {
- // Path of deno_webgpu inside the TAR
- const tarPrefix = `${REPO.replace("/", "-")}-${
- COMMIT.slice(0, 7)
- }/deno_webgpu/`;
- const cmd =
- `curl -L https://api.github.com/repos/${REPO}/tarball/${COMMIT} | tar -C '${TARGET_DIR}' -xzvf - --strip=2 '${tarPrefix}'`;
- // console.log(cmd);
- await bash(cmd);
-}
-
-async function denoWebgpuVersion() {
- const coreCargo = join(ROOT_PATH, "Cargo.toml");
- const contents = await Deno.readTextFile(coreCargo);
- return contents.match(
- /^deno_webgpu = { version = "(\d+\.\d+\.\d+)", path = ".\/ext\/webgpu" }$/m,
- )[1];
-}
-
-async function patchFile(path, patcher) {
- const data = await Deno.readTextFile(path);
- const patched = patcher(data);
- await Deno.writeTextFile(path, patched);
-}
-
-async function patchCargo() {
- const vDenoWebgpu = await denoWebgpuVersion();
- await patchFile(
- join(TARGET_DIR, "Cargo.toml"),
- (data) =>
- data
- .replace(/^version = .*/m, `version = "${vDenoWebgpu}"`)
- .replace(
- /^repository.workspace = true/m,
- `repository = "https://github.com/gfx-rs/wgpu"`,
- )
- .replace(
- /^serde = { workspace = true, features = ["derive"] }/m,
- `serde.workspace = true`,
- )
- .replace(
- /^tokio = { workspace = true, features = ["full"] }/m,
- `tokio.workspace = true`,
- ),
- );
-
- await patchFile(
- join(ROOT_PATH, "Cargo.toml"),
- (data) =>
- data
- .replace(/^wgpu-core = .*/m, `wgpu-core = "${V_WGPU}"`)
- .replace(/^wgpu-types = .*/m, `wgpu-types = "${V_WGPU}"`),
- );
-}
-
-async function patchSrcLib() {
- await patchFile(
- join(TARGET_DIR, "src", "lib.rs"),
- (data) =>
- data.replace(
- `prefix "ext:deno_webgpu",`,
- `prefix "ext:deno_webgpu",`,
- ),
- );
-}
-
-async function patchSurface() {
- await patchFile(
- join(TARGET_DIR, "src", "surface.rs"),
- (data) =>
- data.replace(
- `prefix "ext:deno_webgpu",`,
- `prefix "ext:deno_webgpu",`,
- ),
- );
-}
-
-async function main() {
- await clearTargetDir();
- await checkoutUpstream();
- await patchCargo();
- await patchSrcLib();
- await patchSurface();
- await bash(join(ROOT_PATH, "tools", "format.js"));
-}
-
-await main();