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.

Time is another resource

SKETCHBOOK / 05 Signal Garden · 2-week chapter

Page 1 of 4: Name the hazard before the barrier

Execution and visibility

Name the hazard before the barrier

Imagine compute writing seed positions followed by a vertex shader reading them as a storage buffer. Submission order alone does not describe all necessary memory visibility. Write four facts: producer stage, producer access, consumer stage, consumer access. Here they are compute shader, shader storage write, vertex shader, shader storage read. Those facts determine a synchronization2 memory dependency. If the same bytes are fetched as vertex attributes instead, the consumer is vertex attribute input with vertex attribute read access; the correct barrier changes with the actual use.

An execution dependency orders work; a memory dependency additionally handles availability and visibility of the relevant accesses. Keep ranges narrow enough to explain, then optimize only after correctness is established. ALL_COMMANDS everywhere can conceal an incomplete mental model and unnecessarily serialize work. A narrow mask chosen by guesswork is worse. Start from the resource-use graph and include every real consumer.

The fragment below assumes one queue family and a storage-buffer consumer in the vertex shader, with synchronization2 enabled. Record it after the producing dispatch and before vkCmdBeginRendering, outside any render-pass instance. This compute-to-graphics dependency is not a barrier to insert inside the dynamic rendering region. Queue-family ownership is explicitly ignored because there is no transfer. Cross-family use needs a separate release/acquire and semaphore plan; changing the family fields alone is not that plan.

From the page to your own work

Your studio assignment.

Replace a live mesh without destroying resources still referenced by submitted work.

A finish line you can see

A resource-use diagram, one correct compute-to-graphics dependency, and a bounded retirement log.

  1. Identify source and destination stage/access pairs.
  2. Explain the one-queue scope of the first retirement implementation.
  3. Retain an old owner until its recorded completion point.
  4. Treat failed submission as a state transition rather than an eventual signal.
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 is a CPU mutex insufficient to make a GPU read see a prior GPU write?
  • The mutex orders host threads only.
  • Device execution and memory accesses require the API dependencies for the actual stages and ranges.
  • Completion is also needed before the host reuses or destroys borrowed storage.

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

A small creative variation ↗

Animate a palette reload while limiting pending replacements to two.

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

Coming back after a break? ↩

Use the simulated frame lab to delay one completion. Draw the resulting owner lifetime before editing native code.

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 4 files