From 41537c5310720396a2a557c65882c9657edff55f Mon Sep 17 00:00:00 2001 From: chelgeson1click Date: Wed, 6 May 2026 19:44:00 -0700 Subject: [PATCH 1/3] Init branch --- index.html | 3 ++- public/css/MainLayout.css | 11 +++++++++++ sample/particleLife/meta.ts | 10 +++++++++- src/main.ts | 8 +++++++- src/samples.ts | 2 +- 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 0ab4784c..f4fee6f5 100644 --- a/index.html +++ b/index.html @@ -79,7 +79,8 @@

View source!View as standalone webpage -

+

+

diff --git a/public/css/MainLayout.css b/public/css/MainLayout.css index b8906414..2779b9a1 100644 --- a/public/css/MainLayout.css +++ b/public/css/MainLayout.css @@ -141,3 +141,14 @@ search { } +#description p { + margin-top: 10px; + margin-bottom: 10px; +} + +#description ul { + margin-top: 8px; + margin-bottom: 8px; + padding-left: 15px; +} + diff --git a/sample/particleLife/meta.ts b/sample/particleLife/meta.ts index 4823324c..e3c654d8 100644 --- a/sample/particleLife/meta.ts +++ b/sample/particleLife/meta.ts @@ -1,6 +1,14 @@ +const description = [ + `This example demonstrates how to simulate large numbers of particles using a few spatial partitioning methods.`, + `* **Atomic Linked Lists**: Each cell atomically maintains a linked list of resident particles.`, + `* **Counting Sort**: Sorts particles by computing their cell's start offset with a prefix sum.`, + `* **Prefix Sum**: Optimized Counting Sort using a parallel prefix sum with subgroup operations.`, + `* **NSquared**: No spatial sorting, each particle evaluates the forces of every other particle.`, +]; + export default { name: 'Particle Life', - description: `This example demonstrates how to simulate large numbers of particles using a few spatial partitioning methods.`, + description: description, filename: __DIRNAME__, external: { url: 'https://gpu-life.silverspace.io?sample', diff --git a/src/main.ts b/src/main.ts index 14e592c3..00eb2e93 100644 --- a/src/main.ts +++ b/src/main.ts @@ -193,7 +193,13 @@ function setSampleIFrame( titleElem.textContent = name; document.title = `WebGPU Samples - ${name}`; - descriptionElem.innerHTML = markdownConverter.makeHtml(description); + if (Array.isArray(description)) { + for (const paragraph of description) { + descriptionElem.innerHTML += markdownConverter.makeHtml(paragraph); + } + } else { + descriptionElem.innerHTML = markdownConverter.makeHtml(description); + } // Replace the iframe because changing src adds to the user's history. sampleContainerElem.innerHTML = ''; diff --git a/src/samples.ts b/src/samples.ts index 1621b444..f57fdbbf 100644 --- a/src/samples.ts +++ b/src/samples.ts @@ -55,7 +55,7 @@ export type SourceInfo = { export type SampleInfo = { name: string; tocName?: string; - description: string; + description: string | string[]; openInNewTab?: boolean; filename: string; // used if sample is local external?: { url: string; sourceURL: string }; // used if sample is remote From 22bd2faa1f67e7a224d3572e073b0a369595d618 Mon Sep 17 00:00:00 2001 From: chelgeson1click Date: Wed, 6 May 2026 20:14:07 -0700 Subject: [PATCH 2/3] simplify approach --- sample/particleLife/meta.ts | 14 +++++++------- src/main.ts | 8 +------- src/samples.ts | 2 +- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/sample/particleLife/meta.ts b/sample/particleLife/meta.ts index e3c654d8..b3d1fc86 100644 --- a/sample/particleLife/meta.ts +++ b/sample/particleLife/meta.ts @@ -1,10 +1,10 @@ -const description = [ - `This example demonstrates how to simulate large numbers of particles using a few spatial partitioning methods.`, - `* **Atomic Linked Lists**: Each cell atomically maintains a linked list of resident particles.`, - `* **Counting Sort**: Sorts particles by computing their cell's start offset with a prefix sum.`, - `* **Prefix Sum**: Optimized Counting Sort using a parallel prefix sum with subgroup operations.`, - `* **NSquared**: No spatial sorting, each particle evaluates the forces of every other particle.`, -]; +const description = `\ +This example demonstrates how to simulate large numbers of particles using a few spatial partitioning methods. +* **Atomic Linked Lists**: Each cell atomically maintains a linked list of resident particles. +* **Counting Sort**: Sorts particles by computing their cell's start offset with a prefix sum. +* **Prefix Sum**: Optimized Counting Sort using a parallel prefix sum with subgroup operations. +* **NSquared**: No spatial sorting, each particle evaluates the forces of every other particle. +`; export default { name: 'Particle Life', diff --git a/src/main.ts b/src/main.ts index 00eb2e93..14e592c3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -193,13 +193,7 @@ function setSampleIFrame( titleElem.textContent = name; document.title = `WebGPU Samples - ${name}`; - if (Array.isArray(description)) { - for (const paragraph of description) { - descriptionElem.innerHTML += markdownConverter.makeHtml(paragraph); - } - } else { - descriptionElem.innerHTML = markdownConverter.makeHtml(description); - } + descriptionElem.innerHTML = markdownConverter.makeHtml(description); // Replace the iframe because changing src adds to the user's history. sampleContainerElem.innerHTML = ''; diff --git a/src/samples.ts b/src/samples.ts index f57fdbbf..1621b444 100644 --- a/src/samples.ts +++ b/src/samples.ts @@ -55,7 +55,7 @@ export type SourceInfo = { export type SampleInfo = { name: string; tocName?: string; - description: string | string[]; + description: string; openInNewTab?: boolean; filename: string; // used if sample is local external?: { url: string; sourceURL: string }; // used if sample is remote From 910e841cb98e0ccdc463c8321cfec82ee40b37d8 Mon Sep 17 00:00:00 2001 From: chelgeson1click Date: Wed, 6 May 2026 20:16:07 -0700 Subject: [PATCH 3/3] simplify css --- public/css/MainLayout.css | 7 ------- 1 file changed, 7 deletions(-) diff --git a/public/css/MainLayout.css b/public/css/MainLayout.css index 2779b9a1..6a8d085e 100644 --- a/public/css/MainLayout.css +++ b/public/css/MainLayout.css @@ -141,14 +141,7 @@ search { } -#description p { - margin-top: 10px; - margin-bottom: 10px; -} - #description ul { - margin-top: 8px; - margin-bottom: 8px; padding-left: 15px; }