--- # edu-4u7w title: 'edu: write chapter on shader programming' status: completed type: feature priority: low created_at: 2026-03-10T23:30:00Z updated_at: 2026-03-16T02:32:28Z --- ## Background From `edu/TODO.md`: Hands-on: Shader programming. A practical introduction to GPU shaders, written with Rust as the host language. The course covers the graphics pipeline conceptually and has hands-on exercises writing WGSL shaders driven by `wgpu`. ## Content outline (suggested) ### Part 1 — The GPU and the Graphics Pipeline 1. CPU vs GPU: parallel execution model 2. The programmable pipeline: vertex shaders, fragment shaders, compute shaders 3. What is WGSL? (WebGPU Shading Language) — syntax overview ### Part 2 — Setting Up with wgpu 4. What is `wgpu`? Cross-platform graphics API in Rust 5. Exercise 1: Create a window and clear it to a colour (the GPU 'hello world') 6. The render loop: swap chains, frames, command encoders ### Part 3 — Vertex and Fragment Shaders 7. Vertices, buffers, and the vertex shader 8. Interpolation and the fragment shader 9. Exercise 2: Draw a coloured triangle 10. Exercise 3: Animate the triangle using a time uniform ### Part 4 — Textures and Samplers 11. Texture coordinates (UVs), texture creation, sampler config 12. Exercise 4: Render a textured quad ### Part 5 — Compute Shaders 13. Compute pipelines: dispatching work groups 14. Storage buffers and read/write access from WGSL 15. Exercise 5: GPU-accelerate a particle simulation ### Part 6 — Going Further 16. Post-processing effects (bloom, blur) — conceptual overview 17. Signed Distance Fields for font rendering 18. Resources: Learn WGPU tutorial, Shadertoy, The Book of Shaders ## File to create - `edu/src/shaders.md` - Add to `edu/src/SUMMARY.md` under a `# Graphics` section ## Summary of Changes All 18 sections written with full educational content covering the GPU execution model, wgpu setup, vertex/fragment shaders, textures, compute shaders, and advanced topics. ~4400 lines of content including full Rust+WGSL code examples, ASCII diagrams, and 5 hands-on exercises.