GLSL Encyclopedia
Overview
Use a docs-first workflow for GLSL work. Prefer the official GLSL language/specification docs at https://docs.vulkan.org/glsl/latest/index.html, consult cached local copies under .GLSL-Encyclopedia/ before re-fetching, and record useful authoritative excerpts plus environment-specific operational learnings so future work gets faster, safer, and more grounded.
This skill is for the GLSL language/spec layer. It should trigger for real GLSL syntax/semantic/interface questions, not for generic rendering talk and not for Vulkan API questions unless the actual issue is specifically about GLSL shader source.
Workflow
- 1. Classify the task
- Decide whether the task is a GLSL language question, shader-authoring task, shader-review task, compiler-error/debugging task, stage-specific behavior question, or cross-language translation/comparison task where GLSL is one side.
- Use this skill when the task materially depends on GLSL syntax, qualifiers, types, built-ins, interface/layout rules, stage rules, preprocessor/version behavior, or shader authoring semantics.
- Do not use this skill for generic rendering concepts, generic Vulkan API debugging, or non-GLSL shader languages unless the GLSL language layer is actually in play.
- 2. Check local cache first
- Use
.GLSL-Encyclopedia/ as the local knowledge/cache root.
- Check these locations first when relevant:
-
.GLSL-Encyclopedia/docs/docs.vulkan.org/glsl/latest/...
-
.GLSL-Encyclopedia/notes/components/...
-
.GLSL-Encyclopedia/notes/patterns/...
-
.GLSL-Encyclopedia/inventory/...
- If a cached page or note already answers the question well enough, use it.
- 3. Consult authoritative GLSL docs before answering or acting
- Before answering direct or indirect GLSL questions that depend on exact syntax, qualifier behavior, type rules, stage restrictions, built-in variable/function semantics, layout/interface rules, or version-sensitive details, consult the official GLSL docs unless the answer is already well-supported by the local cache.
- Before performing non-trivial GLSL shader review or authoring guidance, consult the relevant docs first when:
- exact language syntax or legal combinations matter
- stage-specific behavior or interface matching is easy to misremember
- the task involves compile errors, layout rules, extension/version behavior, or built-in semantics
- If the problem is really about Vulkan API object behavior, synchronization, descriptors, swapchains, or VUID-driven valid-usage rules rather than GLSL language semantics, prefer the Vulkan skill instead of stretching this one.
- Do not improvise fragile GLSL answers from memory when the docs are easy to check.
- 4. Cache consulted docs locally
- When you consult a GLSL docs page, save a normalized cache copy under
.GLSL-Encyclopedia/docs/docs.vulkan.org/glsl/latest/....
- Mirror the official docs path structure as much as practical.
- Cache only pages actually consulted; do not try to mirror the whole GLSL spec eagerly.
- Use
scripts/cache_doc.py when appropriate.
- 5. Separate authoritative documentation from local observations
- Store official-doc-derived material under
.GLSL-Encyclopedia/docs/....
- Store environment-specific operational knowledge under:
-
.GLSL-Encyclopedia/notes/components/
-
.GLSL-Encyclopedia/notes/patterns/
-
.GLSL-Encyclopedia/inventory/
- Distinguish clearly between:
- authoritative documented behavior
- observed project/environment shader conventions
- inferred best-practice guidance
- 6. Record useful local learnings
- After useful live work, save durable notes such as:
- project-specific shader conventions
- recurring compile/validation-error patterns
- stage-interface or layout gotchas
- version/extension adoption decisions
- safe/unsafe operational boundaries for the codebase or environment
- Prefer concise durable notes over re-learning the same GLSL details later.
Live Work Rules
- - Treat authoritative GLSL docs lookup as the default preflight for non-trivial GLSL work.
- Prefer read/inspect first when entering unfamiliar shader code.
- Treat stage interfaces, layout qualifiers, buffer/image/sampler usage, preprocessor/version behavior, built-in semantics, and compiler-error interpretation as higher-sensitivity areas.
- When uncertainty remains after checking cache + docs, say so and avoid bluffing.
- When answering a question, mention when useful whether the answer comes from cached official docs, a fresh official docs lookup, or live observed shader/project state.
Data Root
Use this workspace-local root for cache and notes:
Expected structure:
- - INLINECODE14
- INLINECODE15
- INLINECODE16
- INLINECODE17
Use scripts/init_workspace.py to create or repair the expected directory structure.
Note Destinations
- - Component-specific observations → INLINECODE19
- Reusable GLSL patterns/gotchas → INLINECODE20
- Environment-wide shader/access info → INLINECODE21
- Cached official docs → INLINECODE22
Secrets / Sensitive Data
- - Do not store plaintext credentials, API keys, session tokens, private URLs, recovery codes, or other secrets in the encyclopedia notes/inventory tree.
- If a note needs to mention access details, keep it high-level and redact or omit secret material.
- Treat these workspace notes as operational memory, not as a secrets vault.
Resources
- -
scripts/init_workspace.py — create or repair the .GLSL-Encyclopedia/ directory tree. - INLINECODE25 — fetch and cache a consulted official GLSL docs page under
.GLSL-Encyclopedia/docs/.... - INLINECODE27 — detailed operating workflow and evidence-handling rules.
- INLINECODE28 — canonical
.GLSL-Encyclopedia/ directory structure. - INLINECODE30 — useful GLSL topic groupings for faster authoritative lookup.
Good Outcomes
- - Answer a GLSL question using cached or freshly checked official docs instead of guesswork.
- Inspect GLSL shader code after checking the relevant docs and record any new project-specific language or convention knowledge.
- Build a growing local GLSL knowledge cache that makes later work faster, safer, and more grounded.
- Turn one-off GLSL discoveries into durable notes so future work does not rediscover them from scratch.
Avoid
- - Answering GLSL-specific questions purely from memory when the docs are easy to consult.
- Treating local project shader conventions as if they were guaranteed authoritative GLSL behavior.
- Dumping large amounts of low-value docs into the workspace without a reason.
- Writing project-specific observations into the official-doc cache tree.
- Confusing generic Vulkan API questions with GLSL language questions when the actual issue is not about GLSL itself.
GLSL 百科全书
概述
在GLSL工作中采用文档优先的工作流程。优先使用官方GLSL语言/规范文档(位于 https://docs.vulkan.org/glsl/latest/index.html),在重新获取前先查阅 .GLSL-Encyclopedia/ 下的本地缓存副本,并记录有用的权威摘录以及特定环境的操作经验,使未来的工作更快速、更安全、更有依据。
本技能适用于 GLSL 语言/规范层。它应针对实际的GLSL语法/语义/接口问题触发,而非通用的渲染讨论,也不适用于Vulkan API问题,除非实际问题确实与GLSL着色器源码相关。
工作流程
- 1. 任务分类
- 判断任务是GLSL语言问题、着色器编写任务、着色器审查任务、编译器错误/调试任务、特定阶段行为问题,还是涉及GLSL的跨语言翻译/比较任务。
- 当任务实质上依赖于GLSL语法、限定符、类型、内置函数、接口/布局规则、阶段规则、预处理器/版本行为或着色器编写语义时,使用本技能。
- 不要将本技能用于通用渲染概念、通用Vulkan API调试或非GLSL着色器语言,除非实际涉及GLSL语言层。
- 2. 优先检查本地缓存
- 使用 .GLSL-Encyclopedia/ 作为本地知识/缓存根目录。
- 在相关时优先检查以下位置:
- .GLSL-Encyclopedia/docs/docs.vulkan.org/glsl/latest/...
- .GLSL-Encyclopedia/notes/components/...
- .GLSL-Encyclopedia/notes/patterns/...
- .GLSL-Encyclopedia/inventory/...
- 如果缓存的页面或笔记已能充分回答问题,则直接使用。
- 3. 在回答或操作前查阅权威GLSL文档
- 在回答直接或间接的GLSL问题前,如果问题依赖于精确的语法、限定符行为、类型规则、阶段限制、内置变量/函数语义、布局/接口规则或版本敏感细节,且本地缓存无法充分支持答案,则查阅官方GLSL文档。
- 在执行非平凡的GLSL着色器审查或编写指导前,在以下情况下先查阅相关文档:
- 精确的语言语法或合法组合很重要
- 特定阶段行为或接口匹配容易记错
- 任务涉及编译错误、布局规则、扩展/版本行为或内置语义
- 如果问题实际上是关于Vulkan API对象行为、同步、描述符、交换链或VUID驱动的有效使用规则,而非GLSL语言语义,则优先使用Vulkan技能而非本技能。
- 当文档易于查阅时,不要仅凭记忆即兴给出脆弱的GLSL答案。
- 4. 本地缓存查阅过的文档
- 当查阅GLSL文档页面时,在 .GLSL-Encyclopedia/docs/docs.vulkan.org/glsl/latest/... 下保存规范化的缓存副本。
- 尽可能镜像官方文档的路径结构。
- 仅缓存实际查阅过的页面;不要急于镜像整个GLSL规范。
- 在适当时使用 scripts/cache_doc.py。
- 5. 区分权威文档与本地观察
- 将官方文档衍生材料存储在 .GLSL-Encyclopedia/docs/... 下。
- 将特定环境的操作知识存储在:
- .GLSL-Encyclopedia/notes/components/
- .GLSL-Encyclopedia/notes/patterns/
- .GLSL-Encyclopedia/inventory/
- 清晰区分:
- 权威文档记录的行为
- 观察到的项目/环境着色器约定
- 推断的最佳实践指导
- 6. 记录有用的本地经验
- 在完成有用的实际工作后,保存持久的笔记,例如:
- 项目特定的着色器约定
- 重复出现的编译/验证错误模式
- 阶段接口或布局陷阱
- 版本/扩展采用决策
- 代码库或环境的安全/不安全操作边界
- 优先保存简洁持久的笔记,而非日后重新学习相同的GLSL细节。
实际操作规则
- - 将权威GLSL文档查阅视为非平凡GLSL工作的默认前置步骤。
- 在接触不熟悉的着色器代码时,优先阅读/检查。
- 将阶段接口、布局限定符、缓冲区/图像/采样器使用、预处理器/版本行为、内置语义和编译器错误解释视为高敏感区域。
- 当检查缓存和文档后仍存在不确定性时,如实说明并避免猜测。
- 在回答问题时,酌情说明答案来自缓存的官方文档、新的官方文档查阅,还是实时观察到的着色器/项目状态。
数据根目录
使用以下工作区本地根目录进行缓存和笔记:
预期结构:
- - .GLSL-Encyclopedia/docs/docs.vulkan.org/glsl/latest/...
- .GLSL-Encyclopedia/notes/components/...
- .GLSL-Encyclopedia/notes/patterns/...
- .GLSL-Encyclopedia/inventory/...
使用 scripts/init_workspace.py 创建或修复预期的目录结构。
笔记存储位置
- - 组件特定观察 → .GLSL-Encyclopedia/notes/components/<组件名称>.md
- 可复用的GLSL模式/陷阱 → .GLSL-Encyclopedia/notes/patterns/<主题>.md
- 环境范围的着色器/访问信息 → .GLSL-Encyclopedia/inventory/*.md
- 缓存的官方文档 → .GLSL-Encyclopedia/docs/docs.vulkan.org/glsl/latest/...
机密/敏感数据
- - 不要在百科全书笔记/清单树中存储明文凭据、API密钥、会话令牌、私有URL、恢复代码或其他机密信息。
- 如果笔记需要提及访问细节,请保持高层次描述,并编辑或省略机密材料。
- 将这些工作区笔记视为操作记忆,而非机密保险库。
资源
- - scripts/initworkspace.py — 创建或修复 .GLSL-Encyclopedia/ 目录树。
- scripts/cachedoc.py — 获取并缓存查阅过的官方GLSL文档页面到 .GLSL-Encyclopedia/docs/... 下。
- references/workflow.md — 详细的操作工作流程和证据处理规则。
- references/cache-layout.md — 规范的 .GLSL-Encyclopedia/ 目录结构。
- references/topic-map.md — 有用的GLSL主题分组,便于快速权威查阅。
良好成果
- - 使用缓存或新查阅的官方文档而非猜测来回答GLSL问题。
- 在查阅相关文档后检查GLSL着色器代码,并记录任何新的项目特定语言或约定知识。
- 构建不断增长的本地GLSL知识缓存,使后续工作更快速、更安全、更有依据。
- 将一次性的GLSL发现转化为持久的笔记,使未来的工作不必从头重新发现。
避免事项
- - 在文档易于查阅时,纯粹凭记忆回答GLSL特定问题。
- 将本地项目着色器约定视为有保证的权威GLSL行为。
- 无理由地向工作区倾倒大量低价值文档。
- 将项目特定观察写入官方文档缓存树。
- 当实际问题并非关于GLSL本身时,混淆通用Vulkan API问题与GLSL语言问题。