Theme Catppuccin
Make yourself at homeCatppuccin

A softer light for long learning sessions.

Appearance

Loading your preference…

Dark palette

Choose a dark palette to try it.

Light uses Latte. Your choices stay in this browser.

Let the seeds move

SKETCHBOOK / 07 Signal Garden · 2-week chapter

Page 1 of 3: A thread owns one seed

Parallel work needs a boundary

A thread owns one seed

Start with 1,003 seeds so the count is deliberately not a multiple of a convenient workgroup width. Give each invocation one seed index and reject indices outside the valid count before reading or writing any buffer. The host validates the count against the allocation capacity and dispatch limits; the shader guard handles the rounded final workgroup. These two checks protect different boundaries. A shader guard cannot rescue a host that bound a smaller buffer than the advertised count.

Use a simple representation: position and velocity stored in explicit vec4 records or another documented layout. Keep padding and std430 rules aligned with the C++ serializer. Choose a supported local size from queried limits. Workgroup count is ceiling division, with overflow-safe host arithmetic and a cap on maxComputeWorkGroupCount. “My GPU is fast” is not a meaningful bound.

The first update can add a small deterministic drift, wrap positions inside a fixed box, and write a separate output buffer. There are no atomics or subgroup assumptions in this milestone, and no hardware ray-tracing extension is required. A tiny CPU oracle updates the same initial seeds so you can compare results before trusting the animation.

From the page to your own work

Your studio assignment.

Animate a bounded seed cloud and verify selected states against a CPU oracle.

A finish line you can see

A deterministic seed study, tail-case result, and compute-to-draw resource diagram.

  1. Test zero or skipped work, one seed, and a non-multiple-of-group count.
  2. Validate count against capacity and queried dispatch limits.
  3. Explain every old/new buffer reader across overlapping frames.
  4. Record numerical checks separately from screenshots.
Keep the evidence in your weekly notebook ↗
Explain it like an engineer

Try answering aloud before opening the review notes. Use your own implementation as evidence.

Why can ping-pong buffers still race in a renderer with several frames in flight?
  • Two names do not establish when old readers finish.
  • A later compute write can overlap a previous graphics read of the same allocation.
  • Track all uses and add dependencies or independently retired slots.

These prompts support practice; they are not an automatic assessment of your work.

A small creative variation ↗

Add a single-step mode that advances exactly one fixed update per key press.

Optional. Save it for later if this chapter already feels full.

Coming back after a break? ↩

Reduce to one seed, one step, and one CPU comparison. Restore the cloud after the values agree.

Books & principles behind this study +

Original Parallax explanations and assignments, with these works for further reading.

YOUR MARGIN NOTES

Leave yourself a good question.

What changed your mind? What would you try next?

Notes are private to this browser and saved as you write.

A CHECKPOINT, NOT A SCORE

Can you explain the idea and try the exercise yourself?

Completion records your own assessment. It does not compile or test your C++.
Companion source 2 files