Rule 3.4
Chapter 3, Textual structure and names Test
A local variable, parameter, module constant or module variable that collides with a GLSL ES 3.00 identifier restriction must be renamed consistently by the GLSL writer; helper function renaming retains its existing behavior. A struct, field, override or binding whose GLSL spelling is reserved receives a planned GLSL spelling (Proposal 0070). The record of a binding or of an override carries that spelling as emittedGlsl, which equals emitted where the two spellings agree (Proposal 0151). The record of a struct or of a field carries emitted only (Proposal 0070, D3). No diagnostic is reported for such a name.
The rule text and the parts under it are the compiler's own English, as the design document writes them.
Rationale
GLSL’s variable spellings can change without changing source values. The remaining names belong to interface or host contracts; GLSL is the second target: its spelling leaves the WGSL name as authored, and a GLSL word no longer stops the GLSL emit.
Derives from
ANGLE at shader version 300, including the gl_ prefix and __ shape restrictions, and the shared GLSL_ES300_RESERVED authority.
How it is verified
Checked by a test. A test, a gate script or a CI workflow names this rule, and the traceability check fails when a file listed below stops naming it.
Where the rule says the compiler enforces it:
the GLSL spellings of the spelling plan (planSpellings in src/core/spelling-plan.ts), sanitizeVariableNames and sanitizeReservedIdents in src/core/backends/glsl-sanitize.ts, and src/compiler/ts/reserved-names.test.ts.
The files that verify it at commit af54ddad5, each at the first line that names the rule:
See also
- Rule 3.3 Test
- Rule 3.5 Test
- Design rules
- Error codes
Source
The rule at commit af54ddad5:
docs/language-design.md:282(the design document)reqs/rules/RULE-0304.md(its traceability item)