Skip to content

Commit

Permalink
升级 VitePress
Browse files Browse the repository at this point in the history
  • Loading branch information
jinleili committed Jan 27, 2024
1 parent fefb91f commit eae0773
Show file tree
Hide file tree
Showing 9 changed files with 1,694 additions and 3,762 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ target/
/docs/.vitepress/components/wasm/*
/docs/.vitepress/dist/*
/docs/.vitepress/cache/*
/docs/public/wasm/*

/image.png
/output*.*
Expand Down
1,260 changes: 412 additions & 848 deletions .pnp.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build-wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ RUSTFLAGS=--cfg=web_sys_unstable_apis cargo build --no-default-features --releas
# Generate bindings
for i in target/wasm32-unknown-unknown/release/*.wasm;
do
wasm-bindgen --no-typescript --out-dir docs/.vitepress/components/wasm --web "$i";
wasm-bindgen --no-typescript --out-dir docs/public/wasm --web "$i";
done
3 changes: 2 additions & 1 deletion docs/.vitepress/components/WasmExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export default {
this.loading = true;
this.exampleStarted = true;
try {
const module = await import(`./wasm/${this.example}.js`.replace('_', '-')/* @vite-ignore */);
const url = window.location.protocol +'//'+ window.location.host + '/learn-wgpu-zh'
const module = await import(/* @vite-ignore */`${url}/wasm/${this.example}.js`.replace('_', '-'));
module.default().then((instance) => {
this.loading = false;
this.exampleStarted = true;
Expand Down
3 changes: 2 additions & 1 deletion docs/.vitepress/components/WebGPUExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export default {
this.loading = true;
this.exampleStarted = true;
try {
const module = await import(/* @vite-ignore */`./wasm/${this.example}.js`.replace('_', '-'));
const url = window.location.protocol + '//' + window.location.host + '/learn-wgpu-zh'
const module = await import(/* @vite-ignore */`${url}/wasm/${this.example}.js`.replace('_', '-'));
module.default().then((instance) => {
this.loading = false;
this.exampleStarted = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

但 Chrome 118 上存在管线验证的 bug,导致会报如下警告而无法正常运行:

```log
```shell
Attribute offset (12) with format VertexFormat::Float32x3 (size: 12) doesn't fit in the vertex buffer stride (12).
- While validating attributes[1].
- While validating buffers[0].
Expand Down
1,014 changes: 622 additions & 392 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"devDependencies": {
"sass": "^1.63.6",
"vitepress": "^1.0.0-rc.32",
"vitepress": "^1.0.0-rc.40",
"vue": "^3.3.4"
}
}
}
Loading

0 comments on commit eae0773

Please sign in to comment.