docs: Vertex and fragment fundamentals#2455
docs: Vertex and fragment fundamentals#2455aleksanderkatan wants to merge 10 commits intodocs/new-docsfrom
Conversation
|
pkg.pr.new packages benchmark commit |
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:No major changes. 📋 All resultsClick to reveal the results table (350 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
Resolution Time Benchmark---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.96, 1.89, 4.19, 6.75, 7.34, 12.02, 21.40, 25.37]
line [0.89, 1.90, 4.25, 6.50, 7.08, 10.26, 21.76, 23.51]
line [0.89, 1.87, 4.06, 5.92, 7.01, 9.76, 22.15, 21.34]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.31, 0.59, 0.69, 0.87, 1.17, 1.22, 1.50, 1.68]
line [0.26, 0.49, 0.69, 0.83, 1.11, 1.13, 1.38, 1.59]
line [0.31, 0.49, 0.67, 0.80, 1.04, 1.16, 1.38, 1.59]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.83, 2.23, 4.27, 7.03, 12.05, 24.66, 57.75, 113.81]
line [0.90, 1.86, 4.64, 6.18, 12.30, 26.12, 56.21, 111.18]
line [0.78, 2.02, 4.23, 6.54, 12.77, 27.04, 57.97, 111.15]
|
2e34891 to
63f84a6
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new “Vertices and fragments” Fundamentals documentation page to explain render pipeline basics (vertex/fragment stages, primitive topologies, interpolation, simple animation, and fullscreen-triangle fragment techniques) and wires it into the docs sidebar navigation.
Changes:
- Added a new Fundamentals MDX page covering points/lines/triangles, varying interpolation, animation via uniforms, and SDF-style drawing with a fullscreen triangle.
- Added the new page to the Starlight sidebar under “Fundamentals”.
Reviewed changes
Copilot reviewed 2 out of 9 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| apps/typegpu-docs/src/content/docs/fundamentals/vertices-and-fragments.mdx | New Fundamentals article introducing render pipelines, with multiple runnable examples and accompanying assets. |
| apps/typegpu-docs/astro.config.mjs | Adds a sidebar entry for the new Fundamentals page. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Where compute pipelines executes threads on a grid you define, render pipelines work in stages. | ||
| You configure the pipeline on what kind of shape (either points, lines or triangles) to draw, and during the draw call: |
|
|
||
| <Image src={redPixels} alt="Three red pixels" /> | ||
|
|
||
| It is a little more complicated than creating a dispatching a compute pipeline. |
| 3. **Define a vertex function**, which tells the GPU where each vertex is located. | ||
| When dispatching the pipeline later, we'll specify how many vertices to draw. | ||
| The GPU runs this function once per vertex, with `$vertexIndex` going from `0` up to `count - 1`. |
| {/* TODO: clip space visualization */} | ||
|
|
| const canvas = document.querySelector('canvas') as HTMLCanvasElement; | ||
| ``` | ||
|
|
||
| 6. **Call `root.configureContext`**. This will crete and configure a context for the provided canvas. |
| const context = root.configureContext({ canvas }); | ||
| ``` | ||
|
|
||
| 7. **Dispatch the pipeline** by providing a color attachment and calling `.draw(count)`, where `count` is the number of vertices to draw. |
|
|
||
| import colorfulPixels from './colorful-pixels.png'; | ||
|
|
||
| <Image src={colorfulPixels} alt="Three pixels, one red, one blue and one green." /> |
|
|
||
| Before, we drew points and lines in a very low resolution. | ||
| On high resolution canvases, they are barely visible. | ||
| Unfortunately, there is no way change the width of the drawn points and lines. |
No description provided.