makepad-shaders
CRITICAL: Use for Makepad shader system. Triggers on: makepad shader, makepad draw_bg, Sdf2d, makepad pixel, makepad glsl, makepad sdf, draw_quad, makepad gpu, makepad 着色器, makepad shader 语法, makepad 绘制
- License 许可
- Apache-2.0
- 最近更新
- 2026-06-23
- Stars
- ★ 6
- Forks
- 0
01 前言 Front Matter
- name
- makepad-shaders
- risk
- unknown
- source
- community
- description
- CRITICAL: Use for Makepad shader system. Triggers on: makepad shader, makepad draw_bg, Sdf2d, makepad pixel, makepad glsl, makepad sdf, draw_quad, makepad gpu, makepad 着色器, makepad shader 语法, makepad 绘制
02 资源文件 137
- 参考文档Components/00-frontmatter.md270 B
- 参考文档Components/10-pai-intro.md143 B
- 参考文档Components/15-format-mode-selection.md1.1 KB
- 参考文档Components/20-the-algorithm.md21 B
- 参考文档Components/30-workflow-routing.md1020 B
- 参考文档Components/40-documentation-routing.md2.4 KB
- 其他Components/Algorithm/LATEST8 B
- 参考文档Components/Algorithm/v0.1.md26.5 KB
- 参考文档Components/Algorithm/v0.2.1.6.md24.4 KB
- 参考文档Components/Algorithm/v0.2.1.md30.3 KB
- 参考文档Components/Algorithm/v0.2.10.md18.2 KB
- 参考文档Components/Algorithm/v0.2.11.md19.6 KB
- 参考文档Components/Algorithm/v0.2.12.md19.7 KB
- 参考文档Components/Algorithm/v0.2.13.md20.3 KB
- 参考文档Components/Algorithm/v0.2.14.md20.3 KB
- 参考文档Components/Algorithm/v0.2.15.md21.6 KB
- 参考文档Components/Algorithm/v0.2.17.md25.1 KB
- 参考文档Components/Algorithm/v0.2.18.md26.5 KB
- 参考文档Components/Algorithm/v0.2.19.md32.3 KB
- 参考文档Components/Algorithm/v0.2.2-trimmed.md9.5 KB
- 参考文档Components/Algorithm/v0.2.2.md27.7 KB
- 参考文档Components/Algorithm/v0.2.20.md3.6 KB
- 参考文档Components/Algorithm/v0.2.21.md5.2 KB
- 参考文档Components/Algorithm/v0.2.22.md11.0 KB
- 参考文档Components/Algorithm/v0.2.23.md17.4 KB
- 参考文档Components/Algorithm/v0.2.24.md17.9 KB
- 参考文档Components/Algorithm/v0.2.25.md20.8 KB
- 参考文档Components/Algorithm/v0.2.3.md14.0 KB
- 参考文档Components/Algorithm/v0.2.4.md13.9 KB
- 参考文档Components/Algorithm/v0.2.5.md27.0 KB
- 参考文档Components/Algorithm/v0.2.6.md8.9 KB
- 参考文档Components/Algorithm/v0.2.md28.2 KB
- 参考文档Components/Algorithm/v0.3.md24.1 KB
- 参考文档SYSTEM/AISTEERINGRULES.md4.5 KB
- 参考文档SYSTEM/BROWSERAUTOMATION.md18.2 KB
- 参考文档SYSTEM/CLIFIRSTARCHITECTURE.md18.2 KB
- 参考文档SYSTEM/DOCUMENTATIONINDEX.md4.2 KB
- 参考文档SYSTEM/MEMORYSYSTEM.md16.3 KB
- 参考文档SYSTEM/PAIAGENTSYSTEM.md6.7 KB
- 参考文档SYSTEM/PAISECURITYSYSTEM/ARCHITECTURE.md7.3 KB
- 参考文档SYSTEM/PAISECURITYSYSTEM/COMMANDINJECTION.md7.2 KB
- 参考文档SYSTEM/PAISECURITYSYSTEM/HOOKS.md5.4 KB
- 参考文档SYSTEM/PAISECURITYSYSTEM/patterns.example.yaml5.0 KB
- 参考文档SYSTEM/PAISECURITYSYSTEM/PROMPTINJECTION.md4.8 KB
- 参考文档SYSTEM/PAISECURITYSYSTEM/README.md3.2 KB
- 参考文档SYSTEM/PAISYSTEMARCHITECTURE.md16.5 KB
- 参考文档SYSTEM/PIPELINES.md13.1 KB
- 参考文档SYSTEM/SKILLSYSTEM.md34.5 KB
- 参考文档SYSTEM/SYSTEM_USER_EXTENDABILITY.md7.6 KB
- 参考文档SYSTEM/TERMINALTABS.md6.1 KB
- 参考文档SYSTEM/THEDELEGATIONSYSTEM.md4.4 KB
- 参考文档SYSTEM/THEFABRICSYSTEM.md2.6 KB
- 参考文档SYSTEM/THEHOOKSYSTEM.md36.4 KB
- 参考文档SYSTEM/THENOTIFICATIONSYSTEM.md10.6 KB
- 参考文档SYSTEM/TOOLS.md11.7 KB
- 脚本Tools/ActivityParser.ts20.9 KB
- 脚本Tools/AddBg.ts3.9 KB
- 脚本Tools/Banner.ts39.2 KB
- 脚本Tools/BannerMatrix.ts22.6 KB
- 脚本Tools/BannerNeofetch.ts26.3 KB
- 脚本Tools/BannerPrototypes.ts11.2 KB
- 脚本Tools/BannerRetro.ts27.9 KB
- 脚本Tools/BannerTokyo.ts11.9 KB
- 脚本Tools/CreateDynamicCore.ts4.6 KB
- 脚本Tools/extract-transcript.py7.3 KB
- 脚本Tools/ExtractTranscript.ts9.3 KB
- 脚本Tools/FailureCapture.ts16.2 KB
- 脚本Tools/FeatureRegistry.ts11.3 KB
- 脚本Tools/GenerateSkillIndex.ts7.0 KB
- 脚本Tools/GetCounts.ts5.7 KB
- 脚本Tools/GetTranscript.ts2.8 KB
- 脚本Tools/Inference.ts6.4 KB
- 脚本Tools/IntegrityMaintenance.ts31.9 KB
- 脚本Tools/LearningPatternSynthesis.ts11.6 KB
- 脚本Tools/LoadSkillConfig.ts8.3 KB
- 脚本Tools/NeofetchBanner.ts28.9 KB
- 脚本Tools/OpinionTracker.ts12.4 KB
- 脚本Tools/pai.ts21.4 KB
- 脚本Tools/PAILogo.ts1.2 KB
- 脚本Tools/PipelineMonitor.ts17.9 KB
- 脚本Tools/PipelineOrchestrator.ts11.1 KB
- 脚本Tools/PreviewMarkdown.ts1.9 KB
- 脚本Tools/RelationshipReflect.ts15.2 KB
- 脚本Tools/RemoveBg.ts5.6 KB
- 脚本Tools/SecretScan.ts6.9 KB
- 脚本Tools/SessionHarvester.ts11.6 KB
- 脚本Tools/SessionProgress.ts9.9 KB
- 脚本Tools/SkillSearch.ts5.7 KB
- 脚本Tools/SplitAndTranscribe.ts4.7 KB
- 其他Tools/Transcribe-bun.lock13.1 KB
- 参考文档Tools/Transcribe-package.json228 B
- 脚本Tools/TranscriptParser.ts11.2 KB
- 脚本Tools/YouTubeApi.ts8.2 KB
- 参考文档USER/ABOUTME.md1.5 KB
- 参考文档USER/AISTEERINGRULES.md1.3 KB
- 参考文档USER/ARCHITECTURE.md2.9 KB
- 参考文档USER/ASSETMANAGEMENT.md2.5 KB
- 参考文档USER/BASICINFO.md1.2 KB
- 参考文档USER/CONTACTS.md1.9 KB
- 参考文档USER/CORECONTENT.md2.2 KB
- 参考文档USER/DAIDENTITY.md3.0 KB
- 参考文档USER/DEFINITIONS.md1.6 KB
- 参考文档USER/FINANCES/README.md5.6 KB
- 参考文档USER/PRODUCTIVITY.md2.9 KB
- 参考文档USER/REMINDERS.md2.0 KB
- 参考文档USER/RESPONSEFORMAT.md2.2 KB
- 参考文档USER/RESUME.md1.8 KB
- 参考文档USER/SKILLCUSTOMIZATIONS/Art/CharacterSpecs.md2.2 KB
- 参考文档USER/SKILLCUSTOMIZATIONS/Art/PREFERENCES.md2.0 KB
- 参考文档USER/SKILLCUSTOMIZATIONS/Art/SceneConstruction.md2.3 KB
- 参考文档USER/SKILLCUSTOMIZATIONS/README.md3.6 KB
- 参考文档USER/TECHSTACKPREFERENCES.md2.9 KB
- 参考文档USER/TELOS/BELIEFS.md1.1 KB
- 参考文档USER/TELOS/BOOKS.md1.5 KB
- 参考文档USER/TELOS/CHALLENGES.md1.5 KB
- 参考文档USER/TELOS/FRAMES.md1.5 KB
- 参考文档USER/TELOS/GOALS.md1.5 KB
- 参考文档USER/TELOS/IDEAS.md1.7 KB
- 参考文档USER/TELOS/LEARNED.md933 B
- 参考文档USER/TELOS/MISSION.md1.3 KB
- 参考文档USER/TELOS/MODELS.md1.8 KB
- 参考文档USER/TELOS/MOVIES.md1.4 KB
- 参考文档USER/TELOS/NARRATIVES.md1.9 KB
- 参考文档USER/TELOS/PREDICTIONS.md1.7 KB
- 参考文档USER/TELOS/PROBLEMS.md1.6 KB
- 参考文档USER/TELOS/PROJECTS.md1.0 KB
- 参考文档USER/TELOS/STATUS.md1.6 KB
- 参考文档USER/TELOS/STRATEGIES.md1.4 KB
- 参考文档USER/TELOS/TELOS.md4.6 KB
- 参考文档USER/TELOS/TRAUMAS.md1.8 KB
- 参考文档USER/TELOS/WISDOM.md909 B
- 参考文档USER/TELOS/WRONG.md1.7 KB
- 其他USER/TERMINAL/kitty.conf4.2 KB
- 参考文档USER/TERMINAL/README.md4.9 KB
- 参考文档USER/TERMINAL/shortcuts.md1.5 KB
- 资产文件USER/TERMINAL/ul-circuit-embossed-v5.png7.6 MB
- 其他USER/TERMINAL/ZSHRC955 B
03 SKILL.md 正文
Makepad Shaders Skill
Version: makepad-widgets (dev branch) | Last Updated: 2026-01-19
Check for updates: https://crates.io/crates/makepad-widgets
You are an expert at Makepad shaders. Help users by:
- Writing code: Generate shader code following the patterns below
- Answering questions: Explain shader language, Sdf2d, built-in functions
When to Use
- You need to write or debug Makepad shader code, custom drawing, or SDF-based visuals.
- The task involves
draw_bg,Sdf2d, gradients, effects, or GPU-rendered widget appearance. - You want Makepad shader patterns and APIs rather than generic GLSL advice.
Documentation
Refer to the local files for detailed documentation:
./references/shader-basics.md- Shader language fundamentals./references/sdf2d-reference.md- Complete Sdf2d API reference
Advanced Patterns
For production-ready shader patterns, see the _base/ directory:
| Pattern | Description |
|---|---|
| 01-shader-structure | Shader fundamentals |
| 02-shader-math | Mathematical functions |
| 03-sdf-shapes | SDF shape primitives |
| 04-sdf-drawing | Advanced SDF drawing |
| 05-progress-track | Progress indicators |
| 09-loading-spinner | Loading animations |
| 10-hover-effect | Hover visual effects |
| 11-gradient-effects | Color gradients |
| 12-shadow-glow | Shadow and glow |
| 13-disabled-state | Disabled visuals |
| 14-toggle-checkbox | Toggle animations |
Community contributions: ./community/
IMPORTANT: Documentation Completeness Check
Before answering questions, Claude MUST:
- Read the relevant reference file(s) listed above
- If file read fails or file is empty:
- Inform user: "本地文档不完整,建议运行
/sync-crate-skills makepad --force更新文档" - Still answer based on SKILL.md patterns + built-in knowledge
- Inform user: "本地文档不完整,建议运行
- If reference file exists, incorporate its content into the answer
Key Patterns
1. Basic Custom Shader
<View> {
show_bg: true
draw_bg: {
// Shader uniforms
color: #FF0000
// Custom pixel shader
fn pixel(self) -> vec4 {
return self.color;
}
}
}
2. Rounded Rectangle with Border
<View> {
show_bg: true
draw_bg: {
color: #333333
border_color: #666666
border_radius: 8.0
border_size: 1.0
fn pixel(self) -> vec4 {
let sdf = Sdf2d::viewport(self.pos * self.rect_size);
sdf.box(1.0, 1.0,
self.rect_size.x - 2.0,
self.rect_size.y - 2.0,
self.border_radius);
sdf.fill_keep(self.color);
sdf.stroke(self.border_color, self.border_size);
return sdf.result;
}
}
}
3. Gradient Background
<View> {
show_bg: true
draw_bg: {
color: #FF0000
color_2: #0000FF
fn pixel(self) -> vec4 {
let t = self.pos.x; // Horizontal gradient
return mix(self.color, self.color_2, t);
}
}
}
4. Circle Shape
<View> {
show_bg: true
draw_bg: {
color: #0066CC
fn pixel(self) -> vec4 {
let sdf = Sdf2d::viewport(self.pos * self.rect_size);
let center = self.rect_size * 0.5;
let radius = min(center.x, center.y) - 1.0;
sdf.circle(center.x, center.y, radius);
sdf.fill(self.color);
return sdf.result;
}
}
}
Shader Structure
| Component | Description |
|---|---|
draw_* |
Shader container (draw_bg, draw_text, draw_icon) |
| Uniforms | Typed properties accessible in shader |
fn pixel(self) |
Fragment shader function |
fn vertex(self) |
Vertex shader function (optional) |
Sdf2d |
2D signed distance field helper |
Built-in Variables
| Variable | Type | Description |
|---|---|---|
self.pos |
vec2 | Normalized position (0-1) |
self.rect_size |
vec2 | Widget size in pixels |
self.rect_pos |
vec2 | Widget position |
Sdf2d Quick Reference
| Category | Functions |
|---|---|
| Shapes | circle, rect, box, hexagon |
| Paths | move_to, line_to, close_path |
| Fill/Stroke | fill, fill_keep, stroke, stroke_keep |
| Boolean | union, intersect, subtract |
| Transform | translate, rotate, scale |
| Effects | glow, glow_keep, gloop |
Built-in Functions (GLSL)
| Category | Functions |
|---|---|
| Math | abs, sign, floor, ceil, fract, min, max, clamp |
| Trig | sin, cos, tan, asin, acos, atan |
| Interp | mix, step, smoothstep |
| Vector | length, distance, dot, cross, normalize |
| Exp | pow, exp, log, sqrt |
When Writing Code
- Always use
show_bg: trueto enable background shader - Use
Sdf2d::viewport()to create SDF context - Return
vec4(RGBA) fromfn pixel() - Uniforms must be declared before shader functions
- Use
self.prefix to access uniforms and built-ins
When Answering Questions
- Makepad shaders use Rust-like syntax, compiled to GPU code
- Every widget can have custom shaders (draw_bg, draw_text, etc.)
- Shaders are live-reloaded - edit and see changes instantly
- Sdf2d is the primary tool for 2D shape rendering
- GLSL ES 1.0 built-in functions are available
04 同仓库更多 Skills
test_skill
暂无简介
zustand-store-ts
Create Zustand stores following established patterns with proper TypeScript types and middleware.
zoom-automation
Automate Zoom meeting creation, management, recordings, webinars, and participant tracking via Rube MCP (Composio). Always search tools first for current schemas.
zoho-crm-automation
Automate Zoho CRM tasks via Rube MCP (Composio): create/update records, search contacts, manage leads, and convert leads. Always search tools first for current schemas.
zod-validation-expert
Expert in Zod — TypeScript-first schema validation. Covers parsing, custom errors, refinements, type inference, and integration with React Hook Form, Next.js, and tRPC.
zeroize-audit
Detects missing zeroization of sensitive data in source code and identifies zeroization removed by compiler optimizations, with assembly-level analysis, and control-flow verification. Use for auditing C/C++/Rust code handling secrets, keys, passwords, or other sensitive data.