What problem does it solve?
Writing correct GPU shaders in Makepad 2.0 requires knowing its custom shader syntax, variable types, premultiplied alpha rules, and SDF2D drawing API, which differ from standard GLSL and are easy to get wrong.
Core Features & Use Cases
- Shader Authoring Guidance: Covers pixel/vertex function syntax, instance vs uniform vs varying variables, built-in variables like self.pos and draw_pass.time, and the mandatory Pal.premul alpha rule.
- SDF2D Shape Drawing: Documents primitives (circle, box, arc, hexagon), combinators (union, subtract, gloop), transforms, and fill/stroke/glow operations for resolution-independent UI graphics.
- Advanced Patterns: Includes custom DrawQuad structs in Rust with #[repr(C)], instanced particle rendering via begin_many_instances, capsule SDF shapes, and Splash scripting capability boundaries.
- Use Case: Build a rounded button whose background color animates on hover by declaring an instance hover variable and mixing colors inside the pixel shader, then batch-render 10,000 interactive particles in a single GPU draw call.
Quick Start
Ask the AI to write a Makepad 2.0 pixel shader that draws a rounded rectangle with a hover color transition using SDF2D and premultiplied alpha.