Add Demos page and nav integration#30
Conversation
-Add docs/demos.md with layout, sidebar: demos, and Galaxy Stars entry
|
Can you name the folder "demos" not "Demos" and correct that everywhere? |
|
I also asked Claude to review your .mjs and it noted the following issues with
const sorter = new OneSweepSort({
device: device,
datatype: "u32",
direction: "ascending",
copyOutputToTemp: true,
// inputLength is missing — OneSweepSort requires it to size internal buffers
});
await mappableBuffer.mapAsync(GPUMapMode.READ);
mappableBuffer.unmap(); // mapped and immediately unmapped — data is discarded
particles.sort((a, b) => a.size - b.size); // CPU sort used insteadThe GPU runs but its output is thrown away. Either use the GPU result
The function sorts particles on CPU, arranges them in a phyllotaxis spiral,
const normalized = scannedValues[i] / maxValue; // never referenced belowMinor, but suggests the scan output isn't fully driving the visualization.
|
|
Oh! I created so many branches that I forgot where I actually made the changes and updates. I tried to retrieve the correct one, but I didn’t check properly. I saw it was the working file and immediately created a PR, assuming it was correct. After this branch, I made additional changes. I’ll upload the updated version after I modify to demos instead of Demos. I also realized that performReduce doesn’t call the GPU at all our plan to add demos got postponed, and I completely forgot about it. |
…+ WebGPU error handling
|
Please, check this updated PR. Let me know if any additional changes are needed. |
|
The three substantive bugs from the first review are fixed:
Remaining issues:
The files live in Demos/ (capital D) but all links now reference /demos/ GitHub Pages runs on Linux (case-sensitive). /demos/interactive_demo.html will
} catch (error) {
isOperating = false;
currentOperation = null;
}showError was added for sort and reduce but not scan. If the scan fails, the
demos.md has title: demos, "demos run live in the browser", and ## Interactive |
|
performScan catch block silently swallows errors: Catch block intentionally stays silent because the upstream guards already validate everything that can fail |
docs/_includes/sidebar.html
Outdated
| <aside class="docs-sidebar"> | ||
| {%- if page.sidebar == "demos" -%} | ||
| <h3>Demos</h3> | ||
| <h3>demos</h3> |
There was a problem hiding this comment.
Text can be "Demos". It's just the directory needs to be "demos".
Claude does not agree with you and after reading its arguments, I agree with Claude. No, the claim is not accurate. There are real failure modes that can reach the The upstream guards check two things: that requestAdapter() returns non-null, Things that can legitimately throw inside performScan after those guards pass: GPU device loss. Devices can be lost mid-session due to driver crashes, GPU DLDFScan construction or pipeline compilation. The scan primitive compiles Buffer creation failure. With 100,000 particles (the slider maximum), the scan The inconsistency also undercuts the argument: performSort and performReduce The catch block should call showError and console.error, consistent with the |
|
Done! |
|
Please make the directory name "demos". Claude: Most previous issues are fixed. The scan catch block now calls showError and Two issues remain:
The files are physically in Demos/ (capital D). Every Jekyll link still uses header.html: /demos/interactive_demo.html Jekyll will output _site/Demos/interactive_demo.html. GitHub Pages serves on
https://github.com/gridwise-webgpu/gridwise/blob/main/demos/interactive_demo.mjs The file is at Demos/interactive_demo.mjs (capital D) in the repo. GitHub URLs One minor issue: The device.lost message has a double space: "GPU device lost please reload |
|
I checked its in demos directory small d . This is correct path : https://github.com/gridwise-webgpu/gridwise/blob/main/demos/interactive_demo.mjs. |
|
Ok I found it. Git tracks it as (capital D) Demos and that's what GitHub shows. The local macOS filesystem shows demos because macOS is case-insensitive and doesn't care. |
|
(MacOS is in fact case-sensitive, btw.) |
|
I promise, I changed the name. MacOS use a case-insensitive filesystem (the default). I didn't know that. |
|
TIL that MacOS is "case-insensitive but case-preserving"! |

Add demos.md with layout, sidebar: demos, and Galaxy Stars entry
Add demos sidebar block to sidebar.html (mirrors examples pattern)
Add Demos dropdown to header.html (after Examples)